I'll build a School Management SaaS application with dynamic RBAC-based module rendering using Next.js. This is a multi-system project, so let me set up a task list to track progress.
I have the design inspiration and project structure. Let me read the sidebar component since it exists, and then start building the authentication system and RBAC configuration.
I have everything I need. Let me now build the School Management SaaS application with RBAC. I'll start by creating the core authentication system and RBAC configuration.
Now let me move to the next task and build the dynamic sidebar and layout.
Now let me create the role-specific dashboards and update the globals.css with a professional dark theme.
Now let me create sample protected module pages and the login page.
Now let me create the remaining module pages for teacher, student, and parent roles:
Now let me create the login page and update the root layout and main page:
Now let me mark all tasks as done and verify the application is working:
I've successfully built the School Management SaaS application with a complete RBAC system. Here's what was implemented:
Core Architecture:
lib/rbac-config.ts): Defines all 5 roles (Super Admin, School Admin, Teacher, Student, Parent) with their respective modules, permissions, and pathscontexts/auth-context.tsx): Provides login/logout, role checking, and permission validation with demo accounts for testinglib/auth-types.ts): TypeScript types for User, AuthResponse, and AuthStateDynamic UI Components:
components/app-sidebar.tsx): Dynamically renders navigation based on the logged-in user's role - no hardcoded menu itemsapp/dashboard/layout.tsx): Protects routes and redirects unauthorized userscomponents/module-page.tsx): Reusable component that checks permissions and displays module contentRole-Specific Dashboards:
Demo Accounts for Testing:
| Role | Password | |
|---|---|---|
| Super Admin | super@campus.com | super123 |
| School Admin | admin@school.com | admin123 |
| Teacher | teacher@school.com | teacher123 |
| Student | student@school.com | student123 |
| Parent | parent@school.com | parent123 |
You can send messages while the preview loads