Connecting Admins β’ Teachers β’ Security β’ Parents through one unified backend, a web dashboard, and a mobile app.
|
π Auth & RBAC JWT + bcrypt + OTP, 5 roles (admin/teacher/security/parent/pending), parent 2FA πͺ Gate System QR scan IN/OUT + auto-checkout cron at 18:00 + parent FCM alerts β Attendance Daily sessions, batch submit, calendar view, parent visibility π Results Per-term modules, grades, publish/unpublish flow |
π¬ Messaging Threads, contacts, AI draft suggestions π’ Announcements School-wide & class-scoped notices π€ RAG Chatbot Policy PDFs β Gemini embeddings (768-dim pgvector) β hybrid search β LLM π Complaints Parent β admin β staff triage, status state machine |
π Push Notifications Firebase FCM (multicast) π Lost & Found Items posted by staff, reports filed by parents π§ Email Resend OTPs & approval notifications β‘ Cache Redis for RAG, sessions, online status (graceful degrade) |
Universe-System/ π¦ npm workspace monorepo
β
βββ π© apps/
β βββ backend/ βοΈ Fastify + Prisma REST API Β· :5000
β β βββ src/
β β β βββ server.ts Β· app.ts π entry + Fastify config
β β β βββ config/ π§ env Β· prisma Β· redis Β· firebase Β· supabase
β β β βββ common/{middleware,utils}/ π‘οΈ authenticate Β· rbac Β· errorHandler Β· jwt Β· hash Β· otp Β· email Β· cache
β β β βββ modules/ π¦ 11 feature modules
β β β βββ auth/ Β· users/ Β· school/
β β β βββ gate/ Β· attendance/
β β β βββ announcements/ Β· messages/
β β β βββ complaints/ Β· lost-found/ Β· results/
β β β βββ rag/{controllers,services} π€ chunker Β· embedder Β· retrieval Β· generation
β β βββ prisma/schema.prisma ποΈ 20 models Β· pgvector Β· uuid-ossp
β β βββ tests/{unit,integration}/ π§ͺ Jest + supertest
β β βββ Dockerfile.dev Β· jest.config.js
β β βββ package.json
β β
β βββ frontend/ π Next.js 16 + React 19 + Tailwind Β· :3000
β β βββ src/
β β β βββ app/ π App Router
β β β β βββ login/ Β· register/ Β· forgot-password/ Β· pending/
β β β β βββ admin/ {overview,attendance,students,teachers,complaints,notices,...}
β β β β βββ teacher/ {overview,attendance,classes,results,messages,notices,...}
β β β β βββ security/ {dashboard,logs,messages,overview,profile}
β β β βββ features/ π§© auth Β· attendance Β· gate Β· messages Β· notices Β· complaints Β· results Β· rag Β· school
β β β βββ shared/components/ π¨ layout Β· auth Β· admin Β· ui Β· AttendanceCalendar
β β β βββ shared/hooks/ Β· shared/lib/
β β β βββ core/
β β βββ Dockerfile.dev Β· eslint.config.mjs
β β βββ package.json
β β
β βββ flutter/ π± Flutter parent app (Android/iOS)
β βββ lib/
β β βββ main.dart Β· app.dart Β· firebase_options.dart
β β βββ core/ π§ api Β· di Β· navigation Β· services Β· storage
β β βββ features/ π§© 15 modules
β β β βββ splash/ Β· auth/ Β· dashboard/ Β· profile/
β β β βββ attendance/ Β· gate/ Β· results/
β β β βββ messages/ Β· contact_teacher/ Β· notices/
β β β βββ chatbot/ Β· support/ Β· lost_and_found/
β β β βββ notifications/ Β· settings/
β β βββ shared/{themes,widgets}/ π¨ ActionCard Β· AppButton Β· LiveClockWidget
β βββ android/ Β· ios/
β βββ test/widget_test.dart
β βββ .githooks/{pre-commit,pre-push}
β βββ pubspec.yaml
β
βββ πͺ .github/workflows/
β βββ ci.yml β
PR tests (backend + flutter)
β βββ flutter-release.yml π¦ APK auto-build on release/development
β
βββ π§ .husky/ πͺ pre-commit Β· pre-push Β· commit-msg (commitlint)
βββ π« Doc/ π 10 detailed reference docs
βββ π¨ Documentation/ π 5 comprehensive guides (overview Β· backend Β· frontend Β· flutter Β· devops)
β
βββ π³ docker-compose.yml production stack
βββ π³ docker-compose.dev.yml dev stack (hot reload)
βββ π¦ package.json Β· package-lock.json single root workspace
βββ π¨ .prettierrc Β· commitlint.config.js code style + conventional commits
βββ β‘ vercel.json Vercel deploy config
βββ π .mcp.json MCP servers (Supabase)
π’ One command. Three services up.
# 1οΈβ£ Set env vars
cp apps/backend/.env.example apps/backend/.env # fill in secrets
touch apps/frontend/.env.local # add NEXT_PUBLIC_API_URL=http://backend:5000
# 2οΈβ£ Run the dev stack (hot reload)
docker compose -f docker-compose.dev.yml up --build
# 3οΈβ£ Stop
docker compose -f docker-compose.dev.yml down| Service | URL | Container |
|---|---|---|
| π¦ Backend API | http://localhost:5000 | universe-backend |
| π Health Check | http://localhost:5000/health | β |
| πͺ Web Frontend | http://localhost:3000 | universe-frontend |
| π΄ Redis | localhost:6379 | universe-redis |
docker compose up --build # uses docker-compose.yml (no volume mounts, NODE_ENV=production)npm install # install all workspaces
npm run prisma:generate --prefix apps/backend # generate Prisma client
# Two terminals
npm run backend:dev # βοΈ http://localhost:5000
npm run frontend:dev # π http://localhost:3000
# Flutter (3rd terminal)
cd apps/flutter && flutter pub get && flutter runπ² Android emulator uses
http://10.0.2.2:5000Β· iOS simulator useshttp://127.0.0.1:5000.
π¦ Backend β apps/backend/.env
PORT=5000
DATABASE_URL=postgresql://... # Supabase pooled
DIRECT_URL=postgresql://... # Supabase direct (Prisma migrations)
REDIS_URL=redis://redis:6379 # optional (graceful degrade)
JWT_SECRET=... # min 32 chars
SUPABASE_URL=...
SUPABASE_ANON_KEY=...
SUPABASE_SERVICE_KEY=...
RESEND_API_KEY=re_...
GEMINI_API_KEY=...
FIREBASE_PROJECT_ID=...
FIREBASE_SERVICE_ACCOUNT_JSON='{"type":"service_account",...}'
WEB_URL=http://localhost:3000
FLUTTER_ORIGIN=http://localhost:3001πͺ Frontend β apps/frontend/.env.local
NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_SUPABASE_URL=https://....supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=...π± Flutter β build-time
flutter build apk --dart-define=API_BASE_URL=https://api.yourdomain.com| Layer | Backend | Web | Mobile |
|---|---|---|---|
| Framework | π’ Fastify 5 | β« Next.js 16 App Router | π΅ Flutter 3.32 |
| Language | π· TypeScript | π· TypeScript | π― Dart |
| State / Data | Prisma 6 + PostgreSQL | React 19 + Context | Provider + Repositories |
| HTTP | Built-in (Fastify) | fetch + credentials | Dio + interceptors |
| Validation | Zod 4 | Zod + react-hook-form | Custom |
| Auth | JWT (7d) + bcrypt + OTP | HttpOnly cookies | flutter_secure_storage + biometric |
| Cache / Realtime | Redis 7 | β | FCM + local notifications |
| AI | Gemini embeddings + LLM | β | Calls backend RAG |
| Testing | π‘ Jest (3 of 11 modules) | π΄ None yet | π΄ 1 smoke test |
| Hosting | Railway | Vercel | GitHub Releases / TestFlight |
| Hook | Action |
|---|---|
π’ pre-commit |
ESLint --fix on staged files |
π‘ pre-push |
Lint + production build |
π΅ commit-msg |
Conventional Commits (feat: fix: docs: ...) |
π± Flutter pre-commit |
dart format staged .dart files |
π± Flutter pre-push |
flutter test |
| Workflow | Trigger | What it does |
|---|---|---|
π’ ci.yml |
Every PR | Backend unit + integration tests Β· Flutter widget tests |
π¦ flutter-release.yml |
Push to release/development |
Builds debug APK Β· Auto-bumps semver tag Β· Publishes GitHub Release |
| Folder | Contents |
|---|---|
π Documentation/ |
5 comprehensive guides β overview Β· backend Β· frontend Β· flutter Β· devops |
π Doc/ |
10 deep references β schema Β· auth flow Β· API Β· realtime Β· sprints Β· production checklist |
| Branch | Purpose |
|---|---|
π’ main |
Production-ready |
π‘ release/development |
Active integration (triggers Flutter APK build) |
π΅ feature/* |
Individual work |
Built with β€οΈ by @Methexx
π ISC License