Getting Started
#
IntroductionThis guide will show you how to build a simple application using the Buerli headless API with Docker. Check out the Setup Environment section for deeper insights into setting up the ClassCAD server (with and without Docker) as well as the client.
#
Prerequisites#
Scaffold A New ProjectFirst, scaffold a new Vite project. Vite is a common build tool that aims to provide a faster and leaner development experience for modern web projects. You can use any other build tool you prefer, but Vite is recommended for its speed and simplicity.
By now you will have the following folder structure (you can remove files you do not need):
After you execute npm run dev
Vite will show you a URL where you can preview your application. Open the URL in your browser to see the default Vite application.
#
Set up the serverWe will now start the ClassCAD server. The server is a Node.js application that runs the ClassCAD business logic. It is responsible for handling the ClassCAD API requests and for serving the ClassCAD client application. Refer to docs/setup-environment/server for more information on how to set up the server.
#
Download a *.capp fileRegardless of the host platform you use, you need the ClassCAD application package, the so-called class file (ccapp). This file contains the ClassCAD business logic. Without it you will not be able to start the ClassCAD server.
Visit buerli.io, log in, and go to your profile. There you can download the ClassCAD application package.
#
Set up DockerGo to your project folder and create a new folder called docker
in the root of your project. Place the downloaded *.capp
file in this folder.
Create a new file called dockerfile
in the /docker
folder. This file contains the instructions to build a Docker image. The Docker image is a lightweight, standalone, executable package that contains the ClassCAD server.
dockerfile
- Please do not forget to replace
PATH-TO-CCAPP-FILE
with the path to your downloaded class file. - Please do not forget to bind the port when starting the docker container
- @classcad/linux-arm64 does not support DXF/SVG export!
It would be a good idea to add a docker-compose.yml
as well since it makes it easier to orchestrate the server.
docker-compose.yml
#
Start the serverFirst, make sure to link the right *.capp file in the dockerfile
.
Now you can start the server. If your IDE has docker integration you can start the server simply by right-clicking docker-compose.yml
and selecting "compose up".
You might want to make sure that the server is running. You can check the accepted
status in your Docker dashboard. You should see something like this
Visit http://0.0.0.0:9091/status in your browser to confirm the service is active. You will see a JSON response:
#
Write your first Buerli appFirst, install the necessary packages. We need threejs, react-three-fiber, the Buerli headless API and the Buerli React API.
Modify index.css
Modify App.jsx
In case your Vite dev server isn't running, start it with npm run dev
. Open the URL in your browser to see the application. You should see a box with cut outs.