Put it online
Publish the Closeline API, dashboard and website on your own server with Docker, or each app on a Node.js host or Vercel.
For the Full Stack package
Before you deploy
Before going live. Every seed (yarn seed, yarn seed:prod and the first Docker start) creates the sample accounts with the password printed in the guides. On a server, start without the sample data instead, or change the sample accounts' passwords or delete them, and set your own JWT_SECRET before anyone else can reach the apps.
- Run the API with
NODE_ENV=production, your ownJWT_SECRETandCORS_ORIGINset to the website's and the dashboard's addresses. A production API refuses to start without them and says why. - Set
FRONTEND_URLandDASHBOARD_URLto the dashboard's address,PUBLIC_API_URLto the API's, andPUBLIC_MEDIA_URLto the API's address followed by/media: invitation and reset links, the checkout's return pages and invoice downloads are written from them. - Behind a reverse proxy (Nginx, Caddy, a load balancer), set
TRUST_PROXY=1, or2with Cloudflare in front of that proxy, so the sign-in limit counts visitors rather than the proxy. - Point your host's health check at
GET /api/health: it answers503until the database holds its tables. - Leave
DEMO_MODEandNEXT_PUBLIC_DEMO_MODEatfalse.
Before you deploy
Built without an API address, your app runs on its built-in sample data. On the dashboard any password signs in, the sample accounts are in the app's own code, and every change stays in the visitor's browser. Build it with your API's address before real users reach it.
The sample data modeLeave NEXT_PUBLIC_DEMO_MODE at false.
All three apps on one server with Docker
The docker-compose.yml that runs the CRM locally also runs it on a server. Give each app its own domain behind a web server that adds HTTPS, such as Caddy or Nginx, forwarding the website's domain to port 3030, the dashboard's to 3031 and the API's to 8000.
Name the three addresses and the first account
Create
.envin thecloseline-full-stackfolder, besidedocker-compose.yml. The frontends compile the addresses into their JavaScript, and the API'sCORS_ORIGIN,FRONTEND_URL,DASHBOARD_URL,PUBLIC_API_URLandPUBLIC_MEDIA_URLare built from them.SEED_SAMPLE_DATA=falsestarts the new volume without the sample data, with your own first account and an empty workspace of its own.closeline-full-stack/.envSITE_URL=https://www.your-domain.com ADMIN_URL=https://app.your-domain.com API_URL=https://api.your-domain.com SEED_SAMPLE_DATA=false ADMIN_EMAIL=you@your-domain.com ADMIN_PASSWORD=choose-a-long-password ADMIN_NAME=Your Name ADMIN_WORKSPACE=Your CompanyAdd your keys
The API also reads
back-end/.envwhen it exists, for Stripe, mail, the bucket, the assistant's provider keys and the MCP key. Create it from.env.example, fill in what you use and addTRUST_PROXY=1behind your web server. The compose file sets the database, the port,NODE_ENV=productionand the addresses itself, and the API generates aJWT_SECRETinto the data volume when you give none.Terminalincloseline-full-stackcp back-end/.env.example back-end/.envStart it in the background
Terminalincloseline-full-stackdocker compose up --build -dExpected result:
https://api.your-domain.com/api/healthanswers"status":"ok", and the dashboard's domain opens the sign-in page, where your first account signs in.
The services restart with the server. The database and the uploads live in the closeline-data volume. After you change an address or a port, run docker compose up --build -d again: the frontends have to be built with the new address. SEED_SAMPLE_DATA, ADMIN_EMAIL and ADMIN_PASSWORD are read on the first start of a new volume only.
Start without the sample data
Your own first account is created with the tables, an empty workspace of its own where it is the Admin, and the installation's Platform admin role. It needs ADMIN_EMAIL and ADMIN_PASSWORD (8 to 128 characters); ADMIN_NAME (Workspace Admin when empty) and ADMIN_WORKSPACE (named after the first name when empty) are optional. More people join through invitations, or sign up from the website.
| How you run the API | First account |
|---|---|
| Full stack with Docker | SEED_SAMPLE_DATA=false with ADMIN_EMAIL and ADMIN_PASSWORD in the .env beside docker-compose.yml, before the first start |
| API container | -e SEED_SAMPLE_DATA=false -e ADMIN_EMAIL=... -e ADMIN_PASSWORD=... on the first docker run with a new volume |
| Without Docker | yarn admin:create:prod once after yarn build, which asks in the terminal for any value left empty |
With SEED_SAMPLE_DATA=false and no ADMIN_EMAIL or ADMIN_PASSWORD, the container creates the tables only, and its log names the command that creates the account afterwards:
closeline-full-stackdocker compose exec -u node api node dist/database/create-admin.jsWith a single API container, the same command is docker exec -it -u node <container> node dist/database/create-admin.js. It refuses to run once the installation already has its Platform admin.
The API on its own with Docker
Any host that builds from a Dockerfile can run the API alone. The container keeps its SQLite database and the uploads in /data: mount a volume there, or the data is lost with the container. Put a web server that adds HTTPS in front of port 8000.
closeline-backenddocker build -t closeline-api .
docker run -d --restart unless-stopped -p 8000:8000 -v closeline-api-data:/data -e SEED_SAMPLE_DATA=false -e ADMIN_EMAIL=you@your-domain.com -e ADMIN_PASSWORD=choose-a-long-password -e CORS_ORIGIN=https://www.your-domain.com,https://app.your-domain.com -e FRONTEND_URL=https://app.your-domain.com -e DASHBOARD_URL=https://app.your-domain.com -e PUBLIC_API_URL=https://api.your-domain.com -e PUBLIC_MEDIA_URL=https://api.your-domain.com/media -e TRUST_PROXY=1 closeline-apiThe image already runs with NODE_ENV=production and its SQLite file in /data. Pass only the values you need, each with -e. An existing database is never changed on start: after updating the image, run docker exec -u node <container> node dist/database/schema.js once to bring its tables up to the new code.
The API on a Node.js host
Set the variables from .env.example on the host, with the production values above. The build command is yarn build and the start command yarn start:prod; yarn admin:create:prod runs once on a new database. A SQLite file needs a persistent disk; on a host without one, use MySQL.
corepack enable
yarn install
yarn build
yarn admin:create:prod
yarn start:prodThere are no migrations, and in production the API never changes the tables by itself. After an update whose code changes them, back up the database, then run yarn build and yarn schema:prod before yarn start:prod.
Payments on a server
With a live Stripe key, point a Stripe webhook at https://<api>/api/billing/webhooks/stripe with the events checkout.session.completed, invoice.paid, invoice.payment_failed and customer.subscription.deleted, and put its signing secret in STRIPE_WEBHOOK_SECRET. Renewals and failed payments are recorded only through it.
The frontends as Docker images
Each frontend's Dockerfile builds a standalone server, run as a user without admin rights: the website on port 3030, the dashboard on 3031. The addresses the browser opens are build arguments:
The dashboard, from its folder:
docker build -t closeline-dashboard --build-arg NEXT_PUBLIC_API_BASE_URL=https://api.your-domain.com/api --build-arg NEXT_PUBLIC_BASE_URL=https://app.your-domain.com --build-arg NEXT_PUBLIC_WEBSITE_URL=https://www.your-domain.com .
docker run -d --restart unless-stopped -p 3031:3031 closeline-dashboardThe website, from its folder:
docker build -t closeline-website --build-arg NEXT_PUBLIC_SITE_URL=https://www.your-domain.com --build-arg NEXT_PUBLIC_API_BASE_URL=https://api.your-domain.com/api --build-arg NEXT_PUBLIC_DASHBOARD_URL=https://app.your-domain.com .
docker run -d --restart unless-stopped -p 3030:3030 closeline-websiteThe dashboard's live updates connect to the API's address without /api, which it works out by itself; set NEXT_PUBLIC_WEBSOCKET_BASE_URL only when they live elsewhere. The website's own server calls the API while a page renders: when the browser's address does not work from inside its container, pass -e API_INTERNAL_URL= with an address that does.
A frontend on Vercel
Put the app in a private Git repository
Push the app's folder to a private repository on GitHub, GitLab or Bitbucket. Your licence does not allow sharing the source code publicly.
Import it in Vercel
Add a new project from that repository. Vercel detects Next.js; keep the default build settings. In a Full Stack repository, set the project's root directory to
dashboardorwebsite.Add the environment variables
Add
ENABLE_EXPERIMENTAL_COREPACKwith the value1, so Vercel installs with the Yarn versionpackage.jsonpins. Then the app's addresses: for the dashboardNEXT_PUBLIC_API_BASE_URL,NEXT_PUBLIC_BASE_URLandNEXT_PUBLIC_WEBSITE_URL; for the websiteNEXT_PUBLIC_SITE_URL,NEXT_PUBLIC_API_BASE_URLandNEXT_PUBLIC_DASHBOARD_URL.Deploy
Start the deployment, add your domain in the project's Domains settings, and add that address to the API's
CORS_ORIGIN; for the dashboard, set it as the API'sFRONTEND_URLandDASHBOARD_URLtoo.Expected result: Your domain opens the app: the dashboard's sign-in page, or the website's home page.
After you change a NEXT_PUBLIC_* variable, deploy again: the running app keeps the values it was built with.
A frontend on a Node.js server
With your settings in the app's .env, install, build and start:
corepack enable
yarn install
yarn build
yarn startThe dashboard answers on PORT from its .env, 3031 by default; the website on 3030, or yarn next start -p <port> for another. Put a web server in front for your domain and HTTPS, and keep yarn start running with a process manager or a system service.
After it is online
- Open both apps at
/enand/arand check both languages. - Every dashboard page tells search engines not to index it, through an
X-Robots-Tag: noindex, nofollowheader set innext.config.js, because a signed-in workspace does not belong in search results. The website is indexed, with its sitemap and canonical links built fromNEXT_PUBLIC_SITE_URL. - Replace the website's sample legal pages (privacy, terms, cookies and GDPR) with your own policies.
After it is online
Check that https://api.your-domain.com/api/health answers "status":"ok", then point your frontends at https://api.your-domain.com/api.