# zulkifli-dev/full-stack-school architecture

> Architecture diagram of the GitHub repository zulkifli-dev/full-stack-school, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zulkifli-dev/full-stack-school
- Repository: https://github.com/zulkifli-dev/full-stack-school

## Overview

##### Project type and purpose
- This is a full-stack Next.js 13 web application serving as a School Management Dashboard (“Lama Dev School Management Dashboard”).
- It uses the App Router (`src/app/…`), a React component library (`src/components/…`), Prisma ORM (`prisma/`), and Docker for containerization.

##### File structure
- Top-level Docker files: `Dockerfile`, `docker-compose.yml`
- Configuration: ESLint, TypeScript (`tsconfig.json`), Tailwind, PostCSS, Next.js (`next.config.mjs`)
- Database schema & ORM: `prisma/schema.prisma`, migrations, seeds
- Application code:
- Frontend / Server components: `src/app/…` – pages for admin, teacher, student, parent, authentication
- Reusable UI components: `src/components/…`
- Shared logic: `src/lib/…`
- Middleware: `src/middleware.ts` (likely auth enforcement)
- No explicit microservices – a monolithic container comprising frontend and API.

##### README
- Confirms a Next.js development server (`npm run dev`) at port 3000
- No separate service descriptions, implying a single Next.js service connecting to a database.

##### Main components
a. Client Browser
b. Next.js Application Server
- App Router handling routes in `src/app`
- Server Components (data fetching + Prisma calls)
- Client Components (interactive UI from `src/components`)
- Middleware (auth checks)
c. Prisma ORM Layer (`src/lib/prisma.ts`)
d. PostgreSQL database (defined in `docker-compose.yml`)
e. (Optional) Authentication provider—e.g., NextAuth.js or custom sign-in page under `src/app/[[...sign-in]]`
f. Docker Network (orchestration between app and database)

##### Relationships and data flows
- Browser → HTTP request → Next.js Server
- Next.js Server → Middleware → Route Handler / Server Component → Prisma Client
- Prisma Client → SQL queries → PostgreSQL
- Database → query results → Prisma → Server Component → React Component → Browser
- Docker Compose network connects the Next.js container and the database container

##### Architectural patterns and design principles
- Monolith with a clear frontend/backend boundary provided by Next.js
- Component-based UI (atomic and form components under `src/components`)
- Database migrations and seeding via Prisma
- CSS utility classes via Tailwind
- Optional code-split by user role routes ((dashboard)/(admin), (teacher), (student), (parent))

##### Technologies and frameworks
- Next.js 13 (App Router, Server Components)
- React + TypeScript
- Prisma ORM + PostgreSQL
- Tailwind CSS, PostCSS
- Docker & docker-compose
- ESLint, tsconfig

