Skip to main content
A MakerKit project runs on Sevalla as one Next.js application: Ingot builds the web app from the pnpm monorepo, and the web process serves the site and its API on the port in the PORT environment variable. Its data lives in a Sevalla PostgreSQL database that the application reaches over an internal connection, and uploaded files go to an object storage bucket, so they survive every deployment. MakerKit is a Next.js SaaS starter kit: a TypeScript codebase you own, on the Next.js App Router with Better Auth, Drizzle ORM, PostgreSQL, Stripe and Tailwind CSS with shadcn/ui. It includes team accounts with role-based permissions, subscription billing, transactional email, file storage, a super admin panel and rules files for AI coding assistants.
MakerKit also offers kits built on TanStack Start. They deploy the same way, with different build settings and environment variables. See Deploy a TanStack Start application for the framework’s side.

At a glance

Environment variables

Keep each variable at its default availability, Available during runtime and Available during buildtime. Next.js compiles NEXT_PUBLIC_* variables into the browser code during the build, so a variable that only exists at runtime reaches the browser as undefined. With MAILER_PROVIDER=nodemailer, replace RESEND_API_KEY with EMAIL_HOST, EMAIL_PORT, EMAIL_USER, EMAIL_PASSWORD and EMAIL_TLS. A feature you turned on locally, such as social login, captcha, feature flags or error monitoring, comes with variables of its own, which the Dev Tools list in Prepare the project for Sevalla includes. The internal connection also adds DB_HOST, DB_PORT, DB_DATABASE, DB_USERNAME and DB_PASSWORD, which MakerKit doesn’t read.

Before you begin

  • A Sevalla company with a payment method, and a GitHub, GitLab or Bitbucket account for the repository. See Git providers.
  • A MakerKit license, and your MakerKit codebase in a private repository on that Git provider.
  • Node.js and pnpm on your computer, at the versions your MakerKit project requires. You use them to apply the database migrations.
  • A Stripe account with API keys, and either a Resend API key or SMTP credentials for outgoing email.
The database and the bucket are created in Sevalla during this guide, so nothing needs to exist elsewhere first.

Prepare the project for Sevalla

MakerKit is a pnpm monorepo: the deployable Next.js app is apps/web, next to shared packages. Ingot installs the whole workspace from the lock file at the repository root, so commit pnpm-lock.yaml, and builds the app that INGOT_APP names. The repository needs no other change. Leave the application’s Build path at .. With INGOT_APP, the build path is the root of the workspace, and INGOT_APP is the app’s folder relative to it. See Build an application in a monorepo. Production variables are easy to forget. Instead of writing a .env file by hand, let MakerKit’s Dev Tools list exactly what your configuration requires:
Open http://localhost:3010/variables, select Production mode, fill in the variables it highlights as missing, and click Copy. You paste the list into Sevalla in Deploy to Sevalla. It holds live credentials, so if you save it to a file, keep that file out of Git.

Deploy to Sevalla

1

Create the database

In the sidebar, click Databases, then click Create database. Under Database, choose PostgreSQL and version 18, the version this guide was tested with. Enter makerkit-db as the Display name, choose a Data center and a Size, then click Create database. Remember the data center: the application must be in the same one to reach the database over the private network. See Create a database for every field.
2

Create the bucket

MakerKit’s local-filesystem storage driver is for development only, and an application’s local files are replaced on every deployment and restart, so uploads need a bucket.In the sidebar, click Object storage, then click Create object storage. Enter makerkit-media as the Name, choose the Location closest to the database, and click Create object storage. Click the bucket’s Settings tab, then click Enable public access under Public access and click Enable public access in the dialog. See Create a bucket and Public access.Public access makes every object in the bucket readable by anyone who has its URL. MakerKit uses this bucket for profile pictures and organization logos, so keep sensitive documents out of it. If your product handles private files, store them in a separate bucket with public access left off.Leave the Settings tab open: the environment variables need its Bucket name, Endpoint, Access key, Secret key and Public domain.
3

Create the application

In the sidebar, click Applications, then click Create > Application. Under Source, click Private repository, then choose the Git provider, the Repository and the Branch you release from. Enter makerkit-app as the Name. Under Location, choose the same Data center as the database. Keep the Size at H1 or choose a larger one, then click Create application. To launch on your own domain, choose a size larger than H1: custom domains aren’t available on the Hobby size. The application opens on its Overview tab with the status Not deployed yet.Creating an application doesn’t deploy it, so you can add its variables before the first build. Add them first: a build without them ships a bundle that’s missing every NEXT_PUBLIC_* value.
4

Connect the database

Click the Networking tab. Under Connected services, click Add internal connection. Choose makerkit-db as the Service and turn on Add environment variables to the application. In the list of variables, change the key DB_URL to DATABASE_URL, then click Add internal connection. See Connect an application.MakerKit’s build doesn’t connect to the database, so DATABASE_URL only needs the internal connection at runtime.
5

Add the environment variables

