A RESTful School Management System API built on the Axion microservice boilerplate. Manages Schools, Classrooms, and Students with JWT-based authentication and role-based access control (RBAC).
This project follows Axion's convention-based architecture:
- Managers (
managers/entities/) — Business logic for each entity - Middlewares (
mws/) — Authentication and authorization pipeline - Models (
*.mongoModel.js) — Mongoose schemas for MongoDB persistence - Validators (
*.schema.js) — Input validation usingqantra-pineapple - Loaders (
loaders/) — Dependency injection and auto-discovery system
- Runtime: Node.js + Express
- Database: MongoDB (Mongoose ODM)
- Cache/Bus: Redis (ioredis + ion-cortex)
- Auth: JWT (jsonwebtoken) + bcrypt
- Security: helmet, express-rate-limit, CORS
- Validation: qantra-pineapple
- Node.js >= 14
- MongoDB (local or MongoDB Atlas)
- Redis (local or Redis Cloud)
# Clone the repository
git clone https://github.com/taiwoak/axion.git
cd axion
# Install dependencies
npm install
# Create environment file
cp .env.example .env
# Edit .env with your MongoDB URI, Redis URI, and secrets| Variable | Description | Required |
|---|---|---|
MONGO_URI |
MongoDB connection string | Yes |
REDIS_URI |
Redis connection string | Yes |
CORTEX_REDIS |
Redis for inter-service bus | Yes |
CACHE_REDIS |
Redis for caching | Yes |
LONG_TOKEN_SECRET |
JWT secret for long-lived tokens | Yes |
SHORT_TOKEN_SECRET |
JWT secret for short-lived tokens | Yes |
NACL_SECRET |
Secret for symmetric encryption | Yes |
USER_PORT |
HTTP server port (default: 5111) | No |
# Start the server
npm start
# The server starts on the configured USER_PORT (default: 5111)- Register a superadmin —
POST /api/user/register(public, no auth needed) - Login —
POST /api/user/login→ receive alongToken - Get a short token —
POST /api/token/v1_createShortToken(withlongTokenin header) → receiveshortToken - Use the API — include
token: <shortToken>in headers for all authenticated endpoints
npm testAll API requests go through: POST /api/:moduleName/:fnName
| Role | Permissions |
|---|---|
| Superadmin | Full system access — manages schools, creates school administrators |
| School Admin | Manages classrooms and students within their assigned school only |
| Module | Function | Auth | Description |
|---|---|---|---|
user |
register |
Public | Register a new superadmin |
user |
login |
Public | Login (any role) |
user |
createUser |
Superadmin | Create a school administrator |
token |
v1_createShortToken |
Long Token | Exchange long token for short token |
school |
createSchool |
Superadmin | Create a school |
school |
getSchools |
Authenticated | List schools |
school |
getSchool |
Authenticated | Get school by ID |
school |
updateSchool |
Superadmin | Update a school |
school |
deleteSchool |
Superadmin | Delete a school |
classroom |
createClassroom |
Admin+ | Create a classroom |
classroom |
getClassrooms |
Authenticated | List classrooms |
classroom |
getClassroom |
Authenticated | Get classroom by ID |
classroom |
updateClassroom |
Admin+ | Update a classroom |
classroom |
deleteClassroom |
Admin+ | Delete a classroom |
student |
createStudent |
Admin+ | Enroll a student |
student |
getStudents |
Authenticated | List students |
student |
getStudent |
Authenticated | Get student by ID |
student |
updateStudent |
Admin+ | Update a student profile |
student |
deleteStudent |
Admin+ | Remove a student |
student |
transferStudent |
Admin+ | Transfer student to different classroom/school |
See API_DOCUMENTATION.md for full request/response details.
┌──────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ School │ │ Classroom │ │ Student │
├──────────────┤ ├──────────────────┤ ├──────────────────┤
│ _id │◄────│ school (FK) │ │ _id │
│ name │ │ _id │◄────│ classroom (FK) │
│ address │ │ name │ │ school (FK) ────┤►
│ phone │ │ capacity │ │ firstName │
│ email │ │ resources[] │ │ lastName │
│ createdAt │ │ createdAt │ │ email │
│ updatedAt │ │ updatedAt │ │ dateOfBirth │
└──────────────┘ └──────────────────┘ │ enrollmentDate │
▲ │ status │
│ ┌──────────────────┐ │ createdAt │
└──────────────│ school (FK) │ │ updatedAt │
│ User │ └──────────────────┘
├──────────────────┤
│ _id │
│ username │
│ email │
│ password (hash) │
│ role │
│ createdAt │
└──────────────────┘
- Superadmin registration is a public endpoint — any user can register as a superadmin, enabling multiple superadmins to manage the system
- School administrators are created by superadmins and assigned to a specific school
- All API endpoints use POST (Axion's convention) — the request body carries all data
- Student transfer requires specifying both new school and new classroom when moving across schools
- Classroom capacity is strictly enforced when enrolling or transferring students
axion/
├── index.js # Entry point
├── config/ # Configuration
├── connect/ # MongoDB connection
├── cache/ # Redis abstraction
├── loaders/ # DI system (auto-discovery)
├── managers/
│ ├── api/ # Request dispatcher
│ ├── http/ # Express server (rate limiting, helmet)
│ ├── entities/
│ │ ├── user/ # User manager + model + schema
│ │ ├── school/ # School manager + model + schema
│ │ ├── classroom/ # Classroom manager + model + schema
│ │ └── student/ # Student manager + model + schema
│ ├── token/ # JWT token management
│ ├── shark_fin/ # RBAC engine
│ └── ...
├── mws/ # Middleware (auth, device, etc.)
├── static_arch/ # Permission layers
└── tests/ # Test suite
ISC
The School Management System was built by Taiwo Akerele