SPS EDUCATIONAM is a role-based academic resource platform built with Next.js and Firebase. Students can browse curated learning materials, faculty can manage resource uploads, and admins can oversee users and access rules.
- Email/password authentication with Firebase Auth
- Change Password: Secure server-side password management for authenticated users
- Role-based dashboards for students, faculty, and admins
- Protected routes with server-side session checks
- Firestore-backed user profiles and resources
- Cloudflare Edge Compatible: All authentication logic (REST API based) is optimized for Cloudflare Workers/Pages
- Security Audited: 0 vulnerabilities in top-level and transitive dependencies
- Next.js 16
- React 19 (Server Components)
- Firebase Authentication (via REST API for edge compatibility)
- Cloud Firestore
- Cloudflare Workers with OpenNext
npm installCopy the example file and fill in your real values:
cp .env.example .env.localRequired values include:
NEXT_PUBLIC_FIREBASE_API_KEYNEXT_PUBLIC_FIREBASE_AUTH_DOMAINNEXT_PUBLIC_FIREBASE_PROJECT_IDNEXT_PUBLIC_FIREBASE_STORAGE_BUCKETNEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_IDNEXT_PUBLIC_FIREBASE_APP_IDSESSION_SECRET
Optional server values (required for some admin features):
FIREBASE_PROJECT_IDFIREBASE_CLIENT_EMAILFIREBASE_PRIVATE_KEYSUPER_ADMIN_EMAIL
Frontend code that needs the same check should read NEXT_PUBLIC_SUPER_ADMIN_EMAIL.
npm run devThe app runs at http://localhost:3000.
- Login: Uses Firebase Auth on the client.
- Session Management: Secure, signed cookies enforced for all dashboard routes.
- Password Updates: High-security
/api/auth/change-passwordroute requires the current password for verification. - Edge Deployment: Firebase Auth operations are migrated to a direct REST architecture to ensure 100% compatibility with Cloudflare's
nodejs_compatenvironment. - Dependency Audit: The project uses
overridesinpackage.jsonto force secure versions of transitive dependencies (protobufjs,jsonwebtoken), maintaining a 0-vulnerability status.
This project includes Firestore rules in firestore.rules that intentionally deny all client reads and writes. Ensure your Firebase project uses these rules to fully block direct Firestore access from client applications; all Firestore operations are intended to run only through privileged server-side code using the Firebase Admin SDK.
This project uses OpenNext for optimal performance on the Cloudflare global network.
| Command | Action |
|---|---|
npm run cf:build |
Build the project for Cloudflare (OpenNext) |
npm run preview |
Preview the production build locally (Wrangler) |
npm run deploy |
Bundles and deploys the assets to Cloudflare Pages |
Ensure these are added in your Cloudflare Pages dashboard:
NEXT_PUBLIC_FIREBASE_API_KEYNEXT_PUBLIC_FIREBASE_AUTH_DOMAINNEXT_PUBLIC_FIREBASE_PROJECT_IDSESSION_SECRETFIREBASE_CLIENT_EMAILFIREBASE_PRIVATE_KEY
- Do not commit
.env.localor Service Account JSON files. - All high-risk endpoints require session verification and role checks.
- Sensitive environment variables are encrypted at rest on Cloudflare.
GitHub: WhiteDevil-rss/SPS EDUCATIONAM