Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Stivenz3/Nexu/llms.txt

Use this file to discover all available pages before exploring further.

Nexu’s frontend is deployed on Vercel and auto-deploys from the main branch whenever a new commit is pushed. Vercel handles the build (tsc && vite build) and serves the compiled output as a single-page application (SPA). Beyond environment variables and the vercel.json configuration already committed to the repository, no additional Vercel project setup is required for routine deploys.

vercel.json

The vercel.json at the repository root configures the SPA catch-all rewrite needed by React Router, as well as Content-Type and cache headers for the Unity WebGL game assets served from public/games/cocina-infectada/:
{
  "rewrites": [{ "source": "/(.*)", "destination": "/index.html" }],
  "headers": [
    {
      "source": "/games/cocina-infectada/Build/(.*)\\.data\\.unityweb",
      "headers": [
        { "key": "Content-Type", "value": "application/octet-stream" },
        { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
      ]
    },
    {
      "source": "/games/cocina-infectada/Build/(.*)\\.framework\\.js\\.unityweb",
      "headers": [
        { "key": "Content-Type", "value": "application/javascript" },
        { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
      ]
    },
    {
      "source": "/games/cocina-infectada/Build/(.*)\\.wasm\\.unityweb",
      "headers": [
        { "key": "Content-Type", "value": "application/wasm" },
        { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
      ]
    },
    {
      "source": "/games/cocina-infectada/Build/(.*)\\.loader\\.js",
      "headers": [
        { "key": "Content-Type", "value": "application/javascript" },
        { "key": "Cache-Control", "value": "public, max-age=31536000, immutable" }
      ]
    }
  ]
}
The rewrite rule ensures every URL — including deep links like /leccion/lesson_01_higiene_personal/evaluacion — is served by index.html so React Router can take over client-side routing.

Build command

Vercel runs the following build command as defined in package.json:
tsc && vite build
TypeScript is compiled first (tsc), then Vite bundles the output. If TypeScript reports errors, the build fails and the deploy is aborted — fixing type errors locally with npm run build before pushing is recommended.

Required environment variables

All variables below must be added in Vercel Project → Settings → Environment Variables. The VITE_ prefix makes them available at build time through Vite’s import.meta.env mechanism — they are inlined into the compiled bundle and are not secret.
VariableExample value
VITE_FIREBASE_API_KEYAIza...
VITE_FIREBASE_AUTH_DOMAINnexu-156ce.firebaseapp.com
VITE_FIREBASE_PROJECT_IDnexu-156ce
VITE_FIREBASE_STORAGE_BUCKETnexu-156ce.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID123456789
VITE_FIREBASE_APP_ID1:123...
VITE_APP_URLhttps://nexu.vercel.app (optional — used to build QR code URLs on certificates)
Values for the VITE_FIREBASE_* variables come from Firebase Console → Project Settings → Your apps → SDK setup and configuration for project nexu-156ce.
All team members develop and test against the same Firebase project nexu-156ce. There is no separate production or staging Firebase project. The same Firestore database and Auth tenant power local development, Vercel previews, and the production URL.

Serverless functions (api/)

The api/ directory at the repository root is automatically detected by Vercel as serverless functions and deployed alongside the frontend. Currently it contains one function:
  • api/verify-recaptcha.ts — validates reCAPTCHA tokens server-side using RECAPTCHA_SECRET_KEY. Because this variable does not start with VITE_, it is never exposed to the browser.
No additional configuration is needed to deploy these functions; Vercel picks them up automatically.

Seed scripts and Vercel

Seed scripts (npm run seed:lesson1, npm run seed:lesson2) are developer tools that run locally on a developer’s machine. Vercel does not run them during the build or deploy pipeline. All lesson content lives in Firestore and is fetched at runtime by the React app. See Seed Commands for details on running seeds.

Keeping the pnpm lockfile in sync

Vercel uses pnpm to install dependencies during CI builds. It reads pnpm-lock.yaml from the repository to ensure reproducible installs.
If package.json is updated (a dependency added, removed, or version changed) without a corresponding update to pnpm-lock.yaml, Vercel will fail with:
ERR_PNPM_OUTDATED_LOCKFILE
To fix this, run the following locally and commit the result before pushing:
pnpm install --lockfile-only
git add pnpm-lock.yaml
git commit -m "chore: update pnpm lockfile"
Seed-script dependencies live in scripts/package.json and are installed with npm install --prefix scripts at seed time, completely separate from the Vercel build. They do not affect pnpm-lock.yaml.

Build docs developers (and LLMs) love