# sinkaroid/jandapress architecture

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

- Interactive diagram: https://gitdiagram.com/sinkaroid/jandapress
- Repository: https://github.com/sinkaroid/jandapress

## Overview

Jandapress is a self-hosted doujinshi data gateway: clients request get, search, or random results through REST or experimental GraphQL; source-specific adapters fetch and normalize upstream data, with shared HTTP/cache services. README documents seven sources and Redis-backed persistent caching (memory fallback). Startup, metrics, status, documentation, redirects, and rate limiting are supporting runtime capabilities. Some route wiring and scraper implementations are only indexed or partially excerpted, so links are limited to documented or indexed references.

Main entry points: [`src/routes/rest.rs`](https://github.com/sinkaroid/jandapress/blob/master/src/routes/rest.rs) (REST handlers), [`src/main.rs`](https://github.com/sinkaroid/jandapress/blob/master/src/main.rs) (Server startup), [`src/graphql/schema.rs`](https://github.com/sinkaroid/jandapress/blob/master/src/graphql/schema.rs) (GraphQL schema), [`src/jandapress.rs`](https://github.com/sinkaroid/jandapress/blob/master/src/jandapress.rs) (HTTP and cache)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API interfaces"]
  node_rest["REST handlers<br/>[rest.rs]"]
  node_graphql["GraphQL schema<br/>[schema.rs]"]
  node_graphql_handler["GraphQL handler<br/>[handler.rs]"]
end

subgraph group_sources["Source adapters"]
  node_nhentai["nhentai adapter<br/>[nhentai.rs]"]
  node_pururin["Pururin adapter<br/>[pururin.rs]"]
  node_hentaifox["Hentaifox adapter<br/>[hentaifox.rs]"]
  node_asmhentai["Asmhentai adapter<br/>[asmhentai.rs]"]
  node_hentai2read["Hentai2read adapter<br/>[hentai2read.rs]"]
  node_simply_hentai["Simply Hentai adapter<br/>[simply_hentai.rs]"]
  node_threehentai["3hentai adapter<br/>[threehentai.rs]"]
end

subgraph group_platform["Shared services"]
  node_http_cache["HTTP and cache<br/>[jandapress.rs]"]
  node_cache_store[("Cache backend<br/>[cache.rs]")]
  node_config["Configuration<br/>[config.rs]"]
end

subgraph group_runtime["Runtime operations"]
  node_server["Server startup<br/>[main.rs]"]
  node_middleware["Rate limiting<br/>[rate_limit.rs]"]
  node_status["Status endpoint<br/>[status.rs]"]
  node_docs["API documentation<br/>[doc.rs]"]
  node_redirect["Redirect handler<br/>[redirect.rs]"]
  node_metrics["Metrics<br/>[metrics.rs]"]
end

node_clients(("API clients"))
node_upstreams(("Doujinshi sources"))
node_redis[("Redis")]

node_clients -->|"requests"| node_rest
node_clients -.->|"queries"| node_graphql_handler
node_graphql_handler -->|"dispatches"| node_graphql
node_rest -->|"invokes"| node_nhentai
node_rest -->|"invokes"| node_pururin
node_rest -->|"invokes"| node_hentaifox
node_rest -->|"invokes"| node_asmhentai
node_rest -->|"invokes"| node_hentai2read
node_rest -.->|"invokes"| node_simply_hentai
node_rest -.->|"invokes"| node_threehentai
node_graphql -->|"resolves via"| node_nhentai
node_graphql -->|"resolves via"| node_pururin
node_graphql -->|"resolves via"| node_hentaifox
node_graphql -->|"resolves via"| node_asmhentai
node_graphql -->|"resolves via"| node_hentai2read
node_graphql -.->|"resolves via"| node_simply_hentai
node_graphql -.->|"resolves via"| node_threehentai
node_nhentai -->|"fetches through"| node_http_cache
node_pururin -->|"fetches through"| node_http_cache
node_hentaifox -->|"fetches through"| node_http_cache
node_asmhentai -->|"fetches through"| node_http_cache
node_hentai2read -->|"fetches through"| node_http_cache
node_simply_hentai -->|"fetches through"| node_http_cache
node_threehentai -->|"fetches through"| node_http_cache
node_http_cache -->|"reads and writes"| node_cache_store
node_http_cache -->|"fetches data"| node_upstreams
node_cache_store -.->|"persists to"| node_redis
node_server -->|"loads"| node_config
node_server -->|"registers"| node_rest
node_server -->|"registers"| node_graphql_handler
node_server -->|"applies"| node_middleware
node_server -->|"registers"| node_status
node_server -->|"registers"| node_docs
node_server -->|"registers"| node_redirect
node_server -->|"initializes"| node_metrics

click node_rest "https://github.com/sinkaroid/jandapress/blob/master/src/routes/rest.rs"
click node_graphql "https://github.com/sinkaroid/jandapress/blob/master/src/graphql/schema.rs"
click node_graphql_handler "https://github.com/sinkaroid/jandapress/blob/master/src/graphql/handler.rs"
click node_nhentai "https://github.com/sinkaroid/jandapress/blob/master/src/scraper/nhentai.rs"
click node_pururin "https://github.com/sinkaroid/jandapress/blob/master/src/scraper/pururin.rs"
click node_hentaifox "https://github.com/sinkaroid/jandapress/blob/master/src/scraper/hentaifox.rs"
click node_asmhentai "https://github.com/sinkaroid/jandapress/blob/master/src/scraper/asmhentai.rs"
click node_hentai2read "https://github.com/sinkaroid/jandapress/blob/master/src/scraper/hentai2read.rs"
click node_simply_hentai "https://github.com/sinkaroid/jandapress/blob/master/src/scraper/simply_hentai.rs"
click node_threehentai "https://github.com/sinkaroid/jandapress/blob/master/src/scraper/threehentai.rs"
click node_http_cache "https://github.com/sinkaroid/jandapress/blob/master/src/jandapress.rs"
click node_cache_store "https://github.com/sinkaroid/jandapress/blob/master/src/cache.rs"
click node_config "https://github.com/sinkaroid/jandapress/blob/master/src/config.rs"
click node_server "https://github.com/sinkaroid/jandapress/blob/master/src/main.rs"
click node_middleware "https://github.com/sinkaroid/jandapress/blob/master/src/middleware/rate_limit.rs"
click node_status "https://github.com/sinkaroid/jandapress/blob/master/src/routes/status.rs"
click node_docs "https://github.com/sinkaroid/jandapress/blob/master/src/routes/doc.rs"
click node_redirect "https://github.com/sinkaroid/jandapress/blob/master/src/routes/redirect.rs"
click node_metrics "https://github.com/sinkaroid/jandapress/blob/master/src/metrics.rs"

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_rest,node_graphql,node_graphql_handler,node_clients toneBlue
class node_nhentai,node_pururin,node_hentaifox,node_asmhentai,node_hentai2read,node_simply_hentai,node_threehentai,node_redis toneAmber
class node_http_cache,node_cache_store,node_config toneMint
class node_server,node_middleware,node_status,node_docs,node_redirect,node_metrics toneRose
class node_upstreams toneIndigo
```

## Components

### API interfaces

- [REST handlers](https://github.com/sinkaroid/jandapress/blob/master/src/routes/rest.rs): `src/routes/rest.rs`
- [GraphQL schema](https://github.com/sinkaroid/jandapress/blob/master/src/graphql/schema.rs): `src/graphql/schema.rs`
- [GraphQL handler](https://github.com/sinkaroid/jandapress/blob/master/src/graphql/handler.rs): `src/graphql/handler.rs`

### Source adapters

- [nhentai adapter](https://github.com/sinkaroid/jandapress/blob/master/src/scraper/nhentai.rs): `src/scraper/nhentai.rs`
- [Pururin adapter](https://github.com/sinkaroid/jandapress/blob/master/src/scraper/pururin.rs): `src/scraper/pururin.rs`
- [Hentaifox adapter](https://github.com/sinkaroid/jandapress/blob/master/src/scraper/hentaifox.rs): `src/scraper/hentaifox.rs`
- [Asmhentai adapter](https://github.com/sinkaroid/jandapress/blob/master/src/scraper/asmhentai.rs): `src/scraper/asmhentai.rs`
- [Hentai2read adapter](https://github.com/sinkaroid/jandapress/blob/master/src/scraper/hentai2read.rs): `src/scraper/hentai2read.rs`
- [Simply Hentai adapter](https://github.com/sinkaroid/jandapress/blob/master/src/scraper/simply_hentai.rs): `src/scraper/simply_hentai.rs`
- [3hentai adapter](https://github.com/sinkaroid/jandapress/blob/master/src/scraper/threehentai.rs): `src/scraper/threehentai.rs`

### Shared services

- [HTTP and cache](https://github.com/sinkaroid/jandapress/blob/master/src/jandapress.rs): `src/jandapress.rs`
- [Cache backend](https://github.com/sinkaroid/jandapress/blob/master/src/cache.rs): `src/cache.rs`
- [Configuration](https://github.com/sinkaroid/jandapress/blob/master/src/config.rs): `src/config.rs`

### Runtime operations

- [Server startup](https://github.com/sinkaroid/jandapress/blob/master/src/main.rs): `src/main.rs`
- [Rate limiting](https://github.com/sinkaroid/jandapress/blob/master/src/middleware/rate_limit.rs): `src/middleware/rate_limit.rs`
- [Status endpoint](https://github.com/sinkaroid/jandapress/blob/master/src/routes/status.rs): `src/routes/status.rs`
- [API documentation](https://github.com/sinkaroid/jandapress/blob/master/src/routes/doc.rs): `src/routes/doc.rs`
- [Redirect handler](https://github.com/sinkaroid/jandapress/blob/master/src/routes/redirect.rs): `src/routes/redirect.rs`
- [Metrics](https://github.com/sinkaroid/jandapress/blob/master/src/metrics.rs): `src/metrics.rs`

### Other components

- **API clients**
- **Doujinshi sources**
- **Redis**

## Connections

- API clients → REST handlers: requests (evidence: `README.md`)
- API clients → GraphQL handler: queries (evidence: `README.md`)
- GraphQL handler → GraphQL schema: dispatches (evidence: `src/graphql/handler.rs`)
- REST handlers → nhentai adapter: invokes (evidence: `src/routes/rest.rs`)
- REST handlers → Pururin adapter: invokes (evidence: `src/routes/rest.rs`)
- REST handlers → Hentaifox adapter: invokes (evidence: `src/routes/rest.rs`)
- REST handlers → Asmhentai adapter: invokes (evidence: `src/routes/rest.rs`)
- REST handlers → Hentai2read adapter: invokes (evidence: `src/routes/rest.rs`)
- REST handlers → Simply Hentai adapter: invokes (evidence: `src/routes/rest.rs`)
- REST handlers → 3hentai adapter: invokes (evidence: `src/routes/rest.rs`)
- GraphQL schema → nhentai adapter: resolves via (evidence: `src/graphql/schema.rs`)
- GraphQL schema → Pururin adapter: resolves via (evidence: `src/graphql/schema.rs`)
- GraphQL schema → Hentaifox adapter: resolves via (evidence: `src/graphql/schema.rs`)
- GraphQL schema → Asmhentai adapter: resolves via (evidence: `src/graphql/schema.rs`)
- GraphQL schema → Hentai2read adapter: resolves via (evidence: `src/graphql/schema.rs`)
- GraphQL schema → Simply Hentai adapter: resolves via (evidence: `src/graphql/schema.rs`)
- GraphQL schema → 3hentai adapter: resolves via (evidence: `src/graphql/schema.rs`)
- nhentai adapter → HTTP and cache: fetches through (evidence: `src/scraper/nhentai.rs`)
- Pururin adapter → HTTP and cache: fetches through (evidence: `src/scraper/pururin.rs`)
- Hentaifox adapter → HTTP and cache: fetches through (evidence: `src/scraper/hentaifox.rs`)
- Asmhentai adapter → HTTP and cache: fetches through (evidence: `src/scraper/asmhentai.rs`)
- Hentai2read adapter → HTTP and cache: fetches through (evidence: `src/scraper/hentai2read.rs`)
- Simply Hentai adapter → HTTP and cache: fetches through (evidence: `src/scraper/simply_hentai.rs`)
- 3hentai adapter → HTTP and cache: fetches through (evidence: `src/scraper/threehentai.rs`)
- HTTP and cache → Cache backend: reads and writes (evidence: `src/jandapress.rs`)
- HTTP and cache → Doujinshi sources: fetches data (evidence: `src/jandapress.rs`)
- Cache backend → Redis: persists to (evidence: `README.md`)
- Server startup → Configuration: loads (evidence: `src/main.rs`)
- Server startup → REST handlers: registers (evidence: `src/main.rs`)
- Server startup → GraphQL handler: registers (evidence: `src/main.rs`)
- Server startup → Rate limiting: applies (evidence: `src/main.rs`)
- Server startup → Status endpoint: registers (evidence: `src/main.rs`)
- Server startup → API documentation: registers (evidence: `src/main.rs`)
- Server startup → Redirect handler: registers (evidence: `src/main.rs`)
- Server startup → Metrics: initializes (evidence: `src/main.rs`)
