# indogegewepe/skripsiku architecture

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

- Interactive diagram: https://gitdiagram.com/indogegewepe/skripsiku
- Repository: https://github.com/indogegewepe/skripsiku

## Overview

##### Project Type and Purpose
This is a full-stack, web-based academic scheduling system (“UAD Course Scheduler”) that exposes a Nuxt.js 3 frontend for administrators to define constraints and view schedules, a FastAPI backend running the Grey Wolf Optimizer (GWO) algorithm to compute timetables, and Supabase (PostgreSQL + RLS) as the persistence layer. It supports dynamic constraint management, real-time validation, analytics, and PDF/Excel export.

##### File Structure Analysis
- Top-level:
– backend/ (FastAPI endpoints, GWO code, models, schemas, scripts, Dockerfile)
– frontend/ (Nuxt.js app with pages, components, composables, config, Dockerfile)
– docker-compose.yml (orchestrates services locally)
– test/ (sample data, notebooks)
- frontend/app: subdivided into pages (CRUD UIs, scheduling, export), components (forms, tables), composables (useApi.ts).
- backend: modules like models.py, schemas.py, routers (inferred), gwo-related scripts (process.py, get_statistics.py), main.py.
- Config: .env templates, Dockerfiles in both frontend & backend, Vercel/Railway JSON.

##### README Insights
- Tech stack:
– Frontend: Nuxt.js 3, Tailwind CSS, Pinia
– Backend: FastAPI, Python 3.11, Uvicorn
– Database: Supabase (PostgreSQL + Row Level Security)
– Optimization: numpy, pandas, custom GWO
– Deploy: Vercel (frontend), Railway (backend)
- Directory hints at supabase/ SQL migrations (triggers, functions).

##### Diagramming the Architecture
a. Main Components
- Client / Presentation Layer: Browser (Vue/Nuxt.js pages, components, Pinia state)
- API Layer: Nuxt server (SSR), useApi composable → HTTP(s)
- Application / Backend Layer: FastAPI app with routers (optimize, get statistics, CRUD), GWO engine module
- Database Layer: Supabase PostgreSQL + RLS + stored functions/triggers
- External Services / Deployment: Vercel (frontend host), Railway (backend host), Docker (local), CI/CD.

b. Relationships & Data Flow
1. User interacts with Nuxt.js UI → HTTP requests via useApi.
2. Requests hit FastAPI endpoints (uvicorn).
3. FastAPI loads dynamic constraints from Supabase (via async client).
4. GWO engine executes (async + parallel), reads/writes intermediate data → persists schedule to Supabase.
5. Backend returns results to frontend; UI renders timetables/heatmaps.
6. Export endpoints generate PDF/Excel on demand (backend → file → client).

c. Architectural Patterns & Principles
- Layered Architecture (presentation, API, business logic, data)
- Single-page app with SSR (Nuxt)
- API-driven micro-layer (FastAPI routers)
- Eventual consistency / async optimization engine
- Infrastructure as code (Docker, docker-compose)
- Separation of concerns: “composables” for data logic, “routers” for endpoints, “gwo” for algorithm.

d. Key Technologies & Libraries
- Vue/Nuxt.js 3 + Tailwind + Pinia
- FastAPI + Uvicorn + Pydantic (schemas)
- PostgreSQL via Supabase (Row Level Security, RPC)
- numpy, pandas for compute
- Docker, docker-compose, Vercel, Railway.

– Browser / UI (Nuxt.js)
– API Layer (FastAPI + routers)
– GWO Engine (async scheduler)
– Supabase DB
– Export Service
– Deployment (Vercel, Railway)
– Solid for sync calls (HTTP)
– Green for Frontend, Blue for Backend, Orange for Database, Gray for Infrastructure
– Rectangles for services/components

##### Detail and Precision
You capture:
– All major endpoints (optimize, get-stats, CRUD)
– The flow of constraint fetching and schedule persistence
– The separation of SSR vs. client-side logic in Nuxt
– Dev vs. prod differences (docker-compose vs. Vercel/Railway)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        BROWSER["Browser UI (Nuxt.js)"]:::frontend
        NUXT_SERVER["Nuxt Server (SSR)"]:::frontend
        USEAPI["useApi Composable"]:::frontend
        NUXT_CONFIG["nuxt.config.ts"]:::frontend
        DOCKER_FRONT["Frontend Dockerfile"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        API_SERVER["FastAPI API (Uvicorn)"]:::backend
        MAIN["main.py"]:::backend
        MODELS["models.py"]:::backend
        SCHEMAS["schemas.py"]:::backend
        DB_CLIENT["Database Client"]:::backend
        GWO["GWO Engine (process.py)"]:::backend
        STATS["Statistics Endpoint (get_statistics.py)"]:::backend
        TIME["Time Helpers (get_time.py)"]:::backend
        EXPORT["Export Module (PDF/Excel)"]:::backend
        DOCKER_BACK["Backend Dockerfile"]:::backend
    end

    %% Database Layer
    DB["Supabase PostgreSQL\n(RLS, SQL functions)"]:::database

    %% Infrastructure
    subgraph "Infrastructure"
        DOCKER_COMPOSE["docker-compose.yml"]:::infra
        VERCEL["Vercel"]:::infra
        RAILWAY["Railway"]:::infra
    end

    %% Data Flows
    BROWSER -->|"SSR Request"| NUXT_SERVER
    BROWSER -->|"API calls (HTTP)"| USEAPI
    NUXT_SERVER -->|"HTTP requests"| API_SERVER
    USEAPI -->|"HTTP requests"| API_SERVER
    API_SERVER -->|"fetch constraints"| DB_CLIENT
    DB_CLIENT -->|"SQL RPC/Triggers"| DB
    API_SERVER -->|"invoke optimization"| GWO
    GWO -->|"persist schedule"| DB_CLIENT
    API_SERVER -->|"generate PDF/Excel"| EXPORT
    EXPORT -->|"response file"| BROWSER
    API_SERVER -->|"retrieve stats"| STATS
    STATS -->|"query"| DB_CLIENT
    DB_CLIENT -->|"SQL RPC/Triggers"| DB
    API_SERVER -->|"time helpers"| TIME

    %% Deployment Links
    DOCKER_COMPOSE --> BROWSER
    DOCKER_COMPOSE --> API_SERVER
    DOCKER_COMPOSE --> DB
    VERCEL -.-> BROWSER
    RAILWAY -.-> API_SERVER

    %% Click Events
    click USEAPI "https://github.com/indogegewepe/skripsiku/blob/master/frontend/app/composables/useApi.ts"
    click NUXT_CONFIG "https://github.com/indogegewepe/skripsiku/blob/master/frontend/nuxt.config.ts"
    click DOCKER_FRONT "https://github.com/indogegewepe/skripsiku/tree/master/frontend/Dockerfile"
    click MAIN "https://github.com/indogegewepe/skripsiku/blob/master/backend/main.py"
    click MODELS "https://github.com/indogegewepe/skripsiku/blob/master/backend/models.py"
    click SCHEMAS "https://github.com/indogegewepe/skripsiku/blob/master/backend/schemas.py"
    click DB_CLIENT "https://github.com/indogegewepe/skripsiku/blob/master/backend/database.py"
    click GWO "https://github.com/indogegewepe/skripsiku/blob/master/backend/process.py"
    click STATS "https://github.com/indogegewepe/skripsiku/blob/master/backend/get_statistics.py"
    click TIME "https://github.com/indogegewepe/skripsiku/blob/master/backend/get_time.py"
    click DOCKER_BACK "https://github.com/indogegewepe/skripsiku/tree/master/backend/Dockerfile"
    click DOCKER_COMPOSE "https://github.com/indogegewepe/skripsiku/blob/master/docker-compose.yml"

    %% Styles
    classDef frontend fill:#b7e4c7,stroke:#2d6a4f,color:#1b4332;
    classDef backend fill:#ade8f4,stroke:#1b4965,color:#1b263b;
    classDef database fill:#ffd6a5,stroke:#b85c38,color:#6a040f;
    classDef infra fill:#e0e0e0,stroke:#636363,color:#212121;
```
