{"service":"fullstacked-cloud-docs","version":"1.25.8","environment":"test","generatedAt":"2026-12-03T03:11:47.834Z","formats":{"html":"https://d.fullstacked.cloud/","markdown":"https://d.fullstacked.cloud/?format=md","json":"https://d.fullstacked.cloud/?format=json"},"services":{"console":"https://c.fullstacked.cloud","auth":"https://a.fullstacked.cloud","git":"https://g.fullstacked.cloud","tunnels":"https://t.fullstacked.cloud","tunnelsHost":"t.fullstacked.cloud","mcp":"https://m.fullstacked.cloud","install":"https://i.fullstacked.cloud","docs":"https://d.fullstacked.cloud"},"runtime":{"version":"1.0.0-1861","guide":"https://d.fullstacked.cloud/runtime?format=md"},"dataEngineLimits":{"postgres":{"image":"postgres:18.6-alpine","port":5432,"memoryMB":256,"cpus":2,"pids":256},"redis":{"image":"redis:8.10.2-alpine","port":6379,"memoryMB":256,"cpus":1,"pids":128},"mongodb":{"image":"mongo:8.3.11-noble","port":27017,"memoryMB":512,"cpus":2,"pids":512},"s3":{"image":"rustfs/rustfs:1.0.0","port":9000,"memoryMB":768,"cpus":2,"pids":1024},"p2p":{"image":"fullstackedorg/p2p:0.5.1","port":4444,"memoryMB":256,"cpus":1,"pids":128}},"projectRuntimeEnv":[{"name":"TUNNELS_HOST","injectedBy":"GET /api/v1/projects/:id/env","description":"Tunnels hub host for tunnel.register from fullstacked/tunnel."},{"name":"AUTH_HOST","injectedBy":"GET /api/v1/projects/:id/env","description":"Bare host of the Authentication service."},{"name":"AUTH_URL","injectedBy":"GET /api/v1/projects/:id/env","description":"Base URL of the Authentication service (GET ${AUTH_URL}/api/v1/me)."},{"name":"AUTH_TOKEN","injectedBy":"Client GUI / action runner at launch (in memory, never stored)","description":"The signed-in user's fsc_* bearer token for this run (from the Client GUI, a project-scoped fsc_prj_ token: the user's identity and the project's linked resources only): Authorization: Bearer ${AUTH_TOKEN}."}],"topics":[{"slug":"project-runtime","title":"Injected process.env","url":"https://d.fullstacked.cloud/project-runtime","markdownUrl":"https://d.fullstacked.cloud/project-runtime?format=md","jsonUrl":"https://d.fullstacked.cloud/project-runtime?format=json","markdown":"# Injected process.env\n\nEvery FullStacked Cloud project reads its configuration from `process.env`: the platform hosts, the credentials of linked managed data and Edge tunnels, the project's custom variables, and `AUTH_TOKEN`, a token of the current user. The environment comes from `GET https://g.fullstacked.cloud/api/v1/projects/:id/env`, resolved for the caller, plus `AUTH_TOKEN` added at launch. Code never hardcodes a host, a database user or a token.\n\n## Where the environment comes from\n\n| Where the code runs | `process.env` contains |\n| :--- | :--- |\n| FullStacked Cloud Client GUI | The resolved environment of the signed-in user plus `AUTH_TOKEN` = a project-scoped token minted for this run (`fsc_prj_...`, see below), never their session. If the environment cannot be fetched, the project still runs with `AUTH_TOKEN` alone. |\n| Local CLI (`npx fullstacked`) | `<project>/.env` merged with `-e KEY=VALUE` flags (flags win). Write `.env` from `GET .../env?format=dotenv` and pass the token: `npx fullstacked -e AUTH_TOKEN=$AUTH_TOKEN` with a personal access token (`fsc_pat_...`, https://c.fullstacked.cloud Settings, Access tokens). Keep `.env` out of Git. |\n| Project action run (`actions/<name>.ts`) | The environment resolved for the caller of the run, `AUTH_TOKEN` = the caller's token, plus run variables (see [Project Actions](https://d.fullstacked.cloud/actions)). |\n\n## Variables\n\n| Variable | Present | Value |\n| :--- | :--- | :--- |\n| `AUTH_URL` | Resolved environment | Authentication service base URL, `https://a.fullstacked.cloud` here. Use for `/api/v1/me`, `/api/v1/user/access`, token exchange. |\n| `AUTH_HOST` | Resolved environment | Its host, `a.fullstacked.cloud`. |\n| `TUNNELS_HOST` | Resolved environment | Tunnels hub host for `tunnel.register({ host })`, `t.fullstacked.cloud`. |\n| `AUTH_TOKEN` | At launch only | A FullStacked Cloud token of the current user: `fsc_prj_...` (Client GUI, scoped to this project), `fsc_pat_...` (personal access token, local CLI) or the action caller's token. Never part of `GET .../env`, never stored in the project. |\n| `PG_DATA_TOKEN`, `REDIS_DATA_TOKEN`, `MONGO_DATA_TOKEN`, `S3_DATA_TOKEN`, `P2P_DATA_TOKEN` | Linked data instance | `tun_...` routing token of the instance's tunnel at the caller's access level. Use as `` `${AUTH_TOKEN}:${PG_DATA_TOKEN}` ``. |\n| `DATA_USER`, `DATA_PASSWORD` | Linked PostgreSQL, Redis, MongoDB, P2P | `app_rw` or `app_ro` and its password, matching the caller's access (read-write or read-only). |\n| `DATA_DB` | Linked PostgreSQL, MongoDB | Database name, e.g. `data_pg_1`, `data_mongo_1`. Not set for Redis and P2P. |\n| `DATA_KEY_ID`, `DATA_KEY_SECRET`, `DATA_BUCKET` | Linked S3 | Access key, secret key and bucket name for the caller's access level. |\n| `<PREFIX>_TUNNEL_TOKEN` | Linked Edge tunnel | `tun_...` token of the tunnel. Use as `` `${AUTH_TOKEN}:${OFFICE_API_TUNNEL_TOKEN}` ``. |\n| Custom variables | Set on the project | Any `NAME=value` stored with `PUT .../env` (Console: Project, Environment), optionally marked secret. |\n\n## What AUTH_TOKEN reaches\n\nFrom the Client GUI, `AUTH_TOKEN` is a project-scoped token (`fsc_prj_...`) minted for the signed-in user and this project. It works for everything a project does with it:\n\n- `GET ${AUTH_URL}/api/v1/me`: the current user (enterprise users included).\n- `GET ${AUTH_URL}/api/v1/user/access`: narrowed to this project (read access at most), its linked data instances at the user's level and its linked Edge tunnels; `global_permissions` and `groups` are empty.\n- `tunnel.register({ authorization: \\`${AUTH_TOKEN}:${<X>_TOKEN}\\` })` for every linked data instance and tunnel.\n- Your enterprise backend's validation (`POST /v1/authorities/:id/validate`, see [Runtime Sign-In & BYOA](https://d.fullstacked.cloud/auth-byoa)) when the user signed in through your authority.\n\nAnything that manages the account answers `403 PROJECT_TOKEN_SCOPE`: tokens, sharing, profile, billing, account deletion. It expires with the user's session and stops reaching the project's resources when the user loses access to the project. Before the first run of a project shared by someone else, the Client GUI shows the user who owns it and what it reaches, and runs it only once they accept. Do not rely on `AUTH_TOKEN` being present: a run the user has not approved, or an offline run, may have none.\n\nThe three platform hosts are part of every resolved environment, for the environment the project belongs to (test here): the same code runs against test and live. They are missing when no environment was resolved: a Client GUI launch whose environment request failed (only `AUTH_TOKEN` is set), or a local CLI run without a `.env` written from `GET .../env`. Check them like any other variable.\n\n## Naming rules\n\n- The **oldest linked data instance** gets unprefixed names (`DATA_USER`, `PG_DATA_TOKEN`, ...).\n- Every **other linked data instance** gets the same names prefixed with its display name: upper-cased, non-alphanumeric runs replaced by `_`, leading and trailing `_` trimmed, `_` prepended before a leading digit (instance `analytics-db` gives `ANALYTICS_DB_DATA_USER`, `ANALYTICS_DB_PG_DATA_TOKEN`, ...).\n- **Edge tunnels** are always prefixed with the tunnel name, normalized the same way (`office-api` gives `OFFICE_API_TUNNEL_TOKEN`). Tunnel names are unique per Edge only: two linked tunnels with the same name produce the same variable, and the second is dropped into `conflicts`. Give one of them a prefix mapping.\n- A **prefix mapping** (`PUT .../env` with `mappings`) overrides the prefix of one resource; an empty prefix is not allowed (prefix: `A-Z` then up to 63 of `A-Z`, `0-9`, `_`).\n- Names never overwrite each other. Platform hosts come first, then linked data (oldest link first), then tunnels, then custom variables; a later entry with an existing name is dropped and reported in `conflicts`.\n- Resources the caller cannot use are omitted silently, so a variable can be absent for one user and present for another: check before use.\n\n```ts\nfunction requireEnv(name: string): string {\n    const value = process.env[name];\n    if (!value) throw new Error(`${name} is not set: link the resource to the project or run with AUTH_TOKEN`);\n    return value;\n}\n```\n\n## GET /api/v1/projects/:id/env\n\n`GET https://g.fullstacked.cloud/api/v1/projects/<projectId>/env?format=json|dotenv` with `Authorization: Bearer <fsc_* token>`. Any project tier may call it; the values are resolved with the caller's own access. MCP: `projects_get_env`.\n\n```json\n{\n  \"projectId\": \"7f3b89a2-4c1e-48a0-9d21-f8e910243abc\",\n  \"project\": \"alice/task-flow\",\n  \"accessTier\": \"FULL_ACCESS\",\n  \"env\": {\n    \"TUNNELS_HOST\": \"t.fullstacked.cloud\",\n    \"AUTH_HOST\": \"a.fullstacked.cloud\",\n    \"AUTH_URL\": \"https://a.fullstacked.cloud\",\n    \"PG_DATA_TOKEN\": \"tun_4b8c9d...\",\n    \"DATA_USER\": \"app_rw\",\n    \"DATA_PASSWORD\": \"...\",\n    \"DATA_DB\": \"data_pg_1\",\n    \"OFFICE_API_TUNNEL_TOKEN\": \"tun_3f9a2b...\",\n    \"APP_TITLE\": \"Task Flow\",\n    \"MAPS_API_KEY\": \"AIza...\"\n  },\n  \"meta\": { \"PG_DATA_TOKEN\": { \"source\": \"linked_data\", \"resourceId\": \"9b2f6c1e-...\", \"name\": \"tasks-db\", \"engine\": \"postgres\", \"access\": \"READ_WRITE\", \"secret\": true } },\n  \"resources\": [{ \"source\": \"linked_data\", \"resourceId\": \"9b2f6c1e-...\", \"name\": \"tasks-db\", \"prefix\": \"\", \"mapped\": false }],\n  \"variables\": { \"APP_TITLE\": \"Task Flow\", \"MAPS_API_KEY\": \"AIza...\" },\n  \"secrets\": [\"MAPS_API_KEY\"],\n  \"mappings\": {},\n  \"conflicts\": []\n}\n```\n\n`meta` has one entry per variable (`source`: `platform`, `linked_data`, `linked_tunnel` or `custom`; `secret` is false only for hosts, `DATA_USER`, `DATA_DB`, `DATA_BUCKET` and custom variables not marked secret; `secrets` lists the custom variables marked secret). `format=dotenv` returns the same `env` as `KEY=value` lines.\n\n## PUT /api/v1/projects/:id/env\n\nRequires `write` on the project. MCP: `projects_set_env`.\n\n```json\n{ \"variables\": { \"APP_TITLE\": \"Task Flow\", \"MAPS_API_KEY\": { \"value\": \"AIza...\", \"secret\": true }, \"OLD_FLAG\": null }, \"mappings\": { \"<resourceId>\": { \"prefix\": \"CACHE\" } } }\n```\n\n- `null` removes a variable or mapping.\n- A variable is a string or `{ \"value\"?, \"secret\"? }`: `secret: true` marks it secret, `false` unmarks it, and a plain string keeps the current flag (omit `value` to change only the flag).\n- Names: `^[A-Z_][A-Z0-9_]{0,127}$`; values: single-line strings up to 4096 characters; at most 200 variables and 100 mappings.\n- Setting `AUTH_TOKEN`, `AUTH_URL`, `AUTH_HOST` or `TUNNELS_HOST` is refused (`400 RESERVED_VARIABLE`).\n- Custom variables reach every project tier, including release-only users, because the code needs them wherever it runs. Marking one secret masks it in the Console and flags it in `meta`; it does not hide it from members who run the project. Keep values only a backend may hold out of custom variables.\n\n## Endpoints\n\n### GET /api/v1/projects/:id/env\n\nThe project's resolved runtime environment: DATA_* wiring and tokens of linked instances, platform URLs (AUTH_URL, AUTH_HOST, TUNNELS_HOST) and custom variables. ?format=json|dotenv; never contains AUTH_TOKEN.\n\n- **Service**: `git` (`https://g.fullstacked.cloud`)\n- **Auth**: Bearer fsc_*\n\ncurl:\n\n```bash\ncurl -sS -H \"Authorization: Bearer $AUTH_TOKEN\" \"https://g.fullstacked.cloud/api/v1/projects/<projectId>/env?format=dotenv\"\n```\n\n### PUT /api/v1/projects/:id/env\n\nMerges { variables?, mappings? } into the project's environment config (null removes a key). Needs write.\n\n- **Service**: `git` (`https://g.fullstacked.cloud`)\n- **Auth**: Bearer fsc_*\n\nRequest:\n\n```json\n{\n  \"variables\": {\n    \"API_BASE\": \"https://example.com\"\n  }\n}\n```\n"}],"endpoints":[{"service":"git","topic":"project-runtime","auth":"Bearer fsc_*","id":"git.getEnv","method":"GET","path":"/api/v1/projects/:id/env","summary":"The project's resolved runtime environment: DATA_* wiring and tokens of linked instances, platform URLs (AUTH_URL, AUTH_HOST, TUNNELS_HOST) and custom variables. ?format=json|dotenv; never contains AUTH_TOKEN.","codeExamples":{"curl":"curl -sS -H \"Authorization: Bearer $AUTH_TOKEN\" \"https://g.fullstacked.cloud/api/v1/projects/<projectId>/env?format=dotenv\""},"fullUrl":"https://g.fullstacked.cloud/api/v1/projects/:id/env"},{"service":"git","topic":"project-runtime","auth":"Bearer fsc_*","id":"git.setEnv","method":"PUT","path":"/api/v1/projects/:id/env","summary":"Merges { variables?, mappings? } into the project's environment config (null removes a key). Needs write.","requestExample":{"variables":{"API_BASE":"https://example.com"}},"fullUrl":"https://g.fullstacked.cloud/api/v1/projects/:id/env"}]}