##### Detailed breakdown of components
- Client Browser (HTTP + WebSocket if used in future)
- Next.js App Container
- App Router & Page Structure (`src/app`)
- UI Library (`src/components`)
- Shared logic (`src/lib`)
- Middleware (`src/middleware.ts`)
- Prisma ORM
- PostgreSQL Database
- Docker Compose Network

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client
    Browser["Client Browser"]:::frontend

    %% Infrastructure
    subgraph "Docker Compose Network" 
        direction TB
        WebAppContainer["web-app (Next.js)"]:::backend
        PostgresDB["postgres-db (PostgreSQL)"]:::db
    end

    Browser -->|"HTTP Requests"| WebAppContainer

    %% Next.js App Container Components
    subgraph "Next.js App Container"
        direction TB
        Config["Next.js Config (next.config.mjs)"]:::backend
        Middleware["Middleware (src/middleware.ts)"]:::backend
        Router["App Router (src/app/)"]:::backend
        AuthRoute["Auth Route (src/app/[[...sign-in]]/page.tsx)"]:::backend
        GlobalLayout["Global Layout (src/app/layout.tsx)"]:::backend
        GlobalCSS["Globals CSS (src/app/globals.css)"]:::frontend
        UIComp["UI Components (src/components/)"]:::frontend
        FormComp["Form Components (src/components/forms/)"]:::frontend
        SharedLogic["Shared Logic (src/lib/)"]:::backend
        PrismaClient["Prisma ORM (src/lib/prisma.ts)"]:::backend

        Config --> Router
        Middleware --> Router
        Router --> AuthRoute
        Router --> GlobalLayout
        Router --> UIComp
        UIComp --> FormComp
        Router --> SharedLogic
        SharedLogic --> PrismaClient
        Router --> PrismaClient
    end

    WebAppContainer -->|"Serves App"| Router
    Router -->|"Uses ORM"| PrismaClient

    %% Database Layer
    subgraph "Database Layer"
        direction TB
        PostgresDB
        Schema["Schema (prisma/schema.prisma)"]:::db
        Migrations["Migrations (prisma/migrations/)"]:::db
        Seed["Seed Script (prisma/seed.ts)"]:::backend
        PrismaClient -->|"SQL Queries"| PostgresDB
        PostgresDB -->|"Query Results"| PrismaClient
        Schema --> PostgresDB
        Migrations --> PostgresDB
        Seed --> PostgresDB
    end

    WebAppContainer -->|"Docker Compose"| PostgresDB

    %% Additional Config Files
    TSConfig["TypeScript Config (tsconfig.json)"]:::infra
    ESLint["ESLint Config (.eslintrc.json)"]:::infra
    Tailwind["Tailwind Config (tailwind.config.ts)"]:::infra
    PostCSS["PostCSS Config (postcss.config.mjs)"]:::infra
    PublicAssets["Public Assets (public/)"]:::infra

    WebAppContainer --> TSConfig
    WebAppContainer --> ESLint
    WebAppContainer --> Tailwind
    WebAppContainer --> PostCSS
    WebAppContainer --> PublicAssets

    %% Dashboard Pages
    subgraph "Dashboard Pages (src/app/(dashboard)/)"
        direction TB
        DashboardLayout["Layout (src/app/(dashboard)/layout.tsx)"]:::backend
        AdminPage["Admin (src/app/(dashboard)/admin/page.tsx)"]:::backend
        TeacherPage["Teacher (src/app/(dashboard)/teacher/page.tsx)"]:::backend
        StudentPage["Student (src/app/(dashboard)/student/page.tsx)"]:::backend
        ParentPage["Parent (src/app/(dashboard)/parent/page.tsx)"]:::backend
        ListPages["List Pages (src/app/(dashboard)/list/)"]:::backend

        Router --> DashboardLayout
        DashboardLayout --> AdminPage
        DashboardLayout --> TeacherPage
        DashboardLayout --> StudentPage
        DashboardLayout --> ParentPage
        DashboardLayout --> ListPages
    end

    %% Click Events
    click WebAppContainer "https://github.com/zulkifli-dev/full-stack-school/tree/main/Dockerfile"
    click Browser "https://github.com/zulkifli-dev/full-stack-school/blob/main/docker-compose.yml"
    click Config "https://github.com/zulkifli-dev/full-stack-school/blob/main/next.config.mjs"
    click Router "https://github.com/zulkifli-dev/full-stack-school/tree/main/src/app/"
    click AuthRoute "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/app/[[...sign-in]]/page.tsx"
    click GlobalLayout "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/app/layout.tsx"
    click GlobalCSS "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/app/globals.css"
    click UIComp "https://github.com/zulkifli-dev/full-stack-school/tree/main/src/components/"
    click FormComp "https://github.com/zulkifli-dev/full-stack-school/tree/main/src/components/forms/"
    click SharedLogic "https://github.com/zulkifli-dev/full-stack-school/tree/main/src/lib/"
    click PrismaClient "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/lib/prisma.ts"
    click Schema "https://github.com/zulkifli-dev/full-stack-school/blob/main/prisma/schema.prisma"
    click Migrations "https://github.com/zulkifli-dev/full-stack-school/tree/main/prisma/migrations/"
    click Seed "https://github.com/zulkifli-dev/full-stack-school/blob/main/prisma/seed.ts"
    click TSConfig "https://github.com/zulkifli-dev/full-stack-school/blob/main/tsconfig.json"
    click ESLint "https://github.com/zulkifli-dev/full-stack-school/blob/main/.eslintrc.json"
    click Tailwind "https://github.com/zulkifli-dev/full-stack-school/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/zulkifli-dev/full-stack-school/blob/main/postcss.config.mjs"
    click PublicAssets "https://github.com/zulkifli-dev/full-stack-school/tree/main/public/"
    click DashboardLayout "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/app/(dashboard)/layout.tsx"
    click AdminPage "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/app/(dashboard)/admin/page.tsx"
    click TeacherPage "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/app/(dashboard)/teacher/page.tsx"
    click StudentPage "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/app/(dashboard)/student/page.tsx"
    click ParentPage "https://github.com/zulkifli-dev/full-stack-school/blob/main/src/app/(dashboard)/parent/page.tsx"
    click ListPages "https://github.com/zulkifli-dev/full-stack-school/tree/main/src/app/(dashboard)/list/"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#000,stroke-width:1px
    classDef db fill:#FFA500,stroke:#000,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#000,stroke-width:1px
```
