Guide - beta
App hosting (beta)
App hosting runs a Next.js app from your GitHub repository on Layerbase, each app in a microVM of its own. This page covers creating an app, paying to run it, deploys and rollbacks, env vars, custom domains, crons and the limits that apply during the beta.
Invite-only beta: things will change
App hosting is open to a small group of invited accounts. Prices, limits, screens and the way app addresses are named can change before general release, and this page will change with them. If something here does not match what you see in the dashboard, the dashboard is right; tell us at support.
What app hosting is
Each app runs as one long-lived Next.js server (next build, then next start) inside its own microVM, on servers that run nothing but customer apps. Route handlers, server actions, ISR and Proxy all run in that one process. Nothing is split into functions, and requests are not metered: you pay a flat monthly price for each app that runs.
Some things it does not do yet, or does not aim to do:
- Next.js is the only framework.
- Apps run in one region, as one server each. There is no edge network and no autoscaling.
- WebSockets are not supported yet.
- Branch preview deployments, each with an address of its own, are planned, not available yet.
Getting access
During the beta, accounts are let in by invitation. To ask for a place, fill in the request form on the app hosting page and confirm your email from the link we send. We let requests in a few at a time and email you when your account is enabled. Until then, the Apps link in the dashboard sidebar leads to that same page.
Once your account is enabled, Apps in the dashboard opens your apps, marked beta.
Create an app
Apps build from GitHub, so first connect GitHub to your team under Integrations. Then, on the Apps page, create a new app:
- Project: every app belongs to a project in your team. Pick one, or choose New project and type a name.
- App name: the form shows the rules as you type and the address the app will be served at.
- Source: choose GitHub repository, then the Repository and Branch. The list shows repositories your team's GitHub connection can read.
- Root directory: the folder that holds the Next.js app's
package.json, such asapps/webin a monorepo. Leave it empty for the repository root.
Creating an app is free, and so are its settings, env vars and domains. Nothing builds until you run it (next section).
What builds. The build installs dependencies with the package manager your lockfile names, then runs next build. Commit your lockfile: the build looks for pnpm-lock.yaml, yarn.lock or package-lock.json between the root directory and the repository root, and installs from it as written (pnpm, npm or Yarn classic). Bun and Yarn Berry projects are not supported yet.
Run an app: tiers and run capacity
Running an app is what costs money. Open the app and choose Run, then pick its tier. Running takes one slot of that tier from your team's run capacity:
| Tier | Price per run slot | Between requests |
|---|---|---|
| Sleeps when idle | $9.99 a month | The app sleeps after a quiet spell. The next request wakes it, so that first request waits for the wake; the ones after it do not. |
| Always on | $29.99 a month | The app never sleeps, so no request waits for a wake. |
- Your first slot of a tier goes through checkout, where you can enter a discount code. Each further slot is added to the same subscription, and the rest of the current month is charged at once.
- Run capacity belongs to the team. The team owner pays for it, and every member's apps in that team run on it. The Run capacity card on the Apps page shows each tier's paid slots and how many are in use. Only the team owner can add a slot, remove one or cancel.
- No free slot? Run is grayed out and Add run capacity appears beside it.
- Stop gives the slot back at once, so another app can use it. Nothing is refunded. Removing a slot or canceling is refused while apps still hold those slots: stop them first.
- If a renewal payment fails, running apps keep running while the payment is retried, but no new app can start on that tier. If the subscription ends, its apps stop. Their code, builds, settings, env vars and domains are kept, and they run again once capacity of that tier is paid.
There is no free tier for apps. Your database plan is separate and unaffected; see Billing.
Builds, deployments and rollbacks
The first Run builds and deploys the branch. After that:
- Deploy on push (Settings, General) builds and deploys every push to the branch. Pushes that arrive during a build collapse to the newest one.
- Build and deploy on the Deployments tab builds the current head of the branch.
- Redeploy runs the live build again with the current env vars, without rebuilding.
- Roll back or Promote on an earlier deployment puts that build live again without rebuilding. The box keeps the live build and the newest 5 builds of each app; an older one is marked as pruned and has to be built again.
Every build runs in a throwaway VM, and the Deployments tab shows its log. A new version boots beside the old one and takes traffic only after its health check path answers exactly 200. The path is / unless you set another under Settings, Deploys. If your root redirects (to a login page, say), point it at a route that answers 200.
Beta limits
These are deliberately low starting values for the beta. We expect to raise them, or drop some, once we see real use.
| Limit | Sleeps when idle | Always on |
|---|---|---|
| Builds per app in any 24 hours | 20 | 60 |
| Build time before the build is stopped | 15 minutes | 30 minutes |
| Build time for a preview build | 15 minutes | 15 minutes |
| New outbound connections per minute | 60 | 600 |
| Shortest cron schedule | once an hour | once a minute |
A build refused by the daily limit tells you when the app can build again. Builds are part of the price and are never charged separately.
Addresses and custom domains
Every app gets its own HTTPS address under layerbase.tech. The address is shown on the app's page and on its Domains tab, with a DNS status and Re-check DNS. Apps created before branch addresses may also answer at an older app.layerbase.tech address, which the Domains tab lists too.
To serve the app on your own domain:
- On the Domains tab, choose Add Domain and enter the hostname, such as
app.example.com. - At your DNS provider, create the records shown on the domain card (each has a copy button):
- A subdomain (
app.example.com,www.example.com): a CNAME to the app's layerbase.tech address. - A root domain (
example.com): most providers refuse a CNAME there, so the card shows A records instead. If your provider offers ALIAS, ANAME or CNAME flattening, you can point the root at the app's address that way instead of using the A records. - Ownership: a TXT record at
_layerbase-verify.<your domain>with the value shown. Keep it in place after the domain goes live.
- A subdomain (
- The record name is only the part left of your zone (
www, not the full hostname). On Cloudflare, set the record to DNS only (gray cloud). Remove any AAAA record for the hostname: apps answer over IPv4 only. - Choose Re-check DNS. Once the records are visible, the certificate is issued and later renewed automatically, and the card reads Valid Configuration. Until then it shows Awaiting DNS, DNS found, Pointing elsewhere or Issuing certificate, with what is missing. DNS changes can take up to the old record's TTL to spread.
Environment variables and secrets
Open Settings, Environment Variables, then Add Environment Variable. Add one variable, paste a whole .env file (Paste .env, or paste several lines into an empty name field), or link a database. A pasted file shows which lines are new, which overwrite an existing value and which are skipped before anything is saved.
Each value is one of two kinds:
- Encrypted (the default): encrypted at rest and masked everywhere. The app's owner can reveal one value at a time, and every reveal is logged.
- Sensitive: sealed to a key that only the server running your app holds. Nobody can read it back, you included; you can only replace it. Marking a value sensitive cannot be undone.
NEXT_PUBLIC_values cannot be sensitive, because Next.js writes them into the public bundle.
Each value applies to one or more environments:
| Environment | Used by |
|---|---|
| Production | Deployments of the production branch |
| Preview | Deployments of any other branch |
| Development | Stored for local development. Pulling values locally is not available yet. |
A key can hold a different value in each environment, for example an API URL that points at your live service in Production and a test service in Preview. To copy values across, use Copy to environment in a row's menu (or on several selected rows); the preview lists what will be created and what overwritten. The Matrix view shows every key across the three environments and marks keys whose values differ or that are missing somewhere.
Linked databases. From database links a variable (named for the engine, such as DATABASE_URL or REDIS_URL) to one of your team's Layerbase databases, pooled or direct. The app gets the current connection string on every deploy, so you never copy credentials by hand. If the database is gone, the variable shows a broken link and the deploy fails rather than starting the app with an empty value; use Change database or remove the variable.
When changes apply. Saved changes reach the app on its next deploy, and the page offers Redeploy when it is due. Redeploy is enough for values the server reads at runtime. Values used during the build, including every NEXT_PUBLIC_ variable, need Build and deploy.
Logs
The Logs tab follows your app's server output as it is written. Secret values are replaced with [redacted]. A redeploy starts a new log. Build output is on the Deployments tab, under each build.
Cron jobs
Crons come from the crons list in your vercel.json, read at build time, so an app that already uses them needs no changes. Each cron calls its path on a schedule (always UTC). The Cron Jobs tab lists each schedule in plain words, its next run and its recent runs with the HTTP status and duration, and can pause and resume all of them.
- Generate a
CRON_SECRETon the Cron Jobs tab. Every cron call carries it asAuthorization: Bearer; check it in your route handler to refuse calls from anyone else. A new value reaches the app on its next deploy. - The shortest schedule is once an hour on Sleeps when idle and once a minute on Always on.
- A cron run wakes a sleeping app, which goes back to sleep when it is idle again. A stopped app runs no crons.
Wake, Sleep, Stop and Destroy
- Wake and Sleep (Overview tab) wake a sleeping app or put it to sleep now. Sleep is available only on Sleeps when idle.
- Stop takes the app offline and frees its run slot at once. Its code, builds, settings, env vars and domains are kept, and Run starts it again.
- Destroy (Settings, Danger zone) stops the app and deletes its VM, disks, sleep snapshot, builds and logs. You type the app's name to confirm. This cannot be undone. Destroying an app frees its run slot; the slot is not refunded.
Acceptable use
Apps are covered by our Acceptable Use Policy. A few rules are enforced by the platform itself:
- Outbound mail ports 25, 465 and 587 are blocked, so an app cannot send email over SMTP directly. Use an email provider's HTTPS API instead.
- Apps cannot reach other apps, the host, private networks or outbound IPv6.
- If an account is frozen, its apps are taken offline and stop building and deploying until it is unfrozen.
- We can take a single app down for an acceptable-use review. It then answers with a suspended page and does not build, deploy or wake, and a payment does not lift it. To appeal, email support@layerbase.com from your account's address.
To report phishing, malware, spam or other abuse on an app hosted here, email abuse@layerbase.com with the URL and what you saw.