Skip to content

Supabase stacks

Supabase is a backend for apps: a PostgreSQL database with sign-in (Auth), a REST and GraphQL API, Realtime, file storage (Storage) and the Studio dashboard. On HDDeploy the open-source edition runs as a stack on your own server. An app talks to it as it would to a project on supabase.co: with the API address and a key.

Template What is in it For whom
Supabase (self-hosted backend) (supabase) The backend only: database, Auth, REST/GraphQL, Realtime, Storage, Studio. No edge functions. An app that runs elsewhere or has a stack of its own (for example a Next.js app from the nextjs-supabase template, a mobile app) and needs its own database with sign-in and files.
Lovable app with its own Supabase (lovable-supabase) The same backend plus the app itself, its edge functions and its database migrations, built from the repository Lovable keeps up to date (or from uploaded source). An app made in Lovable that wants to leave Lovable Cloud, with the backend on the same server.

Both are generic templates: you create them yourself through New stack (or let your assistant do it with create_stack). Typical reasons to move: the data on a server of your own in the Netherlands, or code that needs the secret key Lovable Cloud does not hand out.

Lovable can keep editing the code, but it no longer manages the backend: migrations, edge functions and secrets are handled through this stack from then on.

Both templates recommend at least 8 GB of memory. It is advice, not a refusal: on a smaller server you can still create and deploy the stack, but it may become slow or stop under load. A Supabase stack uses about 1 to 1.2 GB at rest; your app, builds and busy moments come on top.

When the server has less, you see it beforehand: a warning on the creation form and on the new stack’s page, memoryWarning in GET /templates and list_templates, warnings in the creation answer, and a Warning: line from hddeploy stack create. A server counts as large enough from 90 % of the recommendation (an 8 GB server reports a little less than 8 itself). Ask helpdesk@hdservices.nl for a larger server.

