geocrop-platform./apps/nextgen/README.md

79 lines
2.8 KiB
Markdown

# Africa Alert - Smart School PWA
Modern React PWA school management system with Node.js backend, containerized for easy Docker deployment.
## Features
- 📱 **Progressive Web App** - Installable on any device, works offline
- 🐳 **One-Click Docker Setup** - Single `docker-compose up` to get started
- 👨‍🎓 **Student Management** - Enrollment, profiles, attendance
- 👩‍🏫 **Teacher Management** - Staff profiles, assignments
- 📚 **Class Management** - Subjects, schedules, grading
- 💰 **Fee Management** - Invoices, payments, reporting
- 📊 **Dashboard** - Real-time analytics and insights
## Quick Start
```bash
# Clone and start
cd africa-alert-pwa
docker-compose up -d
# Access the app at http://localhost:3000
```
## Tech Stack
- **Frontend**: React 18 + Vite + TypeScript
- **Backend**: Node.js + Express
- **Database**: SQLite (file-based, easy backups)
- **Container**: Docker + Docker Compose
## Project Structure
```
africa-alert-pwa/
├── client/ # React frontend
├── server/ # Node.js backend
├── docker-compose.yml
├── Dockerfile.client
└── Dockerfile.server
```
## Development
```bash
# Frontend (client folder)
cd client && npm install && npm run dev
# Backend (server folder)
cd server && npm install && npm run dev
# Docker
docker-compose up --build
```
## Default Login
- **Admin**: admin@school.com / admin123
## Production deployment security checklist
Before going live, ensure every item below is set. The server will **refuse to start** in production (`NODE_ENV=production`) if any of the required items are missing.
- [ ] **`NODE_ENV=production`** is set in the environment
- [ ] **`JWT_SECRET`** is set to a 48-byte random value. Generate one with:
```bash
node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"
```
- [ ] **`ALLOWED_ORIGINS`** is set to the school domain only (comma-separated if multiple). Example: `ALLOWED_ORIGINS=https://school.example.com`
- [ ] **`DB_PATH`** points to a persistent volume mount, not `./data/school.db` in a transient container
- [ ] **`ALLOW_CLIENT_OFFLINE_MINT`** is set to `false` unless you specifically need offline auth. The dev default is `true` so the offline flow can be tested.
- [ ] **PAYNOW_*** env vars are set if the school is collecting fees. Sync will no-op without `SUPABASE_*` env vars.
- [ ] No `.env` file is committed to git. The repo's `.gitignore` covers it.
- [ ] A SQLite backup cron is running (every 12h) to defend against power-loss corruption during load-shedding
- [ ] The Docker compose mounts `data/`, `uploads/`, and `backups/` as named volumes, not bind mounts
## Environment variables reference
See `server/.env.example` for the full list with comments. The required-in-prod set is enforced by `server/src/config/index.js` — the server crashes with a FATAL log line if any are missing.