# cybodexx/filesharebot architecture

> Architecture diagram of the GitHub repository cybodexx/filesharebot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cybodexx/filesharebot
- Repository: https://github.com/cybodexx/filesharebot

## Overview

#### Purpose and Shape
This is a mixed React/TypeScript frontend and Python backend repository for an authenticated creator/commerce-style application. It includes HTML views for dashboard, earnings, playlists, files, profile, wallet, and upload flows, plus integrations with Whop, Shopify, Telegram, and likely Replit-managed auth/deployment.

#### Entry Points and Runtime Boundary
The frontend has multiple likely bootstraps: `main/index.tsx`, `main/main.tsx`, and `main/App.tsx`; Vite configuration is in `main/vite.config.ts`. The Python service entry point is `main/app.py`, with production process declaration in `main/Procfile` and dependencies in `main/requirements.txt`. `main/render.yaml` indicates Render deployment support.

#### Backend Application and Routing
Python routes appear separated into application routing and authentication concerns:
- `main/app.py`
- `main/routes.py`
- `main/auth_routes.py`

`main/auth.py` likely supplies identity/session logic consumed by protected route handlers. HTML documents such as `main/dashboard.html`, `main/earnings.html`, and `main/login.html` suggest the backend may directly serve server-rendered or static page shells alongside API behavior.

#### Persistence and Configuration
Database access is centralized at `main/database.py`, with settings/environment loading in `main/config.py` and `main/config.env`. The `.env.example` file documents required deployment configuration. This is the primary boundary for credentials, database connectivity, and provider keys:
- `main/database.py`
- `main/config.py`
- `main/.env.example`

#### Frontend Composition and Design System
The UI is built from a local component library rather than a conventional `src/` hierarchy. Application screens compose reusable primitives such as dialogs, navigation, tables, charts, forms, and sidebar controls. Key composition and design-system locations are:
- `main/App.tsx`
- `main/DesignSystemBrowser.tsx`
- `main/registry.tsx`

Styling/token infrastructure is shared through `main/index.css`, `main/tokens.json`, and `main/tokens.tsx`.

#### Media/Slide Rendering Pipeline
A distinct TypeScript rendering subsystem models slide-based/video artifacts. It loads a manifest, validates schemas/layouts, renders slide content, and supports runtime hot reload:
- `main/slideLoader.ts`
- `main/slidesManifest.ts`
- `main/render.tsx`

Related control points include `main/sdmRuntime.ts`, `main/sdmValidation.ts`, `main/validate-slides.ts`, and `main/slides-manifest.json`. This subsystem is architecturally separate from the core dashboard UI and may produce video or presentation assets.

#### External Services and Integrations
Commerce/platform access is encapsulated in provider-specific clients:
- Whop: `main/whop-client.ts`, `main/whop-api.mjs`, `main/whop-mcp.mjs`
- Shopify: `main/shopifyStorefrontClient.ts`, `main/shopify-admin-api.mjs`
- Telegram: `main/telegram.py`

These should remain behind provider adapters so frontend screens and core routes do not directly own API credentials or provider protocol details. Provider documentation files indicate additional planned/optional AI, media, scraping, and content-generation integrations.

#### Primary Control Flow
A request enters the Python process (`app.py`), passes through auth/session handling (`auth.py`, `auth_routes.py`), then routes to page/API handlers (`routes.py`) and persistence (`database.py`) or provider adapters. Browser-facing React/Vite entry points mount application UI and reusable controls. Separately, slide manifests flow through loader/validation/runtime modules into React-based rendering, with generated media artifacts kept distinct from user/account and commerce operations.

