# rajit-d/planet-interview architecture

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

- Interactive diagram: https://gitdiagram.com/rajit-d/planet-interview
- Repository: https://github.com/rajit-d/planet-interview

## Overview

##### Main Components

Frontend Layer:
- Client-Side Components (React/Next.js)
- Public Pages (Home, Sign In/Up)
- Admin Dashboard
- Candidate Interface
- Form Management
- Server Components (Next.js App Router)
- API Routes

Backend Layer:
- Authentication System (NextAuth.js)
- Database Layer (Prisma ORM)
- External Services (Supabase)

##### Key Relationships to Highlight

- Client → API Routes
- API Routes → Database
- Authentication Flow
- Server Actions → Database

##### Component Relationships

- Admin dashboard → Role management
- Candidate forms → Database storage
- Authentication → Protected routes
- API endpoints → Database operations

##### Technical Stack Indicators

Technology badges for:
- Next.js
- Prisma
- NextAuth
- Supabase
- Tailwind CSS

##### Additional Elements

- Error handling flows
- Caching mechanisms
- Build/deploy pipeline

- The separation of admin and candidate interfaces
- The role-based access control system
- The form handling mechanism
- The authentication flow
- The database schema and relationships

Remember to include notes about:
- The app directory structure following Next.js 13+ conventions
- The use of dynamic routes ([orgId], [roleId], etc.)
- The integration of UI components with server-side logic
- The authentication and session management system

This will provide a comprehensive view of the application's architecture while maintaining clarity for other developers who need to understand the system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Frontend Layer"
        PublicPages["Public Pages"]:::frontend
        AdminDash["Admin Dashboard"]:::frontend
        CandidateInt["Candidate Interface"]:::frontend
        SharedComp["Shared Components"]:::frontend
    end

    subgraph "Server Layer"
        ServerActions["Server Actions"]:::server
        APIRoutes["API Routes"]:::api
        AuthSystem["Authentication System"]:::auth
    end

    subgraph "Data Layer"
        PrismaORM["Prisma ORM"]:::database
        Database[(Database)]:::database
        Supabase["Supabase"]:::external
    end

    %% Component Relationships
    PublicPages --> AuthSystem
    AdminDash --> ServerActions
    CandidateInt --> ServerActions
    ServerActions --> PrismaORM
    APIRoutes --> PrismaORM
    AuthSystem --> APIRoutes
    PrismaORM --> Database
    PrismaORM --> Supabase

    %% Component Details
    PublicPages --> |"Sign In/Up"| AuthSystem
    AdminDash --> |"Role Management"| ServerActions
    CandidateInt --> |"Form Submission"| ServerActions

    %% Styling
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef server fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#e74c3c,stroke:#c0392b,color:white
    classDef auth fill:#f1c40f,stroke:#f39c12,color:black
    classDef database fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Click Events
    click PublicPages "https://github.com/Rajit-D/planet-interview/blob/main/app/(home)/page.tsx"
    click AdminDash "https://github.com/Rajit-D/planet-interview/blob/main/app/admins/[orgId]/[adminId]/page.tsx"
    click CandidateInt "https://github.com/Rajit-D/planet-interview/blob/main/app/candidate/[roleId]/[candidateId]/page.tsx"
    click AuthSystem "https://github.com/Rajit-D/planet-interview/blob/main/app/api/auth/[...nextauth]/route.ts"
    click ServerActions "https://github.com/Rajit-D/planet-interview/blob/main/app/adminauth/actions.ts"
    click APIRoutes "https://github.com/Rajit-D/planet-interview/blob/main/app/api/candidates/route.ts"
    click PrismaORM "https://github.com/Rajit-D/planet-interview/blob/main/prisma/schema.prisma"
    click Supabase "https://github.com/Rajit-D/planet-interview/blob/main/config/supabase.ts"

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Server["Server Component"]:::server
        API["API Route"]:::api
        Auth["Authentication"]:::auth
        DB["Database"]:::database
        Ext["External Service"]:::external
    end
```
