# wardxela/rwx architecture

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

- Interactive diagram: https://gitdiagram.com/wardxela/rwx
- Repository: https://github.com/wardxela/rwx

## Overview

##### Main Components

a) Frontend Layer (SolidJS Application):
- Client-side application structure
- Feature-based architecture (/features directory)
- Routing system with nested routes
- Integration with shared UI components

b) Backend Layer (NestJS Application):
- Modular architecture (auth, users, config modules)
- Authentication flow with Yandex strategy
- Session management
- Controller-service pattern

c) Database Layer:
- PostgreSQL database (evident from Prisma schema)
- Main entities and their relationships
- Migration management

d) Shared Packages:
- UI Component Library
- API client package
- Database access layer (Prisma)
- Tooling utilities

**┌─────────────────────────────────────────────────────────────┐**
- Client Layer                           │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
- Routes    │  │  Features   │  │  Components │        │
- ┘  └─────────────┘  └─────────────┘        │
- ┬─────────────────────────────────┘

**┌───────────────────────────┼─────────────────────────────────┐**
- Shared Packages                          │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
- UI      │  │    API      │  │  Tooling    │        │
- ┘  └─────────────┘  └─────────────┘        │
- ┼─────────────────────────────────┘

**┌───────────────────────────┼─────────────────────────────────┐**
- Backend Layer                            │
- ┌─────────────┐  ┌─────────────┐  ┌─────────────┐        │
- Auth     │  │    Users    │  │   Config    │        │
- ┘  └─────────────┘  └─────────────┘        │
- ┼─────────────────────────────────┘

**┌───────────────────────────┼─────────────────────────────────┐**
- Database Layer                            │
- ┌─────────────┐  ┌─────────────┐                          │
- Prisma    │  │  Postgres   │                          │
- ┘  └─────────────┘                          │
- ┘

##### Important Details

a) Frontend Details:
- Route structure: courses, blog, profile
- Feature modules: blog, categories, courses
- Shared components and utilities

b) Backend Details:
- Auth flow with Yandex integration
- User management system
- Configuration management
- Session handling

c) Database Details:
- Main entities from Prisma schema
- Migration management
- Relationship between services and database

##### Additional Elements
- Version information for major components
- External service integrations
- Development tools integration (CI/CD, testing)

##### Notes for Implementation
- Clear boundaries between packages
- Extensibility points for future features
- Environment configuration flow

Remember to maintain a balance between detail and clarity, focusing on the educational platform's core functionality while showing the technical architecture that supports it.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        direction TB
        Routes["Routes"]:::frontend
        Features["Feature Modules"]:::frontend
        Components["Core Components"]:::frontend
        SharedUtils["Shared Utilities"]:::frontend
        
        subgraph Features
            Blog["Blog Feature"]:::frontend
            Courses["Courses Feature"]:::frontend
            Categories["Categories Feature"]:::frontend
        end
    end

    subgraph Shared["Shared Packages"]
        direction TB
        UI["UI Library"]:::shared
        APIClient["API Client"]:::shared
        DBPackage["Database Package"]:::shared
        Tools["Development Tools"]:::shared
    end

    subgraph Backend["Backend Layer"]
        direction TB
        AuthModule["Authentication Module"]:::backend
        UsersModule["Users Module"]:::backend
        ConfigModule["Configuration Module"]:::backend
        
        subgraph AuthModule
            YandexStrategy["Yandex Strategy"]:::backend
            AuthGuards["Auth Guards"]:::backend
            AuthController["Auth Controller"]:::backend
            AuthService["Auth Service"]:::backend
        end
    end

    subgraph DB["Database Layer"]
        direction TB
        Prisma["Prisma Schema"]:::database
        PrismaMigrations["Database Migrations"]:::database
        Postgres[(PostgreSQL)]:::database
    end

    %% External Services
    Yandex["Yandex OAuth"]:::external

    %% Relationships
    Client --> Shared
    Shared --> Backend
    Backend --> DB
    AuthModule --> Yandex
    Prisma --> Postgres

    %% Click Events
    click Routes "https://github.com/wardxela/rwx/tree/main/apps/solidjs/src/routes/"
    click Features "https://github.com/wardxela/rwx/tree/main/apps/solidjs/src/features/"
    click Components "https://github.com/wardxela/rwx/tree/main/apps/solidjs/src/components/"
    click SharedUtils "https://github.com/wardxela/rwx/tree/main/apps/solidjs/src/shared/"
    click Blog "https://github.com/wardxela/rwx/tree/main/apps/solidjs/src/features/blog/"
    click Courses "https://github.com/wardxela/rwx/tree/main/apps/solidjs/src/features/courses/"
    click Categories "https://github.com/wardxela/rwx/tree/main/apps/solidjs/src/features/categories/"
    click UI "https://github.com/wardxela/rwx/tree/main/packages/ui/"
    click APIClient "https://github.com/wardxela/rwx/tree/main/packages/api/"
    click DBPackage "https://github.com/wardxela/rwx/tree/main/packages/db/"
    click Tools "https://github.com/wardxela/rwx/tree/main/tooling/"
    click AuthModule "https://github.com/wardxela/rwx/tree/main/apps/nestjs/src/auth/"
    click UsersModule "https://github.com/wardxela/rwx/tree/main/apps/nestjs/src/users/"
    click ConfigModule "https://github.com/wardxela/rwx/tree/main/apps/nestjs/src/config/"
    click YandexStrategy "https://github.com/wardxela/rwx/blob/main/apps/nestjs/src/auth/strategies/yandex.strategy.ts"
    click AuthGuards "https://github.com/wardxela/rwx/tree/main/apps/nestjs/src/auth/guards/"
    click AuthController "https://github.com/wardxela/rwx/blob/main/apps/nestjs/src/auth/auth.controller.ts"
    click AuthService "https://github.com/wardxela/rwx/blob/main/apps/nestjs/src/auth/auth.service.ts"
    click Prisma "https://github.com/wardxela/rwx/blob/main/packages/db/prisma/schema.prisma"
    click PrismaMigrations "https://github.com/wardxela/rwx/tree/main/packages/db/prisma/migrations/"

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

    %% Legend
    subgraph Legend
        Frontend["Frontend"]:::frontend
        Backend["Backend"]:::backend
        SharedPkg["Shared Packages"]:::shared
        DB["Database"]:::database
        External["External Services"]:::external
    end
```
