Skip to content

Commit e9c6828

Browse files
committed
docs: add architecture diagram and request lifecycle
1 parent 1e5f54c commit e9c6828

4 files changed

Lines changed: 53 additions & 1 deletion

File tree

docker-compose.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ services:
77
restart: unless-stopped
88
ports:
99
- "127.0.0.1:4000:4000"
10-
env_file: .env
10+
env_file:
11+
- path: .env
12+
required: false
1113
environment:
1214
RACK_ENV: production
1315
PORT: 4000

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Welcome! This is the canonical source of truth for contributing to `html2rss-web
55
## Docs Index
66

77
- **Start here for contributors**: This document.
8+
- **Architecture & Request Lifecycle**: [docs/architecture.md](architecture.md)
89
- **UI/Design rules**: [docs/design-system.md](design-system.md)
910
- **Agent execution constraints**: [AGENTS.md](../AGENTS.md)
1011
- **Generated contract artifacts**: `public/openapi.yaml`

docs/architecture.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Architecture & Request Lifecycle
2+
3+
This document provides a mental model of how `html2rss-web` processes requests.
4+
5+
## High-Level Data Flow
6+
7+
```text
8+
[ User / RSS Reader ]
9+
|
10+
v
11+
[ Roda App (app/web/routes) ] <--- [ Auth / Security (app/web/security) ]
12+
|
13+
v
14+
[ Feeds Service (app/web/feeds) ] <--- [ Cache (app/web/feeds/cache) ]
15+
|
16+
v
17+
[ html2rss Gem ] <--- [ Request Strategies (Faraday / Browserless) ]
18+
|
19+
v
20+
[ Target Website ]
21+
```
22+
23+
## Request Lifecycle
24+
25+
### 1. Routing & Auth
26+
Requests enter via `app.rb` and are dispatched to `app/web/routes/`.
27+
- **API v1**: Authenticated via `app/web/security/auth.rb`.
28+
- **Public Feeds**: Validated via HMAC tokens in `app/web/security/feed_token.rb`.
29+
30+
### 2. Resolution
31+
The `Html2rss::Web::Feeds::SourceResolver` determines where the feed configuration comes from:
32+
- **Static**: Pre-defined in `config/feeds.yml`.
33+
- **Dynamic**: Generated on-the-fly via the `/api/v1/feeds` endpoint (AutoSource).
34+
35+
### 3. Fetching & Rendering
36+
The `Html2rss::Web::Feeds::Service` orchestrates the extraction:
37+
1. Checks the `Html2rss::Web::Feeds::Cache`.
38+
2. If stale/missing, calls the `html2rss` gem with the resolved strategy.
39+
3. Renders the output using `RSSRenderer` (XML) or `JSONRenderer`.
40+
41+
## Extension Points
42+
43+
### Adding a Request Strategy
44+
Strategies are defined by the `html2rss` gem but can be configured here.
45+
- **Faraday**: Default HTTP client for static HTML.
46+
- **Browserless**: Used for JavaScript-heavy websites.
47+
48+
To add or configure strategies, see `app/web/feeds/source_resolver.rb` and the `html2rss` gem documentation.

frontend/src/styles/main.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ a:focus-visible {
342342

343343
.notice__title {
344344
color: var(--text-strong);
345+
font-weight: var(--text-strong);
345346
}
346347

347348
.notice[data-tone='error'] {

0 commit comments

Comments
 (0)