# ruwantha-official/alpha architecture

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

- Interactive diagram: https://gitdiagram.com/ruwantha-official/alpha
- Repository: https://github.com/ruwantha-official/alpha

## Overview

Alpha is a Node.js web app exposing public scraping APIs alongside a small home and documentation site. The API workflow routes a request by plugin name, then each plugin fetches and parses a source site and returns JSON; F-Droid and Adaderana use the shared Axios request helper, while Cinesub uses Cloudscraper. The browser documentation page loads its endpoint examples from a static JSON file. Plugin implementations are shown, but the excerpts do not show the full set of endpoint documentation or all page-template behavior.

Main entry points: [`routers/api.js`](https://github.com/ruwantha-official/alpha/blob/master/routers/api.js) (API router), [`index.js`](https://github.com/ruwantha-official/alpha/blob/master/index.js) (Express server), [`libs/req.js`](https://github.com/ruwantha-official/alpha/blob/master/libs/req.js) (HTTP request helper), [`routers/plugins/froid.js`](https://github.com/ruwantha-official/alpha/blob/master/routers/plugins/froid.js) (F-Droid scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web app"]
  node_server["Express server<br/>[index.js]"]
  node_home["Home page<br/>[index.hbs]"]
  node_docs["Docs page<br/>[docs.hbs]"]
  node_static["Static assets"]
end

subgraph group_routing["API routing"]
  node_api["API router<br/>[api.js]"]
end

subgraph group_scrapers["Scraping plugins"]
  node_froid["F-Droid scraper<br/>[froid.js]"]
  node_derana["Adaderana scraper<br/>[deran.js]"]
  node_cinesub["Cinesub scraper<br/>[cinesubz.js]"]
  node_request["HTTP request helper<br/>[req.js]"]
end

subgraph group_client["Documentation client"]
  node_docscript["Docs loader<br/>[doc.js]"]
  node_docdata["Endpoint examples<br/>[doc.json]"]
end

node_visitor(("Visitor"))
node_fsource["F-Droid site"]
node_dsource["Adaderana site"]
node_csource["Cinesub site"]

node_visitor -->|"requests pages"| node_server
node_server -->|"renders home"| node_home
node_server -->|"renders docs"| node_docs
node_server -->|"mounts API"| node_api
node_server -->|"serves files"| node_static
node_visitor -->|"calls endpoint"| node_api
node_api -->|"dispatches plugin"| node_froid
node_api -->|"dispatches plugin"| node_derana
node_api -->|"dispatches plugin"| node_cinesub
node_froid -->|"requests pages"| node_request
node_derana -->|"requests pages"| node_request
node_request -->|"fetches"| node_fsource
node_request -->|"fetches"| node_dsource
node_cinesub -->|"scrapes pages"| node_csource
node_froid -->|"returns JSON"| node_api
node_derana -->|"returns JSON"| node_api
node_cinesub -->|"returns JSON"| node_api
node_visitor -->|"opens docs"| node_docs
node_docscript -->|"loads examples"| node_docdata
node_server -->|"serves script"| node_docscript

click node_server "https://github.com/ruwantha-official/alpha/blob/master/index.js"
click node_home "https://github.com/ruwantha-official/alpha/blob/master/app/pages/index.hbs"
click node_docs "https://github.com/ruwantha-official/alpha/blob/master/app/pages/docs.hbs"
click node_api "https://github.com/ruwantha-official/alpha/blob/master/routers/api.js"
click node_froid "https://github.com/ruwantha-official/alpha/blob/master/routers/plugins/froid.js"
click node_derana "https://github.com/ruwantha-official/alpha/blob/master/routers/plugins/deran.js"
click node_cinesub "https://github.com/ruwantha-official/alpha/blob/master/routers/plugins/cinesubz.js"
click node_request "https://github.com/ruwantha-official/alpha/blob/master/libs/req.js"
click node_docscript "https://github.com/ruwantha-official/alpha/blob/master/app/public/doc.js"
click node_docdata "https://github.com/ruwantha-official/alpha/blob/master/app/public/doc.json"
click node_static "https://github.com/ruwantha-official/alpha/tree/master/app/public"

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_server,node_home,node_docs,node_static toneBlue
class node_api toneAmber
class node_froid,node_derana,node_cinesub,node_request toneMint
class node_docscript,node_docdata toneRose
class node_visitor,node_fsource,node_dsource,node_csource toneIndigo
```

## Components

### Web app

- [Express server](https://github.com/ruwantha-official/alpha/blob/master/index.js): `index.js`
- [Home page](https://github.com/ruwantha-official/alpha/blob/master/app/pages/index.hbs): `app/pages/index.hbs`
- [Docs page](https://github.com/ruwantha-official/alpha/blob/master/app/pages/docs.hbs): `app/pages/docs.hbs`
- [Static assets](https://github.com/ruwantha-official/alpha/tree/master/app/public): `app/public`

### API routing

- [API router](https://github.com/ruwantha-official/alpha/blob/master/routers/api.js): `routers/api.js`

### Scraping plugins

- [F-Droid scraper](https://github.com/ruwantha-official/alpha/blob/master/routers/plugins/froid.js): `routers/plugins/froid.js`
- [Adaderana scraper](https://github.com/ruwantha-official/alpha/blob/master/routers/plugins/deran.js): `routers/plugins/deran.js`
- [Cinesub scraper](https://github.com/ruwantha-official/alpha/blob/master/routers/plugins/cinesubz.js): `routers/plugins/cinesubz.js`
- [HTTP request helper](https://github.com/ruwantha-official/alpha/blob/master/libs/req.js): `libs/req.js`

### Documentation client

- [Docs loader](https://github.com/ruwantha-official/alpha/blob/master/app/public/doc.js): `app/public/doc.js`
- [Endpoint examples](https://github.com/ruwantha-official/alpha/blob/master/app/public/doc.json): `app/public/doc.json`

### Other components

- **Visitor**
- **F-Droid site**
- **Adaderana site**
- **Cinesub site**

## Connections

- Visitor → Express server: requests pages (evidence: `index.js`)
- Express server → Home page: renders home (evidence: `index.js`)
- Express server → Docs page: renders docs (evidence: `index.js`)
- Express server → API router: mounts API (evidence: `index.js`)
- Express server → Static assets: serves files (evidence: `index.js`)
- Visitor → API router: calls endpoint (evidence: `routers/api.js`)
- API router → F-Droid scraper: dispatches plugin (evidence: `routers/api.js`)
- API router → Adaderana scraper: dispatches plugin (evidence: `routers/api.js`)
- API router → Cinesub scraper: dispatches plugin (evidence: `routers/api.js`)
- F-Droid scraper → HTTP request helper: requests pages (evidence: `routers/plugins/froid.js`)
- Adaderana scraper → HTTP request helper: requests pages (evidence: `routers/plugins/deran.js`)
- HTTP request helper → F-Droid site: fetches
- HTTP request helper → Adaderana site: fetches
- Cinesub scraper → Cinesub site: scrapes pages (evidence: `routers/plugins/cinesubz.js`)
- F-Droid scraper → API router: returns JSON (evidence: `routers/plugins/froid.js`)
- Adaderana scraper → API router: returns JSON (evidence: `routers/plugins/deran.js`)
- Cinesub scraper → API router: returns JSON (evidence: `routers/plugins/cinesubz.js`)
- Visitor → Docs page: opens docs
- Docs loader → Endpoint examples: loads examples (evidence: `app/public/doc.js`)
- Express server → Docs loader: serves script (evidence: `index.js`)
