Nexu is built on a two-layer architecture: a React 18 + Vite single-page application served from Vercel’s CDN, communicating directly with Firebase Auth and Firestore from the browser, with a single Vercel serverless function handling the one task that requires a server-side secret. There is no traditional Express/Node API layer — Firebase Security Rules are the enforcement boundary, and the app treats Firestore as its backend.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.
Architecture Layers
Frontend — React 18 + Vite on Vercel
The entire user experience lives insrc/. Vite builds static assets that Vercel deploys to its CDN globally. The app calls Firebase Auth and Firestore directly using the Firebase JS SDK — there is no proxy or middleware server between the browser and Google’s infrastructure.
Backend — Firebase + One Serverless Function
Firebase provides two backend primitives:- Firebase Auth — manages user identity (email/password sign-up and sign-in).
- Firestore — stores all application data: lessons, user progress, and certificates. Security Rules in
firestore.rulesenforce who can read or write which documents.
RECAPTCHA_SECRET_KEY must never be exposed in frontend code, so it lives in a Vercel serverless function:
/api/verify-recaptcha(Edge Function,api/verify-recaptcha.ts) — accepts a reCAPTCHA token from the browser, exchanges it with Google’ssiteverifyendpoint using the server-side secret, and returns a{ success, score }response.
Seed Scripts — Content Loading
Lesson content (blocks, questions, and normative references) is loaded into Firestore by Node.js seed scripts run from a developer terminal, not by the application itself. The app only reads lesson content.There is no large “API with 50 routes.” The React app communicates with Firebase from the browser; Firestore Security Rules are the only server-side enforcement layer for data access. The single serverless function at
/api/verify-recaptcha exists solely because a reCAPTCHA secret key cannot safely live in client-side code.Application Routes
All routes are defined insrc/App.tsx. Protected routes are wrapped in ProtectedRoute, which reads isAuthenticated from AuthContext and redirects unauthenticated users to /login.
| Route | Auth Required | Page Component | Description |
|---|---|---|---|
/ | Public | WelcomePage | Welcome / landing screen |
/login | Public | LoginPage | Email/password sign-in |
/registro | Public | RegisterPage | New user registration with reCAPTCHA |
/forgot-password | Public | ForgotPasswordPage | Password reset request |
/ruta | Protected | LearningPathPage | Full learning path with lesson cards |
/leccion/:id | Protected | LessonFlowPage | Sequential block flow (video → theory → game → exam) |
/leccion/:id/mapa | Protected | LessonMapPage | Lesson map / block overview |
/leccion/:id/evaluacion | Protected | LessonExamPage | Final exam for a specific lesson |
/certificado | Protected | CertificatePage | User’s earned certificates |
/certificado/documento | Protected | CertificateOfficialPage | Official certificate document view |
/verificar/:code | Public | VerificationPage | Public QR code certificate verification |
:id parameter for the first lesson is lesson_01_higiene_personal.
Source Directory Map
Environment Variables
The Firebase configuration is read fromVITE_FIREBASE_* environment variables at build time. In local development, if these variables are absent, src/firebase/config.ts falls back to hardcoded development project values for the shared nexu-156ce Firebase project. In production (Vercel), all variables must be set explicitly — the build will throw if any are missing.
| Variable | Used by |
|---|---|
VITE_FIREBASE_API_KEY | Firebase JS SDK |
VITE_FIREBASE_AUTH_DOMAIN | Firebase Auth |
VITE_FIREBASE_PROJECT_ID | Firestore |
VITE_FIREBASE_STORAGE_BUCKET | Firebase Storage (reserved) |
VITE_FIREBASE_MESSAGING_SENDER_ID | Firebase SDK |
VITE_FIREBASE_APP_ID | Firebase SDK |
RECAPTCHA_SECRET_KEY | api/verify-recaptcha.ts (Vercel, server-only) |