Main entry points: [`main/routes.py`](https://github.com/cybodexx/filesharebot/blob/main/main/routes.py) (Application routes), [`main/config.py`](https://github.com/cybodexx/filesharebot/blob/main/main/config.py) (Service configuration), [`main/registry.tsx`](https://github.com/cybodexx/filesharebot/blob/main/main/registry.tsx) (Component registry), [`main/app.py`](https://github.com/cybodexx/filesharebot/blob/main/main/app.py) (Python application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React Frontend"]
  node_vite["Vite bootstraps<br/>frontend entry<br/>[index.tsx]"]
  node_app_ui["Application UI<br/>React composition<br/>[App.tsx]"]
  node_component_registry["Component registry<br/>design system<br/>[registry.tsx]"]
  node_design_browser["Design system browser<br/>component catalog"]
  node_tokens["Design tokens<br/>styles and tokens<br/>[tokens.tsx]"]
end

subgraph group_backend["Python Service"]
  node_python_app["Python application<br/>service entry<br/>[app.py]"]
  node_auth["Authentication<br/>identity and sessions<br/>[auth.py]"]
  node_auth_routes["Auth routes<br/>route handlers<br/>[auth_routes.py]"]
  node_routes["Application routes<br/>page and API handlers<br/>[routes.py]"]
  node_database[("Database access<br/>persistence boundary<br/>[database.py]")]
  node_backend_config["Service configuration<br/>environment settings<br/>[config.py]"]
  node_html_views["HTML page shells<br/>server views<br/>[dashboard.html]"]
end

subgraph group_slides["Slide Rendering"]
  node_slide_manifest["Slide manifest<br/>artifact definition"]
  node_slide_loader["Slide loader<br/>manifest loading<br/>[slideLoader.ts]"]
  node_slide_validation["Slide validation<br/>schema and layout checks<br/>[sdmValidation.ts]"]
  node_slide_runtime["Slide runtime<br/>hot reload runtime<br/>[sdmRuntime.ts]"]
  node_slide_renderer["Slide renderer<br/>React rendering<br/>[render.tsx]"]
end

subgraph group_integrations["Provider Adapters"]
  node_whop{{"Whop client<br/>commerce adapter<br/>[whop-client.ts]"}}
  node_shopify{{"Shopify storefront client<br/>commerce adapter"}}
  node_telegram{{"Telegram adapter<br/>messaging adapter<br/>[telegram.py]"}}
end

node_vite -->|"mounts"| node_app_ui
node_app_ui -->|"composes"| node_component_registry
node_design_browser -->|"browses"| node_component_registry
node_component_registry -->|"uses"| node_tokens
node_python_app -->|"registers"| node_auth_routes
node_python_app -->|"dispatches to"| node_routes
node_auth_routes -->|"uses"| node_auth
node_routes -->|"protects with"| node_auth
node_routes -->|"reads and writes"| node_database
node_routes -->|"serves"| node_html_views
node_backend_config -->|"configures"| node_database
node_backend_config -.->|"supplies credentials"| node_whop
node_backend_config -.->|"supplies credentials"| node_shopify
node_routes -->|"uses"| node_whop
node_routes -->|"uses"| node_shopify
node_routes -->|"uses"| node_telegram
node_slide_manifest -->|"defines slides for"| node_slide_loader
node_slide_loader -->|"validates"| node_slide_validation
node_slide_validation -->|"enables"| node_slide_runtime
node_slide_runtime -->|"drives"| node_slide_renderer

click node_vite "https://github.com/cybodexx/filesharebot/blob/main/main/index.tsx"
click node_app_ui "https://github.com/cybodexx/filesharebot/blob/main/main/App.tsx"
click node_component_registry "https://github.com/cybodexx/filesharebot/blob/main/main/registry.tsx"
click node_design_browser "https://github.com/cybodexx/filesharebot/blob/main/main/DesignSystemBrowser.tsx"
click node_tokens "https://github.com/cybodexx/filesharebot/blob/main/main/tokens.tsx"
click node_python_app "https://github.com/cybodexx/filesharebot/blob/main/main/app.py"
click node_auth "https://github.com/cybodexx/filesharebot/blob/main/main/auth.py"
click node_auth_routes "https://github.com/cybodexx/filesharebot/blob/main/main/auth_routes.py"
click node_routes "https://github.com/cybodexx/filesharebot/blob/main/main/routes.py"
click node_database "https://github.com/cybodexx/filesharebot/blob/main/main/database.py"
click node_backend_config "https://github.com/cybodexx/filesharebot/blob/main/main/config.py"
click node_html_views "https://github.com/cybodexx/filesharebot/blob/main/main/dashboard.html"
click node_slide_manifest "https://github.com/cybodexx/filesharebot/blob/main/main/slides-manifest.json"
click node_slide_loader "https://github.com/cybodexx/filesharebot/blob/main/main/slideLoader.ts"
click node_slide_validation "https://github.com/cybodexx/filesharebot/blob/main/main/sdmValidation.ts"
click node_slide_runtime "https://github.com/cybodexx/filesharebot/blob/main/main/sdmRuntime.ts"
click node_slide_renderer "https://github.com/cybodexx/filesharebot/blob/main/main/render.tsx"
click node_whop "https://github.com/cybodexx/filesharebot/blob/main/main/whop-client.ts"
click node_shopify "https://github.com/cybodexx/filesharebot/blob/main/main/shopifyStorefrontClient.ts"
click node_telegram "https://github.com/cybodexx/filesharebot/blob/main/main/telegram.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_vite,node_app_ui,node_component_registry,node_design_browser,node_tokens toneBlue
class node_python_app,node_auth,node_auth_routes,node_routes,node_database,node_backend_config,node_html_views toneAmber
class node_slide_manifest,node_slide_loader,node_slide_validation,node_slide_runtime,node_slide_renderer toneMint
class node_whop,node_shopify,node_telegram toneRose
```

## Components

### React Frontend

- [Vite bootstraps](https://github.com/cybodexx/filesharebot/blob/main/main/index.tsx): frontend entry · Browser entry points and Vite setup. · `main/index.tsx`
- [Application UI](https://github.com/cybodexx/filesharebot/blob/main/main/App.tsx): React composition · `main/App.tsx`
- [Component registry](https://github.com/cybodexx/filesharebot/blob/main/main/registry.tsx): design system · `main/registry.tsx`
- [Design system browser](https://github.com/cybodexx/filesharebot/blob/main/main/DesignSystemBrowser.tsx): component catalog · `main/DesignSystemBrowser.tsx`
- [Design tokens](https://github.com/cybodexx/filesharebot/blob/main/main/tokens.tsx): styles and tokens · `main/tokens.tsx`

### Python Service

- [Python application](https://github.com/cybodexx/filesharebot/blob/main/main/app.py): service entry · `main/app.py`
- [Authentication](https://github.com/cybodexx/filesharebot/blob/main/main/auth.py): identity and sessions · `main/auth.py`
- [Auth routes](https://github.com/cybodexx/filesharebot/blob/main/main/auth_routes.py): route handlers · `main/auth_routes.py`
- [Application routes](https://github.com/cybodexx/filesharebot/blob/main/main/routes.py): page and API handlers · Serves application pages and API behavior. · `main/routes.py`
- [Database access](https://github.com/cybodexx/filesharebot/blob/main/main/database.py): persistence boundary · `main/database.py`
- [Service configuration](https://github.com/cybodexx/filesharebot/blob/main/main/config.py): environment settings · Loads database and provider credentials. · `main/config.py`
- [HTML page shells](https://github.com/cybodexx/filesharebot/blob/main/main/dashboard.html): server views · `main/dashboard.html`

### Slide Rendering

- [Slide manifest](https://github.com/cybodexx/filesharebot/blob/main/main/slides-manifest.json): artifact definition · `main/slides-manifest.json`
- [Slide loader](https://github.com/cybodexx/filesharebot/blob/main/main/slideLoader.ts): manifest loading · `main/slideLoader.ts`
- [Slide validation](https://github.com/cybodexx/filesharebot/blob/main/main/sdmValidation.ts): schema and layout checks · `main/sdmValidation.ts`
- [Slide runtime](https://github.com/cybodexx/filesharebot/blob/main/main/sdmRuntime.ts): hot reload runtime · `main/sdmRuntime.ts`
- [Slide renderer](https://github.com/cybodexx/filesharebot/blob/main/main/render.tsx): React rendering · Renders slide-based media artifacts. · `main/render.tsx`

### Provider Adapters

- [Whop client](https://github.com/cybodexx/filesharebot/blob/main/main/whop-client.ts): commerce adapter · `main/whop-client.ts`
- [Shopify storefront client](https://github.com/cybodexx/filesharebot/blob/main/main/shopifyStorefrontClient.ts): commerce adapter · `main/shopifyStorefrontClient.ts`
- [Telegram adapter](https://github.com/cybodexx/filesharebot/blob/main/main/telegram.py): messaging adapter · `main/telegram.py`

## Connections

- Vite bootstraps → Application UI: mounts
- Application UI → Component registry: composes
- Design system browser → Component registry: browses
- Component registry → Design tokens: uses
- Python application → Auth routes: registers
- Python application → Application routes: dispatches to
- Auth routes → Authentication: uses
- Application routes → Authentication: protects with
- Application routes → Database access: reads and writes
- Application routes → HTML page shells: serves
- Service configuration → Database access: configures
- Service configuration → Whop client: supplies credentials
- Service configuration → Shopify storefront client: supplies credentials
- Application routes → Whop client: uses
- Application routes → Shopify storefront client: uses
- Application routes → Telegram adapter: uses
- Slide manifest → Slide loader: defines slides for
- Slide loader → Slide validation: validates
- Slide validation → Slide runtime: enables
- Slide runtime → Slide renderer: drives
