SMS ERP is a modern, role-based Student Management ERP built with Next.js, TypeScript, MongoDB, and Prisma. It helps institutes and training teams run admissions, mentoring, batch operations, mission tracking, and stakeholder dashboards from one system.
This repository is designed for teams that need a production-ready foundation for an education CRM/ERP with clean architecture, secure authentication flows, and scalable API patterns.
SMS ERP is focused on real operational needs:
- Centralized user and role management for
ADMIN,MANAGER,DEVELOPER,SRE,MENTOR, andSTUDENT - Structured academic delivery through batches and missions
- Role-specific dashboard experiences
- Secure credential-based authentication APIs
- MongoDB data model with Prisma for maintainability and speed
If you are looking for a Student Management System, Education ERP, Mentorship Management Platform, or Training Operations Dashboard, this project gives you a strong starting point.
- Role-based user model with status tracking
- Authentication APIs (
register,login,change-password) - First-login password update flow
- Modular service layer via
src/lib - Prisma schema for users, profiles, batches, missions, and junction relationships
- Dashboard routes for each role
- Cloudinary-ready configuration for media workflows
- Email configuration layer for notification workflows
- Next.js 15 (App Router)
- React 19
- TypeScript
- Prisma ORM
- MongoDB Atlas / MongoDB
- Zustand (state management)
- Tailwind CSS
- Zod + React Hook Form
- ESLint
sms-erp/
prisma/
schema.prisma
scripts/
seed-users.ts
src/
app/
api/
auth/
change-password/route.ts
login/route.ts
register/route.ts
auth/
dashboard/
components/
lib/
prisma.ts
cloudinary.ts
email-config.ts
utils.ts
store/
types/
env.example
package.json
Base path: /api
- Method:
POST - Route:
/api/auth/register - Purpose: Create a new user account with role-based access.
Request body:
{
"name": "John Doe",
"email": "john@example.com",
"password": "StrongPassword123!",
"role": "STUDENT"
}Success response (201):
{
"user": {
"id": "USER_ID",
"name": "John Doe",
"email": "john@example.com",
"role": "STUDENT",
"status": "ACTIVE",
"firstLogin": true,
"createdAt": "2026-02-15T12:00:00.000Z",
"updatedAt": "2026-02-15T12:00:00.000Z"
}
}Common errors:
400Missing required fields / invalid role409User already exists500Registration failed
- Method:
POST - Route:
/api/auth/login - Purpose: Authenticate user with email + password.
Request body:
{
"email": "john@example.com",
"password": "StrongPassword123!"
}Success response (200):
{
"user": {
"id": "USER_ID",
"name": "John Doe",
"email": "john@example.com",
"role": "STUDENT",
"status": "ACTIVE",
"firstLogin": true,
"createdAt": "2026-02-15T12:00:00.000Z",
"updatedAt": "2026-02-15T12:00:00.000Z"
},
"firstLogin": true
}Common errors:
400Email and password are required401Invalid credentials / inactive account500Internal server error
- Method:
POST - Route:
/api/auth/change-password - Purpose: Force first-time password update or regular password change.
Request body:
{
"email": "john@example.com",
"currentPassword": "OldPassword123!",
"newPassword": "NewStrongPassword123!"
}Success response (200):
{
"message": "Password changed successfully",
"user": {
"id": "USER_ID",
"name": "John Doe",
"email": "john@example.com",
"role": "STUDENT",
"status": "ACTIVE",
"firstLogin": false,
"createdAt": "2026-02-15T12:00:00.000Z",
"updatedAt": "2026-02-15T12:10:00.000Z"
}
}Common errors:
400Missing required fields401Current password incorrect404User not found500Internal server error
- Registration with role validation
- Secure password hashing (
bcryptjs) - Login with credential verification
- First-login password-change enforcement
- User status checks (
ACTIVE,BANNED,DELISTED,INACTIVE)
- Dedicated dashboard routes for:
ADMINMANAGERDEVELOPERSREMENTORSTUDENT- Context-specific views and workflows by role
- User identity + role model
- Student, Mentor, and SRE profile extensions
- Batch management with lifecycle statuses
- Mission tracking under batches
- Junction relations:
- Student-Batch mapping
- Student-Mission mapping
- Mission-Mentor assignment
- App Router architecture with modular pages
- Typed form handling with
react-hook-form+zod - Global state management with Zustand
- Reusable components and utility-first styling
- Cloudinary env-driven configuration for media uploads
- Email env-driven configuration for operational notifications
- External API placeholders for future integrations
- Type-safe codebase with TypeScript
- Prisma schema as single source of truth for data
- Linting and production build validation via npm scripts
- Seed script for rapid local/demo data bootstrapping
- Node.js 18.18+ (recommended: Node.js 20 LTS)
- npm 9+
- MongoDB connection string (local or Atlas)
Create a .env.local file in the project root.
Use env.example as the template and set all required values:
DATABASE_URL
NEXTAUTH_URLNEXTAUTH_SECRETJWT_SECRET
EMAIL_SERVICEEMAIL_USEREMAIL_PASSWORDEMAIL_FROM_NAMEADMIN_EMAIL
NEXT_PUBLIC_CLOUDINARY_CLOUD_NAMECLOUDINARY_API_KEYCLOUDINARY_API_SECRET
EXTERNAL_API_URLEXTERNAL_API_KEY
Important:
- Never commit real secrets to Git.
- Use strong random values for all secrets.
- In production, define env vars in your hosting provider dashboard.
- Install dependencies:
npm install- Configure environment:
cp env.example .env.local
# Then edit .env.local- Generate Prisma client:
npx prisma generate- Push schema to database:
npx prisma db push- (Optional) Seed demo users:
npm run seed- Start the dev server:
npm run dev- Open the app:
Run these checks before every deployment:
npm run lint
npm run buildIf both pass, the codebase is build-ready.
- Push code to GitHub/GitLab/Bitbucket.
- Import repository in Vercel.
- Add all required environment variables from your
.env.local. - Set
NEXTAUTH_URLto your production domain. - Deploy.
- After deploy, verify auth APIs and database connectivity.
- Build the project:
npm install
npm run build- Configure production env vars on the server.
- Start app:
npm run start- Run behind reverse proxy (Nginx/Caddy) with HTTPS.
npm run dev- Run local development servernpm run build- Create production buildnpm run start- Start production servernpm run lint- Run ESLint checksnpm run seed- Seed database with sample users
Before going live:
- Rotate and secure all secrets
- Set a valid production
NEXTAUTH_URL - Use strong email app password (not plain personal password)
- Restrict MongoDB network access and database user permissions
- Enable HTTPS on production domain
- Remove unused placeholder environment variables
SMS ERP is built for:
- EdTech startups
- Coaching institutes
- Mentorship programs
- Internal training teams
- Bootcamps and academy operations
It provides a practical base for scaling from an MVP to a full Student ERP with analytics, workflows, and automation.
MIT License