# rajpandya737/anisync architecture

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

- Interactive diagram: https://gitdiagram.com/rajpandya737/anisync
- Repository: https://github.com/rajpandya737/anisync

## Overview

##### Main Components

a. Frontend Layer:
- Static Assets (CSS, JS, Images)
- HTML Templates
- Client-side Processing

b. Backend Layer:
- Flask Web Server
- Data Processing Engine
- Database Management
- External API Integration

c. External Services:
- MyAnimeList API
- User's MAL Profile
- osu! Game Data

**[Client Layer]**
- ↑↓
**[Web Server Layer (Flask)]**
- ↑↓
**[Application Layer]**
- ↑↓
**[Data Layer]**
- ↑↓
**[External Services]**

##### Component Details

Client Layer (Blue):
- User interaction flow

Web Server Layer (Green):
- Center app.py as the main controller
- Wsgi.py for deployment handling
- Routing paths to templates

Application Layer (Orange):
- Data_processing.py for anime data handling
- Config.py for application settings
- Data flow between components

Data Layer (Purple):
- SQLite database (translated_anime_list.sqlite)
- Db.py interactions
- Data caching if implemented

External Services (Gray):
- MyAnimeList API connection
- osu! game data source
- User profile data retrieval

##### Data Flow Indicators

- User request flow (MAL username input → beatmap results)
- API calls to external services
- Database read/write operations
- Static asset delivery

##### Additional Notes

- Keep the main flow (MAL username → beatmap list) prominent
- Where the static assets are served from
- Where configuration settings impact the system
- Points where future features (Anilist support, sorting options) could be integrated

This structure will provide a clear understanding of how Anisync processes user requests, interacts with external services, and delivers the final beatmap recommendations to users.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef server fill:#2ecc71,stroke:#27ae60,color:white
    classDef application fill:#e67e22,stroke:#d35400,color:white
    classDef data fill:#9b59b6,stroke:#8e44ad,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    
    %% Client Layer
    subgraph Client
        Templates["HTML Templates"]
        StaticAssets["Static Assets"]
        ClientProcessing["Client-side Processing"]
        
        subgraph Templates
            Search["search.html"]
            List["list.html"]
            About["about.html"]
            Error["error.html"]
        end
        
        subgraph StaticAssets
            CSS["CSS Files"]
            JS["JavaScript Files"]
            Images["Images"]
            SEO["Sitemap"]
        end
        
        subgraph ClientProcessing
            MainLogic["Main Logic"]
            ScrollHandler["Scroll Handler"]
        end
    end
    
    %% Server Layer
    subgraph Server
        Flask["Flask Web Server"]
        WSGI["WSGI Handler"]
    end
    
    %% Application Layer
    subgraph Application
        DataProcessor["Data Processing Engine"]
        Config["Configuration"]
    end
    
    %% Data Layer
    subgraph Data
        DB["Database Manager"]
        SQLite["SQLite Database"]
    end
    
    %% External Services
    subgraph External
        MAL["MyAnimeList API"]
        OSU["osu! Game Data"]
    end
    
    %% Relationships
    Flask --> Templates
    Flask --> StaticAssets
    Flask --> DataProcessor
    DataProcessor --> DB
    DB --> SQLite
    DataProcessor --> MAL
    DataProcessor --> OSU
    WSGI --> Flask
    ClientProcessing --> Flask
    
    %% Click Events
    click Flask "https://github.com/rajpandya737/Anisync/blob/main/app.py"
    click WSGI "https://github.com/rajpandya737/Anisync/blob/main/wsgi.py"
    click DataProcessor "https://github.com/rajpandya737/Anisync/blob/main/data_processing.py"
    click DB "https://github.com/rajpandya737/Anisync/blob/main/db.py"
    click Config "https://github.com/rajpandya737/Anisync/blob/main/config.py"
    click SQLite "https://github.com/rajpandya737/Anisync/blob/main/translated_anime_list.sqlite"
    click Search "https://github.com/rajpandya737/Anisync/blob/main/templates/search.html"
    click List "https://github.com/rajpandya737/Anisync/blob/main/templates/list.html"
    click About "https://github.com/rajpandya737/Anisync/blob/main/templates/about.html"
    click Error "https://github.com/rajpandya737/Anisync/blob/main/templates/error.html"
    click CSS "https://github.com/rajpandya737/Anisync/tree/main/static/css/"
    click JS "https://github.com/rajpandya737/Anisync/tree/main/static/js/"
    click Images "https://github.com/rajpandya737/Anisync/tree/main/static/images/"
    click MainLogic "https://github.com/rajpandya737/Anisync/blob/main/static/js/index.js"
    click ScrollHandler "https://github.com/rajpandya737/Anisync/blob/main/static/js/scroll.js"
    click SEO "https://github.com/rajpandya737/Anisync/blob/main/static/sitemap/sitemap.xml"
    
    %% Style Applications
    class Templates,StaticAssets,ClientProcessing,Search,List,About,Error,CSS,JS,Images,MainLogic,ScrollHandler,SEO frontend
    class Flask,WSGI server
    class DataProcessor,Config application
    class DB,SQLite data
    class MAL,OSU external
```
