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
When Dev signup is open, sign in and open Apps to start a card-backed trial. The dashboard shows the monthly price and first charge date before checkout. If trial seats are full, join the waitlist. Pro and custom domains require an invitation through the app hosting request form.
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, or click Connect GitHub on the New app form: GitHub opens in a small window and the form keeps what you typed. Then, on the Apps page, create a new app:
- App name: the form shows the rules as you type and the address the app will be served at. Each app is its own project, named after the app.
- 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: plans and billing
Running an app is what costs money. Each app is billed as one project. Open the app and choose Run, then pick its plan:
| Plan | Price per project | Between requests |
|---|---|---|
| Dev | $7 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. |
| Pro | $20 a month | The app never sleeps, so no request waits for a wake. |
- Free trial. Either plan: your team's first plan can start with a 3-day free trial: checkout takes a card but charges nothing. Cancel in Billing before the trial ends and you are never charged; otherwise the card is charged when it ends. One trial per account, for one project. A trial app runs as Dev (it sleeps when idle) whichever plan you picked; a Pro app switches to always on once the trial is paid. Opening trial checkout reserves a place until you finish it or it expires. When all places are reserved, choose Pay now or Join waitlist.
- Pay now skips the trial. Your team's first project on a plan goes through checkout, where you can enter a discount code; back on the app, it starts on the plan you paid for. Each further project is added to the same subscription, the rest of the current month is charged at once, and the app starts.
- Start appears instead when your team already pays for an unused project on that plan, and uses it without a new charge.
- Projects are billed to the team. The team owner pays, and every member's apps in that team can use the paid projects. The Billing tab of App Hosting shows each plan's paid projects, the monthly total and any unused ones. Only the team owner can subscribe, remove an unused project or cancel.
- Stop takes the app offline, but its project stays paid and unused until you remove it in Billing or another app starts on it. Nothing is refunded. Removing a project or canceling a plan is refused while its apps run: 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 plan. If the subscription ends, its apps stop. Their code, builds, settings, env vars and domains are kept, and they run again once the plan 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 | Dev | Pro |
|---|---|---|
| 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 |
| Public bandwidth per day | 10 GB | 100 GB |
| Public bandwidth per week | 40 GB | 400 GB |
| Public bandwidth per month | 100 GB | 1 TB |
| 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.
Public bandwidth is what your app sends to its visitors. An app over any of its allowances is slowed to 10 Mbps after 24 hours, or at once if it goes past 5 times the allowance, until that day, week or month ends. It keeps running, and going over never costs extra.
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.
Apps on layerbase.tech addresses share a parent domain, and browsers treat them as one site until the domain is recognized as a public suffix. Set cookies host-only (no Domain attribute), ideally with the __Host- prefix, and protect forms with a CSRF token or an Origin check rather than relying on SameSite alone. A custom domain keeps your app fully separate.
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 Dev and once a minute on Pro.
- 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 Dev.
- Stop takes the app offline at once. Its project stays paid until you remove it in Billing. 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. For an app running on a paid plan, the team owner also picks what happens to its paid project: give it back (the default: one project fewer, prorated, or the plan canceled at the end of the period when it was the last one) or keep it for another app. Nothing is 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.