# ayushk-1801/universe architecture

> Architecture diagram of the GitHub repository ayushk-1801/universe, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ayushk-1801/universe
- Repository: https://github.com/ayushk-1801/universe

## Overview

##### Main Components

A. Frontend Layer:
- Client-Side Components
- Auth Routes (/signin, /signup)
- Professor Routes (/inbox, /post)
- Student Routes (/home, /proposal, /resources)
- Shared Components (Navbar, PostCards, Sidebar)
- UI Components Library

B. Backend Layer:
- API Routes
- Authentication System (NextAuth)
- Professor API endpoints
- Student API endpoints
- Search functionality

C. Database Layer:
- Prisma ORM
- Database Tables (visible from migrations):
- Users (Students/Professors)
- Posts
- Proposals

**┌─────────────────────────────────────┐**
- Client Layer             │
- (Next.js Pages & Components)       │
- ┘
- ↕
**┌─────────────────────────────────────┐**
- API Layer                │
- (Next.js API Routes & Middleware)  │
- ┘
- ↕
**┌─────────────────────────────────────┐**
- Database Layer             │
- (Prisma ORM & Database)         │
- ┘

##### Detailed Component Breakdown

A. Client Layer (Blue):
- Auth Section (/signin, /signup)
- Professor Dashboard
- Student Dashboard
- UI component library as a separate module

B. API Layer (Green):
- Related API endpoints:
- Auth API routes
- Professor-specific routes
- Student-specific routes
- Search functionality
- Middleware connections

C. Database Layer (Orange):
- Main database tables
- Prisma ORM as an intermediate layer
- Relationships between tables

##### Additional Elements

- Version information for major dependencies
- External service integrations
- Development vs production environments

##### Flow Indicators

- Authentication checks
- API request/response paths
- Demonstrate user role transitions

Remember to include:
- Environment configurations
- Authentication flow
- Database migrations
- API route grouping
- Component hierarchy
- Role-based access control
- Docker container boundaries

This will provide a clear understanding of the application's architecture while maintaining the necessary level of detail for a principal software engineer to understand the system's complete structure and flow.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        direction TB
        Auth["Authentication Routes"]
        ProfDash["Professor Dashboard"]
        StudDash["Student Dashboard"]
        
        subgraph SharedComp["Shared Components"]
            direction TB
            Nav["Navigation Bar"]
            Side["Sidebar"]
            Post["Post Cards"]
            AuthComp["Auth Component"]
            
            subgraph UI["UI Component Library"]
                UIElements["UI Elements"]
            end
        end
    end
    
    subgraph API["API Layer"]
        direction TB
        AuthAPI["Authentication API"]
        ProfAPI["Professor API"]
        StudAPI["Student API"]
        SearchAPI["Search API"]
        Mid["Middleware"]
    end
    
    subgraph DB["Database Layer"]
        direction TB
        Prisma["Prisma ORM"]
        Schema["Database Schema"]
        Migrations["Database Migrations"]
        
        subgraph Tables
            Users["Users Table"]
            Posts["Posts Table"]
            Proposals["Proposals Table"]
        end
    end
    
    %% Connections
    Auth --> AuthAPI
    ProfDash --> ProfAPI
    StudDash --> StudAPI
    Client --> SearchAPI
    AuthAPI --> Prisma
    ProfAPI --> Prisma
    StudAPI --> Prisma
    SearchAPI --> Prisma
    Mid --> API
    Prisma --> Tables
    
    %% Click events
    click Auth "https://github.com/ayushk-1801/universe/tree/main/app/(auth)/"
    click ProfDash "https://github.com/ayushk-1801/universe/tree/main/app/(home)/(professor)/"
    click StudDash "https://github.com/ayushk-1801/universe/tree/main/app/(home)/(student)/"
    click SharedComp "https://github.com/ayushk-1801/universe/tree/main/components/"
    click UI "https://github.com/ayushk-1801/universe/tree/main/components/ui/"
    click API "https://github.com/ayushk-1801/universe/tree/main/app/api/"
    click AuthAPI "https://github.com/ayushk-1801/universe/tree/main/app/api/auth/[...nextauth]/"
    click ProfAPI "https://github.com/ayushk-1801/universe/tree/main/app/api/professor/"
    click StudAPI "https://github.com/ayushk-1801/universe/tree/main/app/api/student/"
    click SearchAPI "https://github.com/ayushk-1801/universe/tree/main/app/api/search/"
    click Schema "https://github.com/ayushk-1801/universe/blob/main/prisma/schema.prisma"
    click Migrations "https://github.com/ayushk-1801/universe/tree/main/prisma/migrations/"
    click Mid "https://github.com/ayushk-1801/universe/blob/main/lib/middleware.ts"
    click Nav "https://github.com/ayushk-1801/universe/blob/main/components/Navbar.tsx"
    click Side "https://github.com/ayushk-1801/universe/blob/main/components/Sidebar.tsx"
    click Post "https://github.com/ayushk-1801/universe/blob/main/components/PostCards.tsx"
    click AuthComp "https://github.com/ayushk-1801/universe/blob/main/components/Auth.tsx"
    
    %% Styling
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef api fill:#4CAF50,stroke:#2E7D32,color:white
    classDef database fill:#FF9800,stroke:#EF6C00,color:white
    classDef shared fill:#9C27B0,stroke:#6A1B9A,color:white
    
    class Auth,ProfDash,StudDash,SharedComp,UI frontend
    class AuthAPI,ProfAPI,StudAPI,SearchAPI,Mid api
    class Prisma,Schema,Migrations,Tables,Users,Posts,Proposals database
    class Nav,Side,Post,AuthComp,UIElements shared
    
    %% Legend
    subgraph Legend
        Frontend["Frontend Components"]:::frontend
        APIComp["API Components"]:::api
        DBComp["Database Components"]:::database
        SharedComps["Shared Components"]:::shared
    end
```
