Full-Stack Apps

Full-stack apps

A full-stack app is one app that carries both a static front end — served from the Ngris edge like a Static App — and a backend server that Ngris runs for you in-cluster. There is nothing to wire up between them: Ngris routes each incoming request by its path. Requests under your configured backend paths reverse-proxy to your backend container; every other request serves a file from your built front end.

Create the app with type fullstack — that is the difference from a managed (backend-only) app and a static (front-end-only) app. Both the front end and the backend build from a single source (an upload or a connected git repo), exactly like the other app types.

When to reach for full-stack. Use it when a single-page app (React, Vue, Svelte, Next.js…) needs its own API under one origin — the SPA is served statically at the edge, and calls to /api hit your server. No CORS, no second domain, no separate deploy. If you only ship a website, use a Static App; if you only ship a server (no static bundle), use a backend app.

Full-stack apps require the application_hosting entitlement (the same one static hosting uses) plus managed-backend availability on your plan — the backend runs a real, long-running process on the edge, so it needs a plan that offers managed backends. For a per-request, scale-to-zero handler instead, use a Serverless Function.

Path routing — backend paths

The whole design of a full-stack app is one rule: Ngris routes by request path. Set Backend paths (backend_paths) to the URL prefixes your server owns — for example /api, /auth, /graphql. The default is ["/api"].

  • A request whose path matches a backend prefix — the exact prefix or a /prefix/… segment under it — reverse-proxies to your backend container. So /api and /api/users both hit the backend when /api is a backend path, but /apidocs does not (it is not a segment boundary).
  • Every other request serves a static file from your built front end — identical to a Static App: publish_dir, index_document, SPA fallback and a custom 404 all apply.
  • Paths are normalized before the decision, so a crafted /api/%2e%2e/admin collapses to /admin and is treated as a front-end path — it can never sneak past a path rule into the backend.

You can list up to 20 backend prefixes. A special case: a prefix of / routes everything to the backend — that turns the app into a backend-only app (see backend apps) even though it is typed fullstack.

SPA pitfall — make non-API routes fall back to index.html. If your front end is a single-page app with client-side routing (/dashboard, /settings/billing…), those deep links are front-end paths — there is no file at /dashboard on disk. Turn on SPA fallback (spa_fallback) so any unmatched non-backend path serves your index.html and the client router takes over. Without it those routes 404.

A related trap: if your app ships no static bundle at all (a pure API), then / has no file to serve and returns a 404 — unless a backend path covers it. Either add a front end, or make it a backend-only app (backend paths = /) so the server answers / too.

How it builds & runs

A full-stack app builds through the same pipeline as a backend app, and additionally publishes the static assets to the edge. From your one source, Ngris:

  • Builds the backend from your Dockerfile (or an auto-detected Go / Node / Python stack; a Node backend installs, builds and runs on Node.js 24) in a sandboxed job, then signs the image, scans it for vulnerabilities, and pins it to its digest. The running backend is isolated in its own sandbox and reached only through Ngris's routed path.
  • Publishes the static front end — only its front-end folder, see Project layout — to the edge store, exactly like a Static App — so front-end requests are served from the edge, never through the backend.

The build-context rules are the backend app's rules — rather than repeat them, see Backend apps for the details on the zip root, keeping the context self-contained, vendoring local modules, the 100 MB context cap, build-time vs runtime environment variables, the listen port, and the read-only root filesystem with a writable /tmp.

The backend follows the same outbound network rules: no internet access by default, and outbound HTTP/HTTPS on a paid plan once you set NGRIS_EGRESS_HTTPS=on.

Backend runtime settings — port, health-check path, CPU/memory, replicas, and the backend_paths above — live in the app's Serving settings (Settings page) (or PUT /v1/applications/{uuid}/runtime).

Build settings

The app's Build settings (Settings page, or PUT /v1/applications/{uuid}) are split between the two halves. A box left empty is detected as before.

  • Front end: the install command, the build command and the output directory, as for a Static App. Front-end builds run on Node.js 24 and get the app's non-secret variables only, so an install from a private registry that needs a token fails.
  • Backend: the start command only. It runs with a shell, see Backend Apps. The backend's install and build stay detected, or come from its Dockerfile.

Everything in the output directory is published. Point it at your front end's build output only: an output directory pointing at your backend's folder publishes those source files, just as a Publish directory pointing there would. Ngris refuses only the project root itself.

Saving doesn't rebuild: the next push, upload or Redeploy uses the new settings, and every deploy builds a fresh backend image.

Project layout

Upload (or push) the whole project: your backend at the root, your front end in its own folder. Ngris publishes only that folder to the edge, and finds it like this:

  • With a front-end build, Ngris runs it and publishes its output folder: dist/ (Vite, Astro, Angular, Nuxt, or any other build script in package.json), build/ (Create React App, SvelteKit), out/ (Next.js static export) or public/ (Gatsby, Hugo), unless you set your own output directory in Build settings.
  • Without a build, put your ready-made front end in public/, or in any folder you set as the Publish directory (publish_dir, in Serving settings) — that one is checked first.

With a Root directory set (monorepos), these folders are looked up inside it.