Field What it is
API domain The public address of the API (https://api.yourcompany.com): what an app calls SUPABASE_URL. Only the API paths answer there: /auth/v1/, /rest/v1/, /realtime/v1/, /storage/v1/, /graphql/v1, /.well-known/oauth-authorization-server/auth/v1 (and /functions/v1/ with lovable-supabase); everything else is a 404, unless the API domain is also the website domain. Public on purpose: apps and browsers must reach it.
Studio (dashboard) domain A name of its own for Studio (studio.yourcompany.com). Only the networks on the stack’s access list open it, and Studio then still asks for a user name and password. Must differ from the API domain and the website domain.
Website domain (lovable-supabase) The app’s address. It is also the Site URL: invitation and password mails and redirects after sign-in lead to https:// + this domain (other allowed addresses: Additional redirect URLs). The API domain may be the same: the API paths then go to Supabase, everything else to the website.
Site URL (supabase) The address of the app that uses the backend, with https://. Invitation and password mails and redirects after sign-in lead here. Other allowed addresses go into Additional redirect URLs (comma-separated, ** as a wildcard).

HD Services creates the DNS records; the certificates follow automatically. Until you put addresses on the access list, only HD Services’ networks can open Studio.

At creation the server makes nine keys in one go that belong together: they are signed with each other. You find them on the Settings tab (under Advanced). Leave the fields empty at creation.

Value Where it goes
https:// + the API domain The app’s server URL (SUPABASE_URL, NEXT_PUBLIC_SUPABASE_URL, VITE_SUPABASE_URL).
Publishable key (SUPABASE_PUBLISHABLE_KEY, sb_publishable_...) The app’s key in the browser. Public by design. Older apps use the Anon key (ANON_KEY), which works too.
Secret key (SUPABASE_SECRET_KEY, sb_secret_...) Only for server code that needs full access. Older code uses the Service role key (SERVICE_ROLE_KEY).
The other five (JWT_SECRET, JWT_KEYS, JWT_JWKS and the two internal ES256 tokens) Used inside the stack; an app does not need them.

Tip: store the API address and the publishable key as global variables (for example SUPABASE_URL and SUPABASE_PUBLISHABLE_KEY) and the secret key as a hidden global variable: app stacks on the same server then pick them up. A second Supabase stack never takes them over; it always gets a set of its own.

The keys are frozen. Never change one on its own: changing the JWT secret signs everyone out and invalidates every other key, and a key changed alone no longer fits the rest. The form does not stop you, so do not do it. The generated tokens are valid for ten years.

Bringing existing keys (a move from another self-hosted Supabase): give all nine at creation; the server checks that they work together and refuses each value that does not at its own field (expired keys too). Or give only the JWT secret (at least 32 characters): the server makes the other eight from it, and tokens signed with that secret stay valid. Any other part of the set is refused. An assistant or script sees keySet in the answer: generated, derived or given.

  • Server: leave the SMTP fields empty; the stack then uses your server’s global variables SMTP_HOST, SMTP_PORT, SMTP_USERNAME and SMTP_PASSWORD: HD Services’ mail relay, which every server has. With no mail server set at all nothing is sent, while invitations still report success: sort this out before the first invitation.
  • Sender: Sender address of sign-in mails is hddeploy@mail3000.nl (the global SMTP_SENDER) or an address of your own domain. For your own domain HD Services first adds the relay to its SPF record: ask the helpdesk.
  • Your own texts: the mail templates are HTML files in the upload-only site that belongs to the stack (same name as the stack). Upload for example invite.html and recovery.html, put the file names in Invitation mail template and Password reset mail template (the templates for confirmation, magic link and e-mail change are under Advanced) and the subjects in the … subject fields, and deploy. A later change to a file is used within about a minute, without a deploy. When the file is missing, the mail still goes out, with Supabase’s built-in English text.
  • In a template you use Supabase’s variables: {{ .ConfirmationURL }}, {{ .TokenHash }}, {{ .SiteURL }}, {{ .Email }}. Must the link reach your server instead of the browser, use for example {{ .SiteURL }}/auth/callback?token_hash={{ .TokenHash }}&type=invite.
  • By default the stack sends 30 sign-in mails per hour in total. Beyond that it answers “email rate limit exceeded” and nothing goes out. Raise Sign-in mails per hour (Advanced) before a large round of invitations.

Who may create an account? In supabase, Invitation only (no public sign-up) is on by default: users are invited from Studio or by the app with the secret key. In lovable-supabase it is off by default, as on Lovable Cloud, because most Lovable apps have a sign-up page. While sign-up is open, anyone can create an account through the public API: every row-level security rule must then assume a stranger may be signed in. Set the choice before the first deploy.

Limits per visitor address (Supabase’s defaults, adjustable under Advanced):

What Limit
Password sign-ins and session refreshes 150 per 5 minutes (bursts of up to 30 in a row)
Redeeming mail links (invitation, password reset, confirmation) 30 per 5 minutes
Sign-ups, reset mail requests, magic links 30 per 5 minutes
Sign-in mails (the whole stack together) 30 per hour

Beyond that the API answers HTTP 429 (“Request rate limit reached”). So nobody can guess passwords without limit.

Open Studio at https:// + the Studio domain, with the user name supabase (fixed) and the Studio password from the Settings tab. You can change the password with Save and deploy. In Studio you create tables, row-level security rules, buckets and users (invitations).

  • Every table the app can reach needs row-level security: the API is on the internet. Studio’s Security Advisor lists the gaps.
  • Studio is protected by the access list and the password. Inside the server, other containers can reach Studio past the access list; the password is therefore the real lock. Keep it in the password manager.
  • GraphQL is off by default, as in Supabase itself; switch on the pg_graphql extension in Studio when you need it.
  • Studio’s AI assistant only works with an OpenAI key of your own (field under Advanced).

Sign-in with Google, Microsoft, GitHub or another provider: create an OAuth client at the provider with the callback https:// + API domain + /auth/v1/callback, add the lines GOTRUE_EXTERNAL_<PROVIDER>_ENABLED, _CLIENT_ID, _SECRET (the value as a hidden global variable) and _REDIRECT_URI to the auth service in the compose file (Advanced tab), and deploy.

The functions in the repository’s supabase/functions are built along at every deploy and answer at https:// + API domain + /functions/v1/<name>.

  • Edge functions require a key (on by default, as on supabase.com): a function only runs for a call that carries the publishable key or a user’s session. supabase.functions.invoke in the app always sends one.
  • Exceptions: functions that supabase/config.toml marks verify_jwt = false (a section [functions.NAME]) and functions you name under Public edge functions (Advanced, comma-separated) run for anyone. The deploy’s build output lists the config.toml ones, and the functions container names all of them in its log when it starts (“functions without a key check: …”). Use that for webhooks of other services, and let the function check its callers itself (a signature).
  • Switch Edge functions require a key off and all functions are open.
  • A function can call other applications on this server by their internal address, for example HD Chat Bridge at http://<stack>-whatsapp-1:8080 (stacks created after the template update of November 2026; an older stack gets it by adding hddeploy under the functions service’s networks in the compose file, ask HD Services). Database webhooks (pg_net) cannot: let them call an edge function instead.
  • Secrets a function or the website’s server code needs (Deno.env.get, process.env, for example RESEND_API_KEY): a line under the functions or app service in the compose file (Advanced tab), and the value as a line of your own in the .env file or as a hidden global variable.

At every deploy the migrate job applies the new files in supabase/migrations, in order, before the new website starts. It records them in the same table as the Supabase CLI (supabase_migrations.schema_migrations), so a file that was applied already is skipped and a later move back to supabase.com stays possible.

Two files with the same version number are refused before anything is applied. A file with a COMMIT of its own gets a warning: if it fails after that, the part before that COMMIT stays applied.

Create three backups on the Backups page (or let your assistant call add_backup three times):

Backup Settings
The database Stack, service db, kind PostgreSQL database (postgres), Databases All databases in this service
The files Kind Files in a Docker volume (volume), volume <stack>_storage
The database’s root key Kind Files in a Docker volume (volume), volume <stack>_db-config (a few kB)

The third is small but needed: it holds the key the database encrypts its Vault secrets with. Without it they cannot be read after a restore. Optional: <stack>_snippets, Studio’s saved SQL.

Restoring is done by HD Services; mail helpdesk@hdservices.nl. It needs the three files of the same night. Users keep their passwords. Not in a backup: settings made at database level (ALTER DATABASE ... SET), and the Studio snippets without the fourth backup.

A project from supabase.com or Lovable Cloud can move to such a stack: the database with every user and their password, the row-level security rules, the files and (with Lovable) the migration history. Who does which step, HD Services or you, as agreed, is settled per project. Restoring the database happens on the server itself. What is needed:

  • the connection to the old database (supabase.com: the Session pooler connection string from Connect, port 5432, plus the database password; for reading only), or for Lovable Cloud the export (Cloud > Database > Settings: a full export, one per 24 hours; deleted together with the Cloud backend, so download it first);
  • the service role key or secret key of the old project, to copy the files (without that key the files are downloaded per bucket and uploaded again);
  • a moment when nothing is written (no invitations, no uploads) and a sender address for the mails.

The order:

  1. The stack is created with the same settings as the old project (sign-up, Site URL, redirect URLs, session lifetime).
  2. supabase: the stack is deployed once. lovable-supabase: do not deploy yet - the first deploy would run every migration on an empty database and make the restore impossible; for the restore only the database, Auth and Storage are started.
  3. The old project is frozen; the database is dumped and restored in one go, and the old sessions are revoked. If the restore fails, nothing has changed.
  4. The files are copied. A second round copies only what is still missing or has changed.
  5. Check: counts of users, files and rows, a sign-in with one’s own password, a download.
  6. lovable-supabase: now Deploy; the migrate job skips everything the restored history already has.
  7. The app gets the new API address and the new keys. Values baked into the build (NEXT_PUBLIC_..., VITE_...) mean a new build.

After the switch everyone signs in once more, with their own password: the browser’s session belongs to the old address.

What does not move and is set up again: the Auth settings (sign-up, e-mail confirmation, Site URL, redirect URLs, session lifetime), sign-in with Google and other providers (Lovable Cloud’s managed Google sign-in too: the app must then use supabase.auth.signInWithOAuth with an OAuth client of your own), mail templates and SMTP, the keys (the app gets new ones), secrets in Vault (enter them again; the old platform’s key cannot be exported), edge function secrets, passwords of your own database login roles, Lovable’s AI gateway and connectors, and anything written to the old project after the dump.

Going back is possible: the old project is only read and stays unchanged until you have signed off the checks. Back = point the app at the old project again and rebuild; whatever was written to the new stack in the meantime does not flow back by itself. So pause the old project rather than delete it, for an agreed period.

The Require login card on the Access tab (single sign-on) puts every address of the stack behind the login page, the API too. Apps then get no answers from Supabase and stop working. Studio is already protected by the access list and the password.

Want a login in front of Studio (or the website) anyway? Then put these Public paths in the same card: /auth/v1, /rest/v1, /realtime/v1, /storage/v1, /graphql/v1, /.well-known/oauth-authorization-server, for lovable-supabase plus /functions/v1.

When you delete the stack, its containers and definition disappear, but the volumes (the database with every user, the files), the backup files and the site content stay on the server. If the stack holds personal data, ask HD Services to remove those remains.

All parts of Supabase belong to one tested version. HD Services tests a new version first and delivers it as a new version of the template; the nightly update is off for these stacks.