# cristian-home/raffles-app architecture

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

- Interactive diagram: https://gitdiagram.com/cristian-home/raffles-app
- Repository: https://github.com/cristian-home/raffles-app

## Overview

- User Interface (UI) Layer: Locate all the Vue components, views, layouts (e.g., MainLayout.vue, AuthLayout.vue), and UI subcomponents (buttons, dialogs, forms, etc.). Group these together as the “Presentation Layer.”
- Routing Module: Represent the Vue Router configuration (src/router/index.ts), which maps URLs to views.
- State Management: Represent the stores (src/stores) that manage application state (app, auth, counter, etc.).
- API Integration Layer: Include the API modules located in src/lib/api (auth, buyers, draws, lotteries, etc.) which encapsulate API calls and interactions with back-end services.
- Build & Configuration: Although not a runtime component, include a note on the tooling layer such as Vite (vite.config.ts), TypeScript configuration (tsconfig*.json), ESLint, Prettier, and Tailwind CSS. These tools define how the project is built, tested, and maintained.

##### Relationships and Data Flow
- That these events are handled and propagated through the “State Management” layer which maintains application state.
- That from the UI layer (often via event bus calls or directly via API helper functions), requests are sent to the “API Integration Layer.”
- From the API layer, show interaction with “External Services” (e.g., Supabase, database) where CRUD operations occur.

##### Architectural Patterns and Design Principles
- Component-Based Architecture: Stress the separation of concerns by isolating UI components, views, and layout components.
- MVC/MVVM-Like Flow: Even though it’s an SPA, the separation between the presentation (views/components), state (stores), and business/data logic (API calls) is clear.
- Modularization: Show how API modules, utility functions, and UI libraries are structured into meaningful subdirectories.
- Testing Integration: Optionally include components representing the testing frameworks (Vitest and Playwright) to highlight continuous integration aspects that ensure code quality.

##### Technical Stack and Key Frameworks
- Frontend Framework: Vue 3
- Build Tool & Dev Server: Vite
- CSS Framework: Tailwind CSS (configured via tailwind.config.ts and postcss.config.js)
- State Management: Vue stores (custom or possibly Vuex/pinia if extended)
- API/Data Service: Custom API modules and Supabase client
- Testing: Vitest for unit testing and Playwright for E2E tests

## Diagram (Mermaid)

```mermaid
flowchart TD
    User("User"):::userNode

    subgraph "Presentation Layer"
        UIComponents["Vue Components & UI Subcomponents"]:::presentation
        Layouts["Layouts (AuthLayout, MainLayout)"]:::presentation
        Views["View Components"]:::presentation
    end

    subgraph "Routing & State Management"
        Router["Vue Router"]:::routing
        Stores["Stores"]:::routing
    end

    subgraph "API Integration & External Services"
        APIModules["API Modules"]:::api
        Supabase["Supabase Client"]:::api
        SQL["SQL Scripts (Database)"]:::api
    end

    subgraph "Build & Configuration"
        ViteConf["Vite Configuration"]:::build
        TailwindConf["Tailwind CSS (tailwind.config.ts)"]:::build
        PostcssConf["PostCSS (postcss.config.js)"]:::build
        TSConfig["TypeScript (tsconfig*.json)"]:::build
        ESLint["ESLint (.eslintrc.cjs)"]:::build
        Prettier["Prettier (.prettierrc.json)"]:::build
    end

    subgraph "Testing"
        Vitest["Vitest"]:::testing
        Playwright["Playwright"]:::testing
    end

    %% Data Flow Connections
    User -->|"interacts"| UIComponents
    UIComponents -->|"triggers-routing"| Router
    UIComponents -->|"updates"| Stores
    Router -->|"renders-view"| Views
    Stores -->|"fetches-data"| APIModules
    APIModules -->|"calls"| Supabase
    Supabase -->|"queries"| SQL
    %% Feedback Loop
    Supabase -->|"returns-data"| APIModules
    APIModules -->|"updates-state"| Stores
    Stores -->|"updates-UI"| UIComponents

    %% Build & Configuration Dependencies (Informational)
    ViteConf ---|"builds"| UIComponents
    TailwindConf ---|"styles"| UIComponents
    PostcssConf ---|"styles"| UIComponents
    TSConfig ---|"compiles"| UIComponents
    ESLint ---|"lints"| UIComponents
    Prettier ---|"formats"| UIComponents

    %% Testing Integration (Informational)
    Vitest ---|"tests"| UIComponents
    Playwright ---|"e2e-tests"| UIComponents

    %% Click Events
    click UIComponents "https://github.com/cristian-home/raffles-app/tree/main/src/components"
    click Layouts "https://github.com/cristian-home/raffles-app/tree/main/src/layouts"
    click Views "https://github.com/cristian-home/raffles-app/tree/main/src/views"
    click Router "https://github.com/cristian-home/raffles-app/blob/main/src/router/index.ts"
    click Stores "https://github.com/cristian-home/raffles-app/tree/main/src/stores"
    click APIModules "https://github.com/cristian-home/raffles-app/tree/main/src/lib/api"
    click Supabase "https://github.com/cristian-home/raffles-app/blob/main/src/lib/supabase.client.ts"
    click SQL "https://github.com/cristian-home/raffles-app/tree/main/src/sql"
    click ViteConf "https://github.com/cristian-home/raffles-app/blob/main/vite.config.ts"
    click TailwindConf "https://github.com/cristian-home/raffles-app/blob/main/tailwind.config.ts"
    click PostcssConf "https://github.com/cristian-home/raffles-app/blob/main/postcss.config.js"
    click TSConfig "https://github.com/cristian-home/raffles-app/blob/main/tsconfig*.json"
    click ESLint "https://github.com/cristian-home/raffles-app/blob/main/.eslintrc.cjs"
    click Prettier "https://github.com/cristian-home/raffles-app/blob/main/.prettierrc.json"

    %% Styles
    classDef presentation fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef routing fill:#d4edda,stroke:#333,stroke-width:2px;
    classDef api fill:#fff3cd,stroke:#333,stroke-width:2px;
    classDef build fill:#f8d7da,stroke:#333,stroke-width:2px;
    classDef testing fill:#e2e3e5,stroke:#333,stroke-width:2px;
    classDef userNode fill:#d1d1d1,stroke:#333,stroke-width:2px;
```
