Firestore security rules and composite indexes are the two server-side configurations that control data access and query performance in the Nexu platform. Both live as files in the repository root —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.
firestore.rules and firestore.indexes.json — and are deployed to Firebase using a single npm script. You only need to run this deployment after modifying those files; every lesson seed and every Vercel build are completely independent of this step.
Deploy command
firestore.rules and firestore.indexes.json to the Firebase project nexu-156ce. It uses firebase-tools via npx — no global installation is required, and firebase-admin is not involved.
Prerequisites
Before running the deploy command, authenticate the Firebase CLI and point it at the correct project:-
Log in to the Firebase CLI:
This opens a browser window. Sign in with the team Google account that has Owner or Editor role on project
nexu-156ce. -
Set the active project:
This writes the selection to
.firebasercso subsequentfirebasecommands target the right project automatically.
When to deploy rules
| Situation | Deploy needed? |
|---|---|
Modified firestore.rules | Yes |
Modified firestore.indexes.json | Yes |
| Added a new lesson via seed | No |
| Changed React components or Vite config | No |
| Pushed a new commit to Vercel | No |
firestore.rules
The rules file controls who can read and write each Firestore collection. The current rules enforce the following policy:/users/{userId}— authenticated users can only read and write their own profile document./users/{userId}/lessonProgress/{lessonId}— each user can only read and write their own lesson progress./lessons/{lessonId}and its sub-collectionsblocksandquestions— any authenticated user can read; no user can write (content is loaded exclusively by seed scripts)./certificates/{certificateId}— owners can read their own certificate; any authenticated user can create a certificate for themselves (with validity checks); update and delete are permanently denied./certificatePublic/{verifyCode}— public read access (used by the/verificar/:codepage); any authenticated user can create; update and delete are permanently denied.- Catch-all — all other paths deny read and write by default.
firestore.indexes.json
Composite indexes are required for Firestore queries that filter or sort on more than one field. The current file defines two indexes:lessons—isActive(ASC) +order(ASC): used byLearningPathPageto fetch all active lessons in display order.certificates—userId(ASC) +issuedAt(DESC): used bygetUserCertificates()to retrieve a user’s certificates sorted newest-first.
Adding a new index
To add a composite index, append an entry to the"indexes" array in firestore.indexes.json following the same structure above, then run:
firebase.json
Thefirebase.json file tells the Firebase CLI where to find the rules and indexes files:
.firebaserc
The.firebaserc file records the default Firebase project alias so the CLI always targets nexu-156ce without requiring --project flags: