{
  "topic": "two-apps",
  "section": {
    "n": 3,
    "name": "Deploy"
  },
  "title": "Frontend and backend",
  "covers": "A separate frontend and backend (or API), deployed as two apps that talk over HTTP; a private (locked) app next to a public one, such as a staff admin page for a customer site or a webhook receiver",
  "summary": "A frontend and a backend are two apps with two addresses. Deploy the backend first, then point the frontend at its address.",
  "available": true,
  "who": {
    "connector": "deploy_app, once per app",
    "api": "POST https://ship.embarko.ai/apps, once per app",
    "dashboard": null,
    "needs_human": null
  },
  "steps": {
    "any": [
      "Package each part from its own folder (the one with its manifest), never the repo root. Give them related names, such as acme-api and acme-web.",
      "Deploy the backend first. Wait until it is live; its address is https://acme-api.embarko.app.",
      "In the frontend, set the backend address in the code or a committed config file (for example src/config.js). .env files are left out of the upload, so a VITE_ value in .env.production will not reach the build.",
      "In the backend, allow the frontend's address in CORS: https://acme-web.embarko.app (and a custom domain if you add one later).",
      "Deploy the frontend, then open it and use a feature that calls the backend.",
      "Secrets (API keys) go on the backend as env vars; over HTTP that needs the backend claimed first (see claim)."
    ],
    "private_and_public": [
      "Use this when one part is for the team and the other is for everyone: a staff admin page next to a customer site, or a webhook receiver (Stripe, a form service) next to a locked tool. A locked app blocks every call that is not a signed-in member, so the public part cannot live inside it.",
      "Keep the data in ONE app, the public one (it holds the customers' sign-ups and orders under DATA_DIR). The locked app owns no copy.",
      "Make a long random key and set it as an env var on both apps, for example INTERNAL_KEY (see env-vars). Never put it in code or embarko.json.",
      "In the public app, add the routes the locked app needs under one prefix (for example /internal/orders). Each refuses with 401 unless the request has the header X-Internal-Key equal to INTERNAL_KEY. Do not allow them in CORS.",
      "The locked app calls those routes from its server, never from the browser, with the header. It may call the public app; the public app can never call the locked one.",
      "Lock only the private app (\"lock\": true in its embarko.json). Read who signed in there (see lock); the public app keeps its own sign-up for customers."
    ]
  },
  "done_when": "A feature on the frontend that calls the backend works at the frontend's link. For a private and a public app: the private app shows the public app's data, and its internal routes answer 401 without the key.",
  "limits": [
    "Two apps count as two apps on the person's plan.",
    "The apps cannot share files: only HTTP between them.",
    "A locked app can call other apps; nothing can call a locked app except the browser of someone who signed in to it (a member, or anyone with its password)."
  ],
  "say_to_user": {
    "done": "Your app is live: https://acme-web.embarko.app."
  },
  "prerequisites": {
    "read_first": "https://embarko.ai/docs/prerequisites",
    "user": "The person is usually not a developer. They want to know if the app is live, not how.",
    "talk": "Reply in 1-3 short plain sentences: what happened, and what the person needs to do only if something is needed. Do not show commands, API names, tokens, headers or logs, or describe the steps you took, unless the person asks for technical details. If the person is clearly a developer (uses technical terms, asks what you ran), talk to them that way for the rest of the conversation. Never show a token. Never invent a link, name or code: use only what Embarko's replies, this guide or the person give you.",
    "route": "Connector first if it is in your tools, then the HTTP API, then the upload page as a last resort.",
    "domains": "ship.embarko.ai (API), embarko.ai (website), {app-name}.embarko.app (apps): all Embarko.",
    "requires": [
      {
        "topic": "deploy",
        "why": "How each app is started",
        "url": "https://embarko.ai/docs/deploy"
      }
    ]
  },
  "next": "Deploy the backend, then the frontend.",
  "related": [
    {
      "topic": "env-vars",
      "why": "API keys on the backend",
      "url": "https://embarko.ai/docs/env-vars"
    },
    {
      "topic": "custom-domain",
      "why": "Remember CORS if you add a domain",
      "url": "https://embarko.ai/docs/custom-domain"
    },
    {
      "topic": "lock",
      "why": "Making the private app private",
      "url": "https://embarko.ai/docs/lock"
    }
  ],
  "links": {},
  "url": "https://embarko.ai/docs/two-apps",
  "contents": "https://embarko.ai/docs",
  "version": "2026-11-24"
}