How busdtswim/brandeisswim works
• Frontend/UI Layer:
• Next.js “app” folder that is subdivided into different routes/pages (e.g., public pages, admin, customer, login, register, etc.).
• Modular components in src/components (such as AdminDashboard, CustomerDashboard, AddInstructors, ContentEditor, and so on).
• Shared assets like fonts, global styles (src/app/globals.css, src/style), and page layouts.
• API / Backend Layer:
• API routes under src/app/api which define endpoints for authentication (login, logout, register, reset-password, etc.), administrative actions (lesson creation, content management, stats, etc.), customer functionalities (schedule and profile management), and additional services like contact forms.
• Authentication subdirectories (like auth, auth/admin, auth/customer, auth/lessons, etc.), indicating that the API layer is organized by role (admin versus customer) and by function (content, schedule, lesson register).
• Database Layer:
• Prisma integration (prisma/schema.prisma) which serves as the data model and interacts with the underlying database.
• Middleware & Utility Layers:
• Middleware (src/middleware.js) that likely handles request-level processing (e.g., authentication, logging, error handling).
• Utility libraries (src/lib and src/utils) that encapsulate common functions such as date, time, and formatting utilities.
Relationships and Data Flow
• The backend layer processes these requests, applies necessary business logic, and accesses the database (via Prisma).
• Middleware intercepts and processes requests if needed before they hit the API route handlers.
• For instance, an admin user managing lessons: The Admin Dashboard (component) interacts with the API endpoints under “auth/admin/lessons” to create, update, or delete lessons.
• A customer user booking a lesson: The UI triggers API calls (under “auth/customer/schedule”) which in turn query/update the database.
Important Architectural Patterns and Design Principles
• Next.js Routes and File-based Routing: Emphasize how the project utilizes Next.js’ file structure for routing based on directory organization.
• Separation of Concerns: Illustrate how the system separates frontend (UI and components), backend (API routes), and data persistence (Prisma-based DB layer).
• Role-Based Access: Note the distinction between admin and customer endpoints, indicating a layered security or permissions model.
• Modularization: The component breakdown (e.g., separate components for AdminSideBar, Header, Footer) shows a clean, maintainable separation in the UI, while logical grouping in the API endpoints mirrors business domains.