How bilal-pasha/student-sport-registration-app works
Main Components
• Frontend Client – built with React/Next.js and styled with Tailwind CSS. This includes pages under src/app (with public and protected sections), reusable components (under src/components), and utility hooks and helpers.
• Backend API Routes – located under src/app/api. These endpoints handle functionalities such as madrasas registration, student management (add, update, delete), authentication (NextAuth routes, signup routes), and additional endpoints for filtering data and updating statuses.
• Database – MongoDB is used to store data like user details, madrasas registration, student records, and roles.
• Authentication Service – NextAuth integration to support Google, GitHub, and custom credentials with secure password hashing using bcryptjs.
• External Integrations – Vercel for hosting and deployment, along with third-party authentication providers (Google, GitHub).
Relationships and Data Flow
• The Frontend Client communicates with the API Routes through HTTP requests (i.e., RESTful endpoints).
• API Routes act as the intermediary between the frontend and the database by handling business logic, data retrieval, and security (authentication and authorization).
• NextAuth across API endpoints manages session handling and role-based access control, splitting the application into public and protected routes.
• Components render UI elements that trigger API calls for CRUD operations on madrasas, students, and authentication events.
• External Services (like Vercel’s CI/CD and deployment pipelines) facilitate a smooth deployment process, while authentication providers integrate for sign-in functionalities.
Architectural Patterns and Important Details
• Full-Stack Separation: The design clearly separates the client (pages and UI components) from the backend API logic.
• Role-based Access Control: Different UI sections and API endpoints exist for public versus protected content, indicating segregation based on user roles (e.g., normal users vs. admins).
• Modular Design: The project emphasizes modularity by organizing code into directories for components, API routes, hooks, utilities, and context.
• Use of Next.js App Router: Highlights server-side rendering, static asset management, and file-based routing.
• Data Flow and Services: Include endpoints for operations like “add”, “update”, “delete” on student and madrasas data.