How chawinkn/quaso-grader works
Main Components
• Frontend (User Interface): The bulk of the UI is built in the “src/app” directory. This includes user pages (login, registration, profile, dashboard, scoreboard, submissions, etc.) and admin pages (accessible under the dashboard and in dedicated “components/admin” directories).
• API Endpoints: The “src/app/api” directory organizes serverless functions by domain (e.g., announcements, auth, groups, tasks, submissions, score, etc.). These endpoints act as the backend for the application and handle REST/HTTP requests.
• Authentication Module: Integrated via NextAuth.js and implemented in “src/app/api/auth/[...nextauth]”, this module manages user sessions albeit with a note in the README regarding credential session issues.
• Database Layer: The “prisma” directory contains the Prisma schema, migrations, and a seed script. PostgreSQL is used as the production database and is accessed using the Prisma ORM (with utility functions in “src/lib/prisma.ts”).
• Shared Libraries/Utils: Small utility files, such as those in “src/lib” and “src/utils”, support business logic, session management, validation (using zod), and similar tasks.
• Docker & Deployment: Files like Dockerfile, docker-compose.yml, and .env.example highlight how the app is containerized for easier deployment and consistent environment configuration.
Relationships and Interactions
• The Frontend communicates with the API endpoints provided under “src/app/api”. Data flows bidirectionally via HTTP requests/responses.
• The API endpoints use Prisma as the ORM to interact with a PostgreSQL database. Indicate that the API layer acts as the middleman between the UI and the database.
• NextAuth.js provides authentication by intercepting requests via dedicated API routes and middleware, thus linking user sessions with the database.
• Docker containerization means that the application (possibly including both frontend server and the database) runs in isolated environments which can be depicted as individual containers communicating over defined networks.
• The “components” and “layout” directories in “src” provide reusable UI elements and layouts, reinforcing that the presentation layer is component-driven.
Architectural Patterns and Design Principles
• Separation of Concerns: Clear delineation exists between UI (presentation), API (business logic), and database (data persistence).
• Containerization: Docker files promote a micro-environment approach where local development mimics production setup.
Technologies and Frameworks
• Next.js & React for the UI.
• NextAuth.js for authentication.
• TailwindCSS and shadcn/ui for styling and component structure.
• Prisma as the ORM with PostgreSQL as the underlying database.
• Docker for containerization.