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
| Level | What | How often |
|---|---|---|
| Vercel Team | Shared Environment Variables | Once (you already have this) |
| v0 Team | Golden Project → Team-Template | Maintain once |
| Vercel Project | COCKPIT_REGISTER_TOKEN + COCKPIT_CENTER_SLUG | Per Center |
Shared Env (Team, all projects):
| Variable | Example |
|---|---|
COCKPIT_DASHBOARD_URL | https://dashboard.cockpit-os.de |
REVALIDATION_SECRET | as in Cockpit |
COCKPIT_FRONTEND_CHANNEL | website |
Per Project (only these two — the rest comes from the team):
| Variable | Source |
|---|---|
COCKPIT_REGISTER_TOKEN | Cockpit → Website Management → Frontend Channels (v0) → Generate Token |
COCKPIT_CENTER_SLUG | Center 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:
-
Route
app/api/cockpit-register/route.ts(from monorepo:apps/center-website/app/api/cockpit-register/route.ts) -
Route
app/api/revalidate/route.ts(for auto-update after publish) -
Script
scripts/cockpit-register-after-deploy.mjs(fromapps/center-website/scripts/…) -
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.jsonetc. (see Instruction Cockpit E). -
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):
- Open the Golden Project (ready layout + routes + postbuild).
- Menu ⋯ / Project settings → Publish / Save as team template (label in v0 may vary slightly).
- Name for example
Cockpit Center Website (Standard). - 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)
-
Cockpit: Create center, note Slug.
-
v0: New project from Team Template.
-
Vercel: Link project (GitHub
sawmuedevor similar) — link Shared Env (see below). -
Vercel Project → Environment Variables (only project-specific):
NEXT_PUBLIC_DASHBOARD_URL=https://dashboard.cockpit-os.deCOCKPIT_REGISTER_TOKEN=frt_…COCKPIT_CENTER_SLUG=<slug-from-cockpit>This is in v0 Instructions Part A, Part C, Part J.
-
Production deploy —
postbuildnotifies the cockpit of the URL. -
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.
- Vercel → Project → Settings → Environment Variables
- Link Shared Environment Variables → check
COCKPIT_DASHBOARD_URL,REVALIDATION_SECRET,COCKPIT_FRONTEND_CHANNEL - Check project env: Are
COCKPIT_REGISTER_TOKEN,COCKPIT_CENTER_SLUG,NEXT_PUBLIC_DASHBOARD_URLset? - Remove duplicate
COCKPIT_DASHBOARD_URL/REVALIDATION_SECRETat project level (otherwise they overwrite Shared) - Production redeploy
- 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)
| Error | Cause | Fix |
|---|---|---|
COCKPIT_CENTER_SLUG missing | Slug not in Vercel | Enter slug from Cockpit |
| Token belongs to “X”, not to “Y” | Slug doesn't match the token center | Correct slug or token |
Invalid register token | Token rotated/incorrect | Generate a new token, set it in Vercel, redeploy |
| Register OK, Revalidate missing | Route/Secret | revalidate route + REVALIDATION_SECRET (Team Shared linked) |
| API/Register despite Shared “missing” | Shared not linked or no redeploy | Link 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