# corralpeltzer/newtrackon architecture

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

- Interactive diagram: https://gitdiagram.com/corralpeltzer/newtrackon
- Repository: https://github.com/corralpeltzer/newtrackon

## Overview

##### Main Components Identification

The system can be broken down into these primary components:

a) Web Application Layer
- Flask-based web server
- Template engine (Jinja)
- Static assets (CSS, images)

b) Core Services Layer
- Tracker monitoring system
- Scraper service
- Database operations
- API endpoints

c) Persistence Layer
- SQLite database (implied by db.py and migration1.sql)

##### Component Relationships

- Client requests → Web Server
- Web Server → Template Engine → Client responses
- Web Server → Core Services
- Core Services → Data Layer
- Scraper Service → External Trackers
- API Endpoints → External Consumers

Create clear separations for:
- Public interfaces (Web UI, API)
- Internal services
- Monitoring systems
- Storage systems

##### Technical Details

Annotations for:
- Python 3.12 runtime
- Flask/Tornado web server
- Port configurations (default 8080)
- Docker container specifications
- Database schema references

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        APIConsumer["API Consumer"]
        ChromeExt["electromagnet Extension"]:::external
    end

    subgraph WebLayer
        WebServer["Flask/Tornado Server"]:::web
        click WebServer "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/__init__.py"
        Routes["Route Handlers"]:::web
        click Routes "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/views.py"
        Templates["Template Engine"]:::web
        click Templates "https://github.com/CorralPeltzer/newTrackon/tree/master/newTrackon/tpl/"
        StaticAssets["Static Assets"]:::web
        click StaticAssets "https://github.com/CorralPeltzer/newTrackon/tree/master/newTrackon/static/"
        BaseTemplate["Base Template"]:::web
        click BaseTemplate "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/tpl/base.jinja"
    end

    subgraph CoreServices
        TrackerMon["Tracker Monitor"]:::core
        click TrackerMon "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/tracker.py"
        Scraper["Scraper Service"]:::core
        click Scraper "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/scraper.py"
        APISpec["API Specification"]:::core
        click APISpec "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/newtrackon-api.yml"
        TrackerMgmt["Tracker List Manager"]:::core
        click TrackerMgmt "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/trackon.py"
        BTDecoder["BitTorrent Decoder"]:::core
        click BTDecoder "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/bdecode.py"
    end

    subgraph DataLayer
        DBOps["Database Operations"]:::data
        click DBOps "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/db.py"
        PersistMgr["Persistence Manager"]:::data
        click PersistMgr "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/persistence.py"
        DataStore["Data Storage"]:::data
        click DataStore "https://github.com/CorralPeltzer/newTrackon/tree/master/data/"
        DBMigration["Database Migration"]:::data
        click DBMigration "https://github.com/CorralPeltzer/newTrackon/blob/master/utils/migration1.sql"
    end

    subgraph Config
        AppConfig["Main Application"]:::config
        click AppConfig "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/__init__.py"
        EntryPoint["Runtime Entry"]:::config
        click EntryPoint "https://github.com/CorralPeltzer/newTrackon/blob/master/run.py"
        DockerConfig["Docker Config"]:::config
        click DockerConfig "https://github.com/CorralPeltzer/newTrackon/tree/master/Dockerfile"
        ContainerOrch["Container Orchestration"]:::config
        click ContainerOrch "https://github.com/CorralPeltzer/newTrackon/blob/master/docker-compose.yml"
    end

    subgraph WebUI
        MainPage["Main Page"]:::ui
        click MainPage "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/tpl/main.jinja"
        APIDocs["API Documentation"]:::ui
        click APIDocs "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/tpl/static/api-docs.jinja"
        FAQPage["FAQ Page"]:::ui
        click FAQPage "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/tpl/static/faq.jinja"
        TrackerList["Tracker List Page"]:::ui
        click TrackerList "https://github.com/CorralPeltzer/newTrackon/blob/master/newTrackon/tpl/static/list.jinja"
        Styling["CSS Styling"]:::ui
        click Styling "https://github.com/CorralPeltzer/newTrackon/tree/master/newTrackon/static/css/"
    end

    Browser --> WebServer
    APIConsumer --> WebServer
    ChromeExt --> WebServer
    
    WebServer --> Routes
    Routes --> Templates
    Templates --> StaticAssets
    Templates --> BaseTemplate
    
    Routes --> CoreServices
    TrackerMon --> Scraper
    Scraper --> BTDecoder
    TrackerMgmt --> TrackerMon
    
    CoreServices --> DBOps
    DBOps --> PersistMgr
    PersistMgr --> DataStore
    DBMigration --> DataStore
    
    WebServer --> WebUI
    
    AppConfig --> WebServer
    EntryPoint --> AppConfig
    DockerConfig --> ContainerOrch

    classDef external fill:#gray
    classDef web fill:#3498db
    classDef core fill:#2ecc71
    classDef data fill:#f1c40f
    classDef config fill:#95a5a6
    classDef ui fill:#e74c3c
```
