# lancew/myjudo architecture

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

- Interactive diagram: https://gitdiagram.com/lancew/myjudo
- Repository: https://github.com/lancew/myjudo

## Overview

##### Main Components Identification
The system appears to be a web application with the following key components:

a. Web Server Layer
- Built with Cro (Perl 6 web framework)
- Handles HTTPS with TLS (evident from fake-tls certificates)
- Entry point through service.p6

b. Application Layer
- Routes handling (Routes.pm6)
- Core business logic (MyJudo.pm6, Judo.pm6)
- Template rendering (views directory with .mustache files)

c. Data Layer
- SQLite database (db/myjudo.db)
- Multiple schema versions showing evolution

**[HTTPS/TLS Layer]**
- ↓
**[Cro Web Server]**
- ↓
**[Router (Routes.pm6)]**
- ↓
**[Application Logic]**
- ↙     ↘
**[Views]  [Database]**

##### Component Details

- Blue: External interfaces (HTTPS/TLS)
- Green: Application components (Cro, Router, Logic)
- Yellow: Data storage (SQLite)
- Orange: View layer (Mustache templates)

##### Key Relationships

- Request flow from HTTPS → Cro → Router → Logic
- Data flow between Logic ↔ Database
- Template rendering flow from Logic → Views
- Response flow back to client

##### Important Elements

a. Security Layer:
- TLS certificate handling
- Authentication flow (evident from login/register views)

b. Application Features:
- User management (register, login, password reset)
- Training session management
- User home functionality

c. Development/Deployment:
- Docker container support
- Development tools integration

##### Technical Details to Note

A technical stack sidebar:
- Language: Perl 6
- Web Framework: Cro
- Database: SQLite
- Template Engine: Mustache
- Container: Docker
- TLS: Self-signed certificates

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "External Layer"
        Client(("Client Browser"))
        TLS["TLS/HTTPS Security"]
    end

    subgraph "Web Server Layer"
        Server["Cro Web Server"]
        Router["Router Component"]
    end

    subgraph "Application Layer"
        CoreLogic["Core Business Logic"]
        DomainLogic["Domain Logic"]
        Auth["Authentication"]
    end

    subgraph "View Layer"
        Templates["View Templates"]
        Static["Static Assets"]
        subgraph "Auth Views"
            Login["Login View"]
            Register["Register View"]
            Reset["Password Reset"]
        end
        UserViews["User Management Views"]
        TrainingViews["Training Session Views"]
    end

    subgraph "Data Layer"
        DB[(SQLite Database)]
        Schema["Schema Management"]
    end

    subgraph "Infrastructure"
        Docker["Docker Container"]
        Tests["Test Suite"]
        Config["Framework Config"]
    end

    Client --> TLS
    TLS --> Server
    Server --> Router
    Router --> CoreLogic
    CoreLogic --> DomainLogic
    CoreLogic --> Auth
    CoreLogic --> Templates
    CoreLogic --> DB
    Templates --> Login
    Templates --> Register
    Templates --> Reset
    Templates --> UserViews
    Templates --> TrainingViews
    Schema --> DB

    %% Style Definitions
    classDef external fill:#a8d1ff
    classDef server fill:#90EE90
    classDef app fill:#98FB98
    classDef view fill:#FFB6C6
    classDef data fill:#FFE4B5
    classDef infra fill:#DDA0DD

    %% Apply Styles
    class Client,TLS external
    class Server,Router server
    class CoreLogic,DomainLogic,Auth app
    class Templates,Static,Login,Register,Reset,UserViews,TrainingViews view
    class DB,Schema data
    class Docker,Tests,Config infra

    %% Click Events
    click TLS "https://github.com/lancew/MyJudo/tree/master/resources/fake-tls/"
    click Router "https://github.com/lancew/MyJudo/blob/master/lib/Routes.pm6"
    click CoreLogic "https://github.com/lancew/MyJudo/blob/master/lib/MyJudo.pm6"
    click DomainLogic "https://github.com/lancew/MyJudo/blob/master/lib/Judo.pm6"
    click DB "https://github.com/lancew/MyJudo/blob/master/db/myjudo.db"
    click Schema "https://github.com/lancew/MyJudo/blob/master/db/*.schema"
    click Templates "https://github.com/lancew/MyJudo/tree/master/views/"
    click Static "https://github.com/lancew/MyJudo/tree/master/static/"
    click Login "https://github.com/lancew/MyJudo/blob/master/views/login.mustache"
    click Register "https://github.com/lancew/MyJudo/blob/master/views/register.mustache"
    click Reset "https://github.com/lancew/MyJudo/blob/master/views/password-reset.mustache"
    click UserViews "https://github.com/lancew/MyJudo/tree/master/views/user/"
    click TrainingViews "https://github.com/lancew/MyJudo/tree/master/views/user/training-session/"
    click Config "https://github.com/lancew/MyJudo/blob/master/.cro.yml"
    click Docker "https://github.com/lancew/MyJudo/tree/master/Dockerfile"
    click Tests "https://github.com/lancew/MyJudo/tree/master/t/"
    click Server "https://github.com/lancew/MyJudo/blob/master/service.p6"
```
