src/services/deploymentEngine.ts) copies the files, records the deployment in the database, and updates the project’s production URL — all without any manual intervention. The subdomain middleware in src/index.ts then takes care of routing incoming requests to the right directory.
How deployment works
Copying build output
The deployment engine resolves the output path from the temporary build directory:- If an
outputDirwas determined (by framework detection or the project’s configured value), files are copied fromtemp/<folder>/<outputDir>/. - If no
outputDirapplies (for example, projects without a build command), the root of the build directory is used.
Production URL
The production URL is constructed from the project name and theBASE_DOMAIN environment variable:
projectTable.productionUrl in the database and emitted to the client in a deploymentUpdate Socket.io event.
Deployment record
A row is inserted into thedeployment table with status: "live" and a reference to the build that produced it. For rollbacks, this insert is skipped because the existing deployment record is reused — only the files on disk and the productionUrl are updated.
Deployment status values
| Status | Meaning |
|---|---|
live | The deployment is active and being served |
rolled_back | The deployment was superseded by a rollback to an earlier build |
Database schema
Subdomain routing middleware
Every HTTP request to the server first passes through the subdomain middleware before reaching any API route. The middleware:- Reads the
Hostheader from the request. - Splits on
.and takes the first segment as the subdomain. - Checks whether
deployments/<subdomain>/exists on disk. - If the directory exists, serves it with
express.static. Files that exist are returned directly (CSS, JS, images, etc.). - If no static file matches the request path, falls back to
deployments/<subdomain>/index.html— this enables client-side routing in single-page applications. - If the directory does not exist, calls
next()and the request continues to the API routes.
www subdomain is excluded from this logic so it never accidentally matches a deployment directory.
Only projects without secrets are automatically deployed as static sites. If a project has environment variables, the build pipeline sets a
hasEnvFile flag and skips the deployProject call. Shipping secrets inside a statically served build would expose them publicly.