Full-featured school management system built with Node.js/Express backend and React frontend. Backend deployed on Railway (PostgreSQL), frontend deployed on Vercel.
The system includes an 8-layer biological defense pipeline integrated into backend middleware for attacker detection and delay:
| Layer | Mechanism |
|---|---|
| Token Monitor | Honeytoken protection, IP blocking, security alerts |
| Bombardier Beetle | Rate limiting (3-tier 429/503), resource tracking |
| Mimic Octopus | Polymorphic signature spoofing per attacker fingerprint |
| Hairy Frog | Sacrificial trap endpoints after 50 hits |
| Horned Lizard | Resource exhaustion via data bursts after 30 hits |
| Virginia Opossum | Dead service emulation after 3 repeat hits |
| Recursive Tarpit | Infinite junk byte streaming (1MB chunks) |
| Router Redirect | Bait template routing system |
Advanced counterintelligence includes timing analysis, traffic pattern detection, honeypot detection countermeasures, and deception depth escalation.
The value of this architecture is detection and delay at low cost. It does not replace hardening — it makes reconnaissance expensive enough that attackers move on.
| Layer | Technology |
|---|---|
| Runtime | Node.js 22+ |
| Framework | Express.js |
| Database | PostgreSQL 18 |
| Auth | JWT + bcrypt |
| Real-time | Socket.IO |
| File Upload | Multer + Cloudinary |
| PDFKit, Puppeteer, pdf-lib | |
| Validation | express-validator |
| Cache | node-cache |
| Monitoring | Sentry |
| Layer | Technology |
|---|---|
| Framework | React 18 |
| Build | Vite 7 |
| State | TanStack React Query + Context API |
| Routing | React Router v6 |
| Styling | CSS (custom properties, no modules) |
| Charts | Chart.js + react-chartjs-2 |
| Testing | Vitest + React Testing Library |
| Icons | Font Awesome 7 |
- User Management: Role-based access (admin, secretary, teacher, staff)
- Student Management: Registration, photos, scores, parish data, reports
- Reports: Individual and bulk PDF/CSV/Excel reports with ranking
- Admin Dashboard: User commands, DTA monitor, backup/restore, logs
- Public Website: CMS-managed homepage, announcements, events, gallery, chatbot
- Photo Management: Cloudinary uploads with rate limiting (30/min)
- Analytics: Performance tracking with Chart.js dashboards
- Real-time: Online staff presence, live updates via Socket.IO
- AI Chatbot: Mistral AI-powered public assistant
- PWA: Installable progressive web app
├── backend/ # Express API server
│ ├── config/ # Database, auth, Cloudinary config
│ ├── migrations/ # Versioned PostgreSQL migrations
│ ├── middleware/ # Auth, cache, error handling, deception layers
│ ├── routes/ # API route handlers
│ ├── utils/ # Shared utilities
│ ├── scripts/ # DB scripts and tooling
│ ├── __tests__/ # Jest test suite
│ └── server.js # Entry point
│
├── frontend/ # React SPA (deployed on Vercel)
│ ├── src/
│ │ ├── components/ # Reusable UI components (layout, ui)
│ │ ├── pages/ # Page components (public, admin)
│ │ ├── services/ # API service layer (axios)
│ │ ├── hooks/ # Custom React hooks
│ │ ├── context/ # React Context providers
│ │ ├── styles/ # Global CSS, homepage theme overrides
│ │ ├── constants/ # Shared constants
│ │ └── utils/ # i18n, logger, tokens
│ ├── public/ # Static assets, robots.txt
│ ├── vercel.json # Security headers (HSTS, CSP)
│ └── __tests__/ # Vitest test suite
│
├── docs/ # Technical documentation
├── .github/ # CI workflows, issue templates
└── railway.json # Railway deployment config
# Clone
git clone https://github.com/casuya-code/casuya-arucase.git
cd casuya-arucase
# Backend
cd backend
npm install
cp .env.example .env # Edit with your DB credentials
npm run dev # http://localhost:5000
# Frontend (new terminal)
cd frontend
npm install
cp .env.example .env # Set VITE_API_URL=http://localhost:5000
npm run dev # http://localhost:3000cd backend
npm run init-db # Create tables
npm run create-admin # Create admin user
npm run db:migrate # Apply versioned migrationsThe project has 102 tests across backend and frontend, all passing.
cd backend && npm testTests use Jest + supertest with a fully mocked database module. Coverage includes:
middleware/auth(12) — requireAuth, requireRole, requirePermission, requireModulemiddleware/cache(7) — cacheMiddleware, clearCache, cacheStatsroutes/auth(9) — login, logout, /me, /presenceroutes/authRefresh(6) — refresh, enhanced login/logoutroutes/systemGrades(3) — grade range, authorizationroutes/cloudinarySignature(3) — validationutils/responseHelper(8) — sendSuccess, sendErrorutils/safeError(8) — production error hidingconfig/database(3) — DatabaseOverloadError
cd frontend && npm testUses Vitest + jsdom. Coverage includes:
utils/i18n(6) — translation keys, createTutils/tokenDecoder(8) — JWT decoding, expiryutils/backendUrl(2) — API URL constantservices/api(7) — axios interceptors, base configcomponents/Loading(6) — spinner variantscomponents/SkeletonLoader(6) — skeleton variants
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/login |
Login with credentials |
| POST | /api/auth/logout |
Invalidate session |
| GET | /api/auth/me |
Get current user |
| POST | /api/auth/refresh |
Refresh JWT token |
| GET | /api/auth/presence/online-count |
Online staff count |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/public/homepage |
Homepage data |
| GET | /api/public/announcements |
Announcements |
| GET | /api/public/events |
Events |
| GET | /api/public/gallery |
Gallery photos |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/admin/users |
List users |
| POST | /api/admin/users |
Create user |
| PUT | /api/admin/users/:id |
Update user |
| DELETE | /api/admin/users/:id |
Delete user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/students |
List students |
| POST | /api/students |
Create student |
| GET | /api/students/:admNo |
Get by admission no |
| PUT | /api/students/:admNo |
Update student |
| DELETE | /api/students/:admNo |
Delete student |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/reports/individual/:form/:stream/:year/:term/:admNo |
Report data (JSON) |
| GET | /.../pdf |
Download PDF |
| GET | /.../csv |
Download CSV |
- Create a PostgreSQL database on Railway
- Deploy the backend service (root dir:
backend)- Environment variables are auto-populated for PostgreSQL
- Configure custom domain (SSL is automatic)
- Connect the GitHub repo to Vercel
- Set root directory to
frontend - Set
VITE_API_URLenvironment variable to your backend URL - Deploy — SSL is automatic
See Railway docs and Vercel docs for detailed instructions.
- JWT authentication with refresh token rotation
- bcrypt password hashing (no plaintext storage)
- Helmet security headers (CSP, HSTS with preload, X-Frame-Options)
- CORS restricted to known origins
- Rate limiting on all API routes
- Input validation with express-validator
- SQL injection prevention via parameterized queries
- Sentry error monitoring (production)
- SRI hash injection on production builds
See CONTRIBUTING.md and CODE_OF_CONDUCT.md.
MIT — 2025 Arusha Catholic Seminary