How vaaditya320/track-lab works
Main Components
• Frontend (User Interface):
• Represented by the Next.js “app” directory. This contains public pages (e.g., app/page.js, app/projects, app/auth pages), components (e.g., DashboardSkeleton.jsx, ParticleBackground.js, ProjectStatsCard.jsx), theme files (trackLabTheme.js), and global layout files.
• It handles the UI rendering using Material UI, Framer Motion, and Tailwind CSS.
• Backend API Layer:
• Located in the “app/api” directory. Here, different endpoints are segmented by function:
▪ Authentication: app/api/auth/[...nextauth] routes using NextAuth for Google OAuth2 authentication.
▪ Projects: Routes handling project creation, updates, downloads, and completion (e.g., /api/projects/[id]/…).
▪ Admin: Separate endpoints for managing users, projects, and user roles.
▪ Students: Endpoints for student-related data.
• These endpoints provide CRUD operations and handle business logic.
• Database:
• PostgreSQL is the database used, with Prisma ORM managing the interactions.
• The “prisma” directory (schema.prisma & migrations) defines the database schema and migrations.
• External Services:
• Google OAuth2: Used for authentication.
• Email Notifications: Using Nodemailer for sending emails.
• PDF Generation: Through pdf-lib.
• AWS S3: Marked as planned for future storage integration.
• Google Analytics: Included via a component in the “utils” directory.
• Administration Panel:
• Found under app/admin, offering dedicated pages for managing projects, user roles, and users.
• It interacts with both the frontend UI and backend API routes.
Relationships and Interactions
• The browser (client) sends requests to the Next.js frontend, which renders pages based on the “app” structure.
• User interactions (like logging in, project submission, etc.) trigger API calls via endpoints in the “app/api” folder.
• The API layer communicates with the PostgreSQL database via Prisma.
• Authentication flows are managed by NextAuth connecting through the designated auth API endpoints with Google OAuth2.
• When projects are submitted or their status changes, associated modules trigger PDF generation and email notifications.
• The Admin Panel accesses both the API endpoints and UI components to provide an overview and management capabilities.
• Planned integrations (AWS S3) suggest that if file uploads or storage are needed, there will be additional interactions with S3.
Architectural Patterns and Technologies
• This project follows a Next.js App Router architecture separating frontend and backend API logic.
• It adheres to common full-stack design practices: a clear separation of concerns (UI vs. API vs. Database) and modular components.
• The use of Prisma ensures ORM-based, type-safe database interactions.
• Authentication is centralized via NextAuth, promoting secure access across both user-facing and admin routes.
• The integration of Material UI, Framer Motion, and Tailwind CSS enhances the frontend experience, while a standardized API layer simplifies backend services.