Building from a git repository
Besides stacks that use ready-made images, a stack can build its application image on the server from your own source code. The repository must contain a Dockerfile; the compose file refers to the checked-out source as its build context (./source).
HD Services creates such a stack. After that you manage the source yourself on the Source tab.

Access to the repository
Section titled “Access to the repository”| Method | When |
|---|---|
| Deploy key (default) | The server generates an SSH key pair; you register the public key at the repository as a read-only deploy key. GitHub: repository Settings > Deploy keys > Add deploy key, “Allow write access” off. The private key never leaves the server. Use the ssh form of the URL (git@github.com:org/repo.git). |
| Token | A username plus a (read-only) access token, with the https form of the URL. |
| None | For a public repository. |
The key belongs to this server and keeps working when people, passwords or tokens change at your end.
Deploy
Section titled “Deploy”Deploy fetches the newest commit of the configured branch (or the pinned version), builds the application image, pulls the other images and restarts only what changed. Secrets never live in the repository: they are the stack’s settings and variables.
The first deploy is always manual: DNS, the access list and any data migration come first. After that:
- Automatic deploys on: a new commit on the branch is deployed within a few minutes (the repository is checked every five minutes), or at once through the GitHub push webhook.
- Automatic deploys off: you press Deploy yourself. Check now asks the repository for the newest commit without deploying.
Pinning and rolling back
Section titled “Pinning and rolling back”The Deploy history card lists the deployed commits, newest first. Deploy this version rebuilds the stack from that commit and pins the stack: automatic deploys pause until you press Follow the branch again. Rolling forward is the same button on a newer commit, or lifting the pin and pressing Deploy.
Nightly update
Section titled “Nightly update”With Nightly update on for a git stack, the current checkout is rebuilt at night (a refresh of the base images). New commits are not fetched by it.
Without a repository: uploading
Section titled “Without a repository: uploading”If you prefer not to connect a repository, you can place the source code yourself - as files written by your assistant (write_stack_source_files) or as an uploaded archive; the same stack then builds from those files. For a new stack, create it with an empty repository URL (an assistant omits the source field of create_stack): the stack then waits for the upload and can only be deployed after it. See Uploading files. Saving a repository on the Source tab puts the stack back on git.
Apps made in Lovable
Section titled “Apps made in Lovable”For a website or app built in Lovable there is the template Lovable app (lovable-node-app): one container, no database (the data stays in Lovable Cloud). Two things differ from an ordinary repository:
- The repository needs the HDDeploy Lovable Dockerfile in its root folder; HD Services supplies it. On every build it fetches the images Lovable keeps on its own CDN (git only holds pointers,
src/assets/*.asset.json). If an image is missing, the build fails and the output names the file. - Keep automatic deploys off: Lovable makes a commit for every change, so unfinished work would go live by itself. The Source tab shows when a newer commit is available; press Deploy when the change is ready.
The values SUPABASE_URL and SUPABASE_PUBLISHABLE_KEY on the Settings tab come from the repository’s .env file; they are public (the browser has them too).
Next.js apps with Supabase
Section titled “Next.js apps with Supabase”For a Next.js app that keeps its data in Supabase (often an app that ran on Vercel before) there is the template Next.js app with Supabase (nextjs-supabase): one container, no database on the server itself. Things to know:
- The source needs a Dockerfile in its root folder; HD Services supplies the HDDeploy Next.js Dockerfile.
- Enter the Project URL and the anon key (or publishable key) from Supabase on the Settings tab. They are public, but they are built into the app: after a change, Deploy again.
- Code that builds its own address from
new URL(request.url).origingetshttps://localhost:3000on this server. Useprocess.env.SITE_URLfor links in e-mails and for redirects; the template fills it withhttps://plus your domain. - In Supabase, set the Site URL under Authentication > URL Configuration to the new address and add it to the Redirect URLs, or invitation and password mails keep pointing at the old address.
- The Supabase backend can also live on this server: a stack from the template Supabase (self-hosted backend). The Project URL is then
https://plus that stack’s API domain, and the keys are on its Settings tab. See Supabase stacks.
Lovable apps with their own Supabase
Section titled “Lovable apps with their own Supabase”When a Lovable app wants to leave Lovable Cloud as well, there is the template Lovable app with its own Supabase (lovable-supabase): the website, the edge functions and the database migrations from the same repository, next to a complete Supabase backend on the server. Unlike lovable-node-app:
- The repository needs the HDDeploy Dockerfile for Lovable with Supabase in its root folder (one file with three parts: website, functions, migrations); HD Services supplies it.
- The website gets the API address and publishable key of this stack at build time, not the Lovable Cloud values from the repository’s
.envfile. After a change of the API domain a new build is needed. - Every deploy first applies the new migrations in
supabase/migrations. A failed migration keeps the website offline until a fixed version is deployed; that is why you keep automatic deploys off (the box is on by default when you create the stack: untick it, API/MCPautoDeploy: false). - Moving an existing Lovable Cloud project: do not deploy the stack before the database has been restored. See Supabase stacks.
Backup of the repository
Section titled “Backup of the repository”On the Backups page you can add a backup of the kind Git repository for a git stack: every night the complete repository (all branches, tags and history) is kept as one file. That keeps the source safe if the GitHub account is lost. The backup uses the same deploy key as the stack.