Only that folder is public. Everything outside it — your server code, package.json, lockfiles, a .env — is never served from your app's URL; it's only used to build the app (still, set secrets as environment variables rather than shipping a .env). Inside the published folder, Ngris also leaves out every dotfile and dot-folder (.env, .git/, .npmrc…) and any *.pem, *.key or .env* file; only a .well-known/ folder at its top is kept (ACME challenges, security.txt).

Your build script runs for the front end. If package.json has one, Ngris runs it and publishes its output folder — dist/ unless a framework above says otherwise. Keep that folder for the front end only: a backend compiled into dist/ would be published with it.

No front-end folder, no deploy. A full-stack app never publishes its project root, so an index.html next to server.js doesn't count. If none of the folders above exists — or it holds only files that are never published — the deploy fails and nothing is published. Its error field reads fullstack frontend build: Full-stack apps need a front-end build output (dist/, build/ or out/) or a public/ folder. Nothing was published., and the front-end part of the build log shows the same line. Move the front end into public/ (or add a build) and deploy again.
A full-stack project
my-web/
├── server.js          # private
├── package.json       # private
├── package-lock.json  # private
└── public/            # published
    ├── index.html
    └── app.js
What each request gets
/             → public/index.html
/app.js       → public/app.js
/api/orders   → your backend
/server.js    → not published
/package.json → not published
Build log — no front-end folder
===== Frontend build =====
2026/10/22 09:14:03.512204 [builder] fetching source (kind=zip presigned=true)
2026/10/22 09:14:03.871930 [builder] plan: framework="" serve_as_is=true install="" build="" output="."
2026/10/22 09:14:03.872411 [builder] FAILED: Full-stack apps need a front-end build output (dist/, build/ or out/) or a public/ folder. Nothing was published.

Preview URLs

Every built deploy can get its own preview URL of the form <deploy-uuid>.<your-plan-domain>, so you can check a build's front end before it goes live, or share a work-in-progress. For a full-stack app, the preview serves that deploy's static front end, and its backend paths reach the backend that is live now.

Previews are opt-in, and they follow your main endpoint's protections. Ngris never turns on a deploy's preview URL until you ask for it. A preview URL runs the protections of the app's main (primary) endpoint — sign-in, firewall, rate limits, WAF and edge functions — and isn't cached at the edge. See Protections on preview URLs for the details (client certificates, OAuth sign-in, apps with no endpoint).

Preview URL returns 404? Enable the preview.

If a preview URL returns 404, the almost-certain cause is that the preview is not enabled for that deploy (preview_enabled is off — the default). Turn it on with Request preview URL in the deploy's menu on the Deploys page, or via the API:

curl -X POST "https://api.ngris.com/v1/applications/{uuid}/deploys/{deploy_uuid}/preview" \
  -H "X-API-KEY: <your_api_key>"

The response returns preview_enabled: true and the live preview_url; disable it again with the same route as DELETE. Two more things to check when a preview 404s:

  • The host must use the deploy UUID, not the app UUID — each deploy has its own preview host.
  • The deploy must be ready (or superseded — a former-live version). A still-building or failed deploy has no preview.

Connect a database

Because a full-stack app has a backend, it can use a managed MariaDB database. Create one under Storage → Databases, then connect it from the app's Environment page (Connected databases → Connect database): ngris gives your backend the connection as environment variables (DATABASE_URL and the DB_* parts) and restarts it if it's running. Only the backend can reach the database; the static front end runs in the visitor's browser and can't. See Databases for users, prefixes and limits.

Deploy a full-stack app

The end-to-end path, in the dashboard:

  1. Create the app. Applications → New, choose type Full-stack.
  2. Configure backend paths. In the app's Serving settings (Settings page), set Backend paths to the prefixes your server owns (default /api). Set the listen Port and a health-check path while you are here. If your front end is a SPA, turn on SPA fallback there too.
  3. Set environment variables. Add config, tokens, and connection strings on the Environment page; mark secrets as Secret (write-only, encrypted). Build-time front-end vars (e.g. VITE_API_URL) and runtime backend vars both live here.
  4. (Optional) Connect a database. Create one under Storage → Databases, then on the app's Environment page click Connect database; ngris gives the backend DATABASE_URL and the DB_* variables. See Connect an app.
  5. Upload or connect source. Upload a .zip or connect a GitHub/GitLab repo, with the front end in its own folder (see Project layout). Ngris builds the backend image and publishes the static front end.
  6. Watch the build. Open the deploy's Build log — it tails live — and wait for the deploy to reach ready.
  7. Enable a preview and test. Choose Request preview URL on that deploy and open its <deploy-uuid>.<plan-domain> URL — you are testing the exact build, backend and front end together, before it goes live.
  8. Add an endpoint and go live. Ngris doesn’t create an endpoint for a full-stack app: add one on the app’s Domains page (Add endpoint), activate the deploy to make it live, and add a custom domain whenever you are ready.

By API, the shape is the same: create the app (type: "fullstack"), set the runtime with your backend_paths via PUT /v1/applications/{uuid}/runtime, add env vars, push a deploy, poll it to ready, then POST /v1/applications/{uuid}/deploys/{deploy_uuid}/preview to test the exact deploy before activating it, and give the app a URL with POST /v1/endpoints ("serving_mode":"agentless" and its application_uuid).

Stuck? Build failing, a 502/503 from the backend, or a route serving the wrong thing? Walk the deploy troubleshooting guide — it covers build-log errors, readiness/health-check failures, and path-routing surprises step by step.
Was this helpful?