# noemie-gyc/skolinvest architecture

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

- Interactive diagram: https://gitdiagram.com/noemie-gyc/skolinvest
- Repository: https://github.com/noemie-gyc/skolinvest

## Overview

##### Project Type & Purpose
- Skolinvest is a full-stack e-learning web application comprised of a Next.js (TypeScript/React) frontend and a Django (Python) backend.
- The goal is to democratize financial education via a client-server architecture, containerized with Docker and coordinated via docker-compose.

##### File Structure Analysis
- Top level:
- BACK/ → Django project “my_docker_django_app” (models, views, serializers, URL routing v1, authentication app, SQLite DB file).
- FRONT/ → Next.js app (“my_front_app”) organized by app/ (routes, layouts, page.tsx), src/components (UI, forms), src/app/api (Next.js Route Handlers), lib utilities, styles, tests (Unit + E2E).
- CI/CD: .github/workflows/*.yml for linting/tests.
- Orchestration: docker-compose.yml, Taskfile.yml.

##### Key Technologies & Patterns
- Backend: Django MVC/MTV pattern, DRF-style serializers, SQLite persistence (no dedicated DB container).
- Frontend: Next.js App Router, React components, file-based routing, serverless route.ts API layer that proxies to Django.
- DevOps: Dockerfiles (frontend & backend), volumes for hot reload, docker-compose network, GitHub Actions pipelines.

##### Main Components & Interactions
a. Client Browser ←→ Frontend Next.js Server
- UI pages & static assets
- Next.js fetches via built-in Route Handlers (/app/api/**)
b. Frontend Route Handlers ←→ Django REST API
- fetchWithAuth.ts calls backend endpoints (e.g. /auth/, /v1/modules, /v1/lessons, /v1/sections)
c. Django App ←→ SQLite Database
- ORM models (Module, Section, Lesson)
- Authentication via custom authentication.py
d. Docker & Network
- frontend container
- backend container
- shared network for HTTP traffic
e. CI/CD Pipeline
- GitHub Actions runs linter.yml (ESLint, pytest), main.yml (build/test).

##### Architectural Patterns & Principles
- Separation of concerns: UI layer (React), API gateway (Next.js routes), business logic (Django), data layer (SQLite).
- File-based routing in Next.js and versioned API in Django (urls/v1).
- Containerization for isolation and reproducible environments.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Client
    Browser["Client Browser"]:::external

    subgraph "Docker Compose Network"
        direction TB
        %% Frontend Container
        subgraph "Frontend Container"
            direction TB
            NextJS["Next.js Server"]:::frontend
            RouteHandlers["Next.js Route Handlers (API Gateway)"]:::frontend
            ReactUI["React UI Components"]:::frontend
            FetchAuth["fetchWithAuth Utility"]:::frontend
            FrontendDockerfile["Frontend Dockerfile"]:::frontend
        end

        %% Backend Container
        subgraph "Backend Container"
            direction TB
            DjangoRoot["Django Project Root"]:::backend
            AuthApp["Django Authentication App"]:::backend
            AuthSerializers["Authentication Serializer"]:::backend
            AuthViews["Auth Views"]:::backend
            AuthURLs["Auth URLs"]:::backend
            Models["Django ORM Models"]:::backend
            CoreSerializers["Django REST Serializers"]:::backend
            CoreViews["Django v1 API Views"]:::backend
            CoreURLs["Django v1 API URLs"]:::backend
            SQLiteDB["SQLite Database"]:::db
            BackendDockerfile["Backend Dockerfile"]:::backend
        end
    end

    %% CI/CD
    CI["GitHub Actions CI/CD"]:::ci

    %% Connections
    Browser -->|"HTTP GET/POST"| NextJS
    NextJS -->|"serves UI pages"| ReactUI
    ReactUI -->|"calls"| RouteHandlers
    RouteHandlers -->|"uses fetchWithAuth"| FetchAuth
    RouteHandlers -->|"Proxy/API call"| CoreURLs
    FetchAuth -->|"HTTP API calls"| CoreURLs
    CoreURLs -->|"routes to"| CoreViews
    CoreViews -->|"uses serializers"| CoreSerializers
    CoreViews -->|"calls ORM"| Models
    Models -->|"ORM queries"| SQLiteDB
    AuthURLs -->|"routes to"| AuthViews
    AuthViews -->|"uses serializers"| AuthSerializers
    CI -->|"Build/Test"| FrontendContainer
    CI -->|"Build/Test"| BackendContainer

    %% Click Events
    click NextJS "https://github.com/noemie-gyc/skolinvest/tree/main/FRONT/my_front_app"
    click RouteHandlers "https://github.com/noemie-gyc/skolinvest/tree/main/FRONT/my_front_app/src/app/api"
    click ReactUI "https://github.com/noemie-gyc/skolinvest/tree/main/FRONT/my_front_app/src/components"
    click FetchAuth "https://github.com/noemie-gyc/skolinvest/blob/main/FRONT/my_front_app/src/lib/fetchWithAuth.ts"
    click FrontendDockerfile "https://github.com/noemie-gyc/skolinvest/tree/main/FRONT/my_front_app/Dockerfile"
    click DjangoRoot "https://github.com/noemie-gyc/skolinvest/tree/main/BACK/my_docker_django_app"
    click AuthApp "https://github.com/noemie-gyc/skolinvest/tree/main/BACK/my_docker_django_app/authentification"
    click AuthSerializers "https://github.com/noemie-gyc/skolinvest/blob/main/BACK/my_docker_django_app/authentification/serializers.py"
    click AuthViews "https://github.com/noemie-gyc/skolinvest/blob/main/BACK/my_docker_django_app/authentification/views.py"
    click AuthURLs "https://github.com/noemie-gyc/skolinvest/blob/main/BACK/my_docker_django_app/authentification/urls.py"
    click Models "https://github.com/noemie-gyc/skolinvest/tree/main/BACK/my_docker_django_app/my_docker_django_app/models"
    click CoreSerializers "https://github.com/noemie-gyc/skolinvest/blob/main/BACK/my_docker_django_app/my_docker_django_app/serializers.py"
    click CoreViews "https://github.com/noemie-gyc/skolinvest/tree/main/BACK/my_docker_django_app/my_docker_django_app/views/v1"
    click CoreURLs "https://github.com/noemie-gyc/skolinvest/tree/main/BACK/my_docker_django_app/my_docker_django_app/urls/v1"
    click SQLiteDB "https://github.com/noemie-gyc/skolinvest/blob/main/BACK/my_docker_django_app/db.sqlite3"
    click BackendDockerfile "https://github.com/noemie-gyc/skolinvest/tree/main/BACK/my_docker_django_app/Dockerfile"
    click CI "https://github.com/noemie-gyc/skolinvest/blob/main/.github/workflows/main.yml"

    %% Styles
    classDef frontend fill:#BBDEFB,stroke:#1976D2,stroke-width:1px
    classDef backend fill:#C8E6C9,stroke:#2E7D32,stroke-width:1px
    classDef db fill:#FFF9C4,stroke:#F9A825,stroke-width:1px
    classDef ci fill:#FFE0B2,stroke:#EF6C00,stroke-width:1px
    classDef external fill:#E1BEE7,stroke:#8E24AA,stroke-width:1px
```
