Skip to main content

Setting Up v0 Team-Template (Once + Per Center)

Goal: New center website project in a few minutes — without copying dashboard URL, revalidation secret, and register route each time. Fail-safe: Incorrect token or slug will be rejected by the cockpit.

Overview

LevelWhatHow often
Vercel TeamShared Environment VariablesOnce (you already have this)
v0 TeamGolden Project → Team-TemplateMaintain once
Vercel ProjectCOCKPIT_REGISTER_TOKEN + COCKPIT_CENTER_SLUGPer Center

Shared Env (Team, all projects):

VariableExample
COCKPIT_DASHBOARD_URLhttps://dashboard.cockpit-os.de
REVALIDATION_SECRETas in Cockpit
COCKPIT_FRONTEND_CHANNELwebsite

Per Project (only these two — the rest comes from the team):

VariableSource
COCKPIT_REGISTER_TOKENCockpit → Website Management → Frontend Channels (v0) → Generate Token
COCKPIT_CENTER_SLUGCenter slug in Cockpit (e.g., allen-center-trier) — must match the token

Step 1 — Golden Project (Reference Project)

A v0/Vercel project that contains everything that every center needs:

  1. Route app/api/cockpit-register/route.ts (from monorepo: apps/center-website/app/api/cockpit-register/route.ts)

  2. Route app/api/revalidate/route.ts (for auto-update after publish)

  3. Script scripts/cockpit-register-after-deploy.mjs (from apps/center-website/scripts/…)

  4. In package.json:

    "prebuild": "node scripts/generate-fallback-json.mjs",
    "postbuild": "node scripts/cockpit-register-after-deploy.mjs"

    generate-fallback-json.mjs: Cockpit API → public/fallback/shops.json etc. (see Instruction Cockpit E).

  5. v0 Instructions (Cockpit API, MCP) as in v0-Website A–Z

Deploy the golden project to Production once and test:

curl -X POST "https://<golden>.vercel.app/api/cockpit-register"

Expectation: JSON with success: true (if test token + test slug are set).


Step 2 — Create v0 Team-Template

In v0 (Team Workspace):

  1. Open the Golden Project (ready layout + routes + postbuild).
  2. Menu / Project settingsPublish / Save as team template (label in v0 may vary slightly).
  3. Name for example Cockpit Center Website (Standard).
  4. Save — from now on: New project → From team template.

Important: Template updates only affect new projects from the template, not automatically old deployments. Maintain the golden project and republish the template for major changes.


Step 3 — New Center (Checklist)

  1. Cockpit: Create center, note Slug.

  2. v0: New project from Team Template.

  3. Vercel: Link project (GitHub sawmuedev or similar) — link Shared Env (see below).

  4. Vercel Project → Environment Variables (only project-specific):

    NEXT_PUBLIC_DASHBOARD_URL=https://dashboard.cockpit-os.de
    COCKPIT_REGISTER_TOKEN=frt_…
    COCKPIT_CENTER_SLUG=<slug-from-cockpit>

    This is in v0 Instructions Part A, Part C, Part J.

  5. Production deploypostbuild notifies the cockpit of the URL.

  6. Cockpit → Frontend Channels (v0): Test connection; editorial work continues only in v0.


Existing Vercel Projects (Retroactively)

The shared env from the team does not automatically apply to old projects.

  1. Vercel → ProjectSettingsEnvironment Variables
  2. Link Shared Environment Variables → check COCKPIT_DASHBOARD_URL, REVALIDATION_SECRET, COCKPIT_FRONTEND_CHANNEL
  3. Check project env: Are COCKPIT_REGISTER_TOKEN, COCKPIT_CENTER_SLUG, NEXT_PUBLIC_DASHBOARD_URL set?
  4. Remove duplicate COCKPIT_DASHBOARD_URL / REVALIDATION_SECRET at project level (otherwise they overwrite Shared)
  5. Production redeploy
  6. v0: Re-copy Instructions Part A / C / J from the documentation (Env distribution)

Signage/Companion: If channel ≠ website, set COCKPIT_FRONTEND_CHANNEL project-specific (overwrites Shared).


Fail-safe (What Can Go Wrong)

ErrorCauseFix
COCKPIT_CENTER_SLUG missingSlug not in VercelEnter slug from Cockpit
Token belongs to “X”, not to “Y”Slug doesn't match the token centerCorrect slug or token
Invalid register tokenToken rotated/incorrectGenerate a new token, set it in Vercel, redeploy
Register OK, Revalidate missingRoute/Secretrevalidate route + REVALIDATION_SECRET (Team Shared linked)
API/Register despite Shared “missing”Shared not linked or no redeployLink Shared + redeploy; check project token/slug

Token and slug are checked together — a token from Center A cannot accidentally overwrite Center B.


Editorial (No IT Stress)

After step 3: Build in v0, transfer content to Cockpit via MCP. Go live: in v0 chat e.g. “Website ready, go live” (MCP publish_website_live) — see Go-Live.


See Also

Nutzungsstatistik: Seitenaufrufe werden anonymisiert erfasst. Im Umami-Dashboard nach diesem Pfad filtern: /en/content-creator-handbuch/v0-team-template-einrichtung