# yash8202/miniproject-manager architecture

> Architecture diagram of the GitHub repository yash8202/miniproject-manager, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yash8202/miniproject-manager
- Repository: https://github.com/yash8202/miniproject-manager

## Overview

##### Project Type & Purpose
- This is a full-stack web application built with Next.js and React. It is designed to facilitate college mini project management by allowing students to create teams, invite peers, and get mentorship from teachers.
- The README clearly states the system’s aim of managing semester mini projects, and the file tree confirms a client-rendered application (with Next.js “app” folders) that also implements API routes, authentication (via NextAuth under “api/auth”), and database operations via Prisma.

##### File Structure for Architectural Components
- Frontend:
- Located primarily under “src/app” with dedicated subdirectories for authentication (sign-in) and dashboard (components for team creation, student and coordinator pages).
- Backend / API:
- API endpoints are created under “src/app/api” and “src/server/api” – including endpoints for authentication (handled with NextAuth), miniprojects, and sending mails.
- TRPC endpoints are defined in “src/app/api/trpc” and further organized under “src/trpc” for both server and client-side integration.
- Database:
- The “prisma” directory holds the database schema (schema.prisma) and migration scripts (with several migration folders), suggesting the use of a PostgreSQL database (as mentioned in the prerequisites).
- External integrations:
- Dependencies include NextAuth (for Google authentication), Prisma (for ORM), Tailwind CSS (for UI styling), and email sending via Resend.
- Docker Support:
- Presence of “docker-compose.yml” suggests containerized deployment, which may also include a container for database or the application itself.

##### Key Components
- Desktop/Web Client (Browser):
- Represents the user’s browser which loads the Next.js front-end UI.
- Next.js Frontend:
- Responsible for rendering pages (pages for auth, dashboard, teams, etc.), components, and UI interactions.
- Next.js API / Backend Server:
- Contains two layers:
º Standard API routes (e.g., “/api/auth”, “/api/miniproject”, “/api/send-mail”) for specific endpoints.
º TRPC router routes for data fetching and manipulation.
- Handles user authentication (including Google login using NextAuth) and server-side business logic.
- Database Service (PostgreSQL):
- Managed via Prisma. Show a connection from backend API modules to the database, and annotate “Prisma Client” usage.
- External Services:
- Google: For authentication/authorization.
- Resend: For sending emails (invite functionality, team notifications).
- Infrastructure/Deployment:

##### How Components Interact (Relationships and Data Flow)
- The Browser issues HTTP/HTTPS requests to the Next.js Frontend.
- The Frontend serves dynamic pages and interacts with the Next.js Backend via API endpoints and TRPC calls.
- The API layer processes requests:
- For authentication, it communicates with external services (Google, Resend) and relies on NextAuth.
- For data management, it uses Prisma to interact with the PostgreSQL database.
- Data flows from client to API routes,
- API routes to the database,
- And from API to external services for authentication (Google) and notifications (Resend).

##### Architectural Patterns and Design Principles
- Separation between UI and backend business logic (frontend “app” vs. API routes).
- Use of modular routing, with a clear distinction between the authentication module, team management, and mentor assignment.
- Use of TRPC providing type-safe API communication between client and server.
- Standard MVC-like separation found in Next.js applications with a clear routing (“app” folder structure).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    Browser["Browser/Client"]:::frontend

    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Next.js Frontend (React/Next.js)"]:::frontend
        Auth["Authentication Module"]:::frontend
        Dash["Dashboard & Team Management UI"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        API["API Routes (NextAuth, MiniProject, SendMail)"]:::backend
        TRPC["TRPC Endpoints"]:::backend
    end

    %% Database Layer
    Database["PostgreSQL Database (Prisma)"]:::database

    %% External Services
    subgraph "External Services"
        Google["Google Authentication"]:::external
        Resend["Resend Email Service"]:::external
        EmailTemplates["Email Templates"]:::external
    end

    %% Containerization
    Docker["Docker Container (docker-compose)"]:::container

    %% Connections
    Browser -->|"HTTPRequest"| FE
    FE -->|"AuthRequest"| Auth
    FE -->|"UIInteraction"| Dash
    FE -->|"APIRequest"| API

    API -->|"DBQuery"| Database
    TRPC -->|"RPCQuery"| Database

    API -->|"OAuthFlow"| Google
    API -->|"EmailNotify"| Resend
    API -->|"TemplateLookup"| EmailTemplates

    Docker ---|"Hosts"| FE
    Docker ---|"Hosts"| API
    Docker ---|"Hosts"| Database

    %% Click Events
    click FE "https://github.com/yash8202/miniproject-manager/tree/main/src/app"
    click Auth "https://github.com/yash8202/miniproject-manager/tree/main/src/app/(auth)"
    click Dash "https://github.com/yash8202/miniproject-manager/tree/main/src/app/(dashboard)"
    click API "https://github.com/yash8202/miniproject-manager/tree/main/src/app/api"
    click TRPC "https://github.com/yash8202/miniproject-manager/tree/main/src/app/api/trpc"
    click Database "https://github.com/yash8202/miniproject-manager/tree/main/prisma"
    click EmailTemplates "https://github.com/yash8202/miniproject-manager/tree/main/src/components/mail-templates"
    click Docker "https://github.com/yash8202/miniproject-manager/blob/main/docker-compose.yml"

    %% Additional backend API mapping for authentication
    click API "https://github.com/yash8202/miniproject-manager/tree/main/src/app/api/auth"

    %% Additional TRPC mapping
    click TRPC "https://github.com/yash8202/miniproject-manager/tree/main/src/trpc"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef database fill:#DDA0DD,stroke:#000,stroke-width:2px;
    classDef external fill:#FFA500,stroke:#000,stroke-width:2px;
    classDef container fill:#C0C0C0,stroke:#000,stroke-width:2px;
```