Click the Environment variables tab, then click Add environment variables. Paste the list you copied from the Dev Tools into a key field, or click Import .env and pick the file you saved it to. Then check each variable against the table in Environment variables:
  • Add INGOT_APP with the value apps/web. Ingot reads only variables that are Available during buildtime.
  • Keep the DATABASE_URL that the internal connection added: delete any pasted DATABASE_URL that holds a local or external address.
  • Set NEXT_PUBLIC_SITE_URL to the address the application will have in the browser, scheme included and without a trailing /. Better Auth treats it as the canonical address, and MakerKit builds every email link, OAuth redirect and Stripe return URL from it. Until you add a custom domain, use the application’s Sevalla domain, shown under its name, such as https://makerkit-app-x7k2m.sevalla.app.
  • Fill in the bucket values from the bucket’s Settings tab: STORAGE_S3_BUCKET takes the Bucket name, not the display name, and STORAGE_S3_REGION is auto, because Sevalla buckets run on Cloudflare R2. STORAGE_S3_ENDPOINT takes the Endpoint as shown, without the bucket name: MakerKit always sends path-style requests, so R2 needs no other setting.
  • Generate BETTER_AUTH_SECRET for this deployment with openssl rand -base64 32, and don’t copy the one from your computer.
Click Add environment variables. See Environment variables.
Don’t add NODE_ENV=test, TEST or NEXT_PUBLIC_CI=true. In production, Better Auth rejects requests from foreign origins, refuses unknown callback URLs and rate limits the auth endpoints, which blocks CSRF and open-redirect attacks. These protections relax in test environments by design.
6

Apply the database migrations

The new database is empty. You apply MakerKit’s migrations from your computer, through the database’s external connection.In the sidebar, click Databases, click makerkit-db, then click the Networking tab. Under Public networking, in External connection, click Enable, then click Enable in the dialog. Copy the External connection URL when it appears. See Enable the external connection.In your local MakerKit checkout, start the migration:
The terminal waits. Paste the external connection URL and press Enter. Because of read -s, the connection string isn’t echoed to the screen or saved in your shell history. When the migration finishes without errors, you can click Disable in External connection to close the public connection again.
7

Deploy

Check these before the first deployment:
  • DATABASE_URL holds the internal connection’s URL, not the external one.
  • NEXT_PUBLIC_SITE_URL starts with https:// and doesn’t end with /.
  • BETTER_AUTH_SECRET was generated for this deployment.
  • Every STORAGE_* variable is filled in.
  • The Stripe keys start with sk_live_, unless this is a staging deployment.
  • None of the test variables named in the environment variables step are present.
  • The migration command finished without errors.
Click the Overview tab, then click Deploy now under Recent deployments. Check the Branch and click Deploy.
8

Turn on auto-deploy

To deploy every push to the branch automatically, click the Settings tab, then click Update auto-deploy in the Auto-deploy section. Turn on Auto-deploy and click Update auto-deploy. See Deployments.
The Add environment variables sheet with key and value rows, Add another, Import .env and the availability optionsThe Add environment variables sheet with key and value rows, Add another, Import .env and the availability options

Verify the deployment

  1. On the Deployments tab, click the deployment. Its Build log shows Ingot’s build plan with the package manager (pnpm) and framework (Next.js) it detected. Wait for the deployment’s status to change to Deployed. The application’s status next to its name changes to Running.
  2. Check the application’s health endpoint:
    A healthy application answers:
    The route needs no authentication and checks only the web server: it answers 200 with OK even when the database can’t be reached. Step 3 checks the database, because signing in reads it.
  3. Open the application’s domain, for example https://makerkit-app-x7k2m.sevalla.app, sign in or create an account, and upload a profile picture. The file appears on the bucket’s Objects tab.
  4. Deploy again with Deploy now. When the deployment is Deployed, the picture still loads: the file is in the bucket, not on the instance’s disk, which each deployment replaces.
The application header with its name, Running status, repository, branch and the domain that opens the applicationThe application header with its name, Running status, repository, branch and the domain that opens the application
A failed deployment almost always points to a variable that’s missing or mistyped. Search the deployment’s build log for the variable name, correct it on the Environment variables tab and deploy again. See Troubleshoot and Troubleshoot builds and deployments.

Add a custom domain

The application already works on its Sevalla domain. To serve it from your own domain, such as app.example.com, the web process needs a size larger than H1, so scale it first.
1

Add the domain

On the application’s Domains tab, click Add custom domain, enter the domain in Domain name and click Add custom domain.
2

Verify and point the domain

At your DNS provider, add the two TXT records that the Verify domain step shows, then add the A record that the Point domain step shows. If your domain’s DNS is on Cloudflare, the records differ: see Domains on Cloudflare DNS. Wait for the domain’s status to change to Active. Sevalla issues and renews the SSL certificate.
3

Update the site URL

On the Environment variables tab, change NEXT_PUBLIC_SITE_URL to the new domain, then deploy again. The old address is compiled into the current build, so only a new build replaces it.
See Custom domains.

Connect Stripe webhooks

In the Stripe dashboard, create a webhook endpoint for this address, with your own domain:
Stripe shows a signing secret for the endpoint. Set it as STRIPE_WEBHOOK_SECRET on the Environment variables tab, then deploy again. MakerKit’s Stripe setup lists the events to subscribe to and the remaining billing settings, which you finish before you take live payments.

Deploy changes

With Auto-deploy on, every push to the branch starts a deployment; otherwise, click Deploy now for each change. Each deployment builds the image, then replaces the web process’s instances. See Deployments.
  • After you change an environment variable, click Deploy now to redeploy the current commit. A NEXT_PUBLIC_* variable is built into the browser code, so it must be Available during buildtime, and a change needs a new build.
  • When a release adds a migration, apply it as in Deploy to Sevalla before the deployment that needs it. To keep the database one step ahead of the code, run the migration as a CI job before the deployment.
  • To undo a release, roll back to the previous successful deployment. If the bad release changed the schema, check that the older code can still read it first.

Troubleshoot