DejavuMoe/NanoRSS
Sobre
Tiny, secure and fast self-hosted RSS reader. One static Rust binary with SQLite and an embedded Svelte UI; SSRF-safe fetching, per-feed proxies, GitHub repository feeds, a public page with RSS/Atom/JSON Feed. 小巧、安全且快速的自托管 RSS 阅读器。一个静态 Rust 二进制文件,内置 SQLite 和嵌入式 Svelte UI;支持 SSRF 安全抓取、按订阅源配置代理、GitHub 仓库订阅源、提供 RSS/Atom/JSON Feed 的公开页面。
Produtividade e automaçãoO que você pode fazer
- image ≤ 12 MiB compressed;
- ≤ 25 MiB idle memory;
- ≤ 300 ms cold start.
- each connection's IP is checked against SSRF and DNS rebinding;
Crescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- Coletando histórico
- em 15 dias
- Coletando histórico
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
Original
NanoRSS
English · 简体中文
A tiny, secure and fast self-hosted RSS reader for one person. One static Rust binary, one SQLite file, one container.

Dark theme, the phone layout, and a public page.
Features
Single user, no external services. SQLite in WAL mode, a static musl binary and a distroless image. Each budget is enforced in CI:
- image ≤ 12 MiB compressed;
- ≤ 25 MiB idle memory;
- ≤ 300 ms cold start.
Safe fetching. Every outbound request goes through one HTTP client,
safehttp:- each connection's IP is checked against SSRF and DNS rebinding;
- every redirect hop is re-validated;
- size and time limits apply.
Feed HTML is sanitised with an allowlist, and the app runs under a strict CSP.
Named proxies. HTTP, HTTPS, SOCKS5 and SOCKS5h. Set one global default and override it per feed. If a proxy is down, the fetch fails; it never falls back to a direct connection.
GitHub repositories as feeds. Type
owner/repoto follow its Releases, Commits or Tags. An optional read-only token backfills history and tracks renames.Public page. Pick feeds or folders and publish them at
/p/<slug>:- a read-only web page with no JavaScript, where each article opens on a page of its own with previous / next links;
- RSS, Atom and JSON Feed, plus optional OPML.
It never exposes read state, internal IDs or (by default) source URLs.
The reader itself:
- Chinese and English interface, following the browser by default;
- command palette (
Ctrl/⌘+K) and full keyboard shortcuts; - focus mode;
- folders, OPML import and export;
- dark mode and a phone layout.
Quick start
mkdir nanorss && cd nanorss
curl -fsSLO https://raw.githubusercontent.com/DejavuMoe/NanoRSS/master/compose.yaml
mkdir data && sudo chown 65532:65532 data # the container runs as UID 65532
docker compose up -d
docker compose logs nanorss # prints a one-time setup token on first start
Open http://localhost:8080 and create your account with the setup token from the log.
Everything is stored in ./data, which must be on a local filesystem (SQLite WAL does not work on NFS or SMB). If the log says unable to open database file, the directory is not writable by UID 65532: run the chown above.
Production checklist
- Use HTTPS. Put a TLS reverse proxy in front, as shown in Reverse proxy. Only with an
https://address do session cookies getSecureand the__Host-prefix. - Keep the key-encryption key (KEK) outside the data directory. Create the file and uncomment its line in
compose.yaml:
Without it, a KEK is generated atopenssl rand -out nanorss_kek 32 sudo chown 65532:65532 nanorss_kek && sudo chmod 400 nanorss_kekdata/kekand the status page shows a warning, because a backup of./datathen contains the key as well. - Upgrade deliberately.
compose.yamlpins a release. To upgrade, change the image tag, then rundocker compose pull && docker compose up -d.
Reverse proxy
compose.yaml publishes NanoRSS on 127.0.0.1:8080 only, so a reverse proxy on the host terminates TLS. Tell NanoRSS its public address and that it may trust the proxy's X-Forwarded-For:
environment:
NANORSS_BASE_URL: "https://rss.example.com"
NANORSS_TRUSTED_PROXIES: "172.16.0.0/12"
Requests from the host reach the container from the gateway of its Docker network, which is inside 172.16.0.0/12 by default. With that setting, login throttling and public-page rate limiting see the real client IP.
172.16.0.0/12 is the quick default. It is broad: any peer in that range that can reach port 8080 may set X-Forwarded-For, and it misses networks Docker places elsewhere (192.168.* once the 172 range is used up, or custom default-address-pools). To trust only the gateway, use one of these:
Option A: look up the current gateway (no compose changes)
- Start the stack:
docker compose up -d. - Print the gateway NanoRSS sees, e.g.
172.18.0.1:docker inspect nanorss \ -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' - Set
NANORSS_TRUSTED_PROXIES: "172.18.0.1"and rundocker compose up -dagain.
The address stays the same while the network exists. After docker compose down, Docker may assign a different subnet, so repeat steps 2–3.
Option B: pin the subnet (stable across down/up)
- Pick a free
/24that does not overlap your LAN, VPN or other Docker networks (docker network inspect $(docker network ls -q) -f '{{.Name}} {{range .IPAM.Config}}{{.Subnet}}{{end}}'lists those in use). - Add to
compose.yaml:
If you enableservices: nanorss: environment: NANORSS_TRUSTED_PROXIES: "172.30.10.1" networks: [nanorss] networks: nanorss: ipam: config: - subnet: 172.30.10.0/24 gateway: 172.30.10.1warpsocks, put it on the same network (networks: [nanorss]). - Recreate the stack:
docker compose down && docker compose up -d.
Either way, keep the port published on 127.0.0.1 only, so nothing can bypass the reverse proxy.
Caddy (obtains the certificate itself):
rss.example.com {
reverse_proxy 127.0.0.1:8080
}
nginx (with a certificate from certbot):
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name rss.example.com;
ssl_certificate /etc/letsencrypt/live/rss.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/rss.example.com/privkey.pem;
client_max_body_size 2m; # OPML import
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
server {
listen 80;
listen [::]:80;
server_name rss.example.com;
return 301 https://$host$request_uri;
}
Images
ghcr.io/dejavumoe/nanorss is published for linux/amd64 and linux/arm64, with SBOM and provenance attestations. Each GitHub Release also carries static binaries and SHA-256 checksums.
| Tag | Meaning |
|---|---|
latest |
latest release |
vX.Y.Z |
a specific release, e.g. v0.1.2; compose.yaml pins the newest one |
edge |
latest green build of master, for testing |
The container is hardened and needs no shell:
- it runs as UID 65532 with a read-only root filesystem;
- all capabilities are dropped and
no-new-privilegesis set; - the health check uses the built-in
nanorss healthcheck.
How it works
flowchart LR
browser["Browser (Svelte SPA)"] -- "/api/v1 · session + CSRF" --> api
visitor["Anonymous visitor / feed reader"] -- "/p/{slug} · no cookies" --> public
subgraph nanorss["nanorss process"]
api["Admin JSON API"] --> svc["Services"]
public["Public page (server-rendered, zero JS)"] --> proj["Public projections only"]
svc --> writer["Single writer thread"]
svc --> readers["Read-only pool"]
proj --> readers
writer --> db[("SQLite (WAL)")]
readers --> db
sched["Scheduler"] --> workers["Workers (global + per-host limits)"]
workers --> safehttp["safehttp"]
workers --> pipeline["parse → sanitise → store"] --> writer
end
safehttp -- "direct or via named proxy" --> internet(("Internet"))
Four rules keep the design small and safe:
- Only one way out: all outbound HTTP goes through
safehttp. - Only one HTML pipeline: third-party HTML is sanitised (ammonia) before it is stored.
- Only one keyring: secrets (GitHub token, proxy passwords) are encrypted at rest and never logged.
- The public surface is isolated: it reads only public projections and never touches admin data.
One fetch
flowchart TD
due["Feed due (adaptive interval, ± jitter)"] --> req["Conditional GET (ETag / Last-Modified)"]
req --> check{"URL and resolved IPs allowed?"}
check -- no --> fail["Fail, back off"]
check -- yes --> resp{"Response"}
resp -- 304 --> next["Schedule next fetch"]
resp -- 200 --> parse["Parse (feed-rs, entity-safe)"] --> clean["Sanitise HTML, summarise"] --> store["Upsert entries in one transaction"] --> next
resp -- "3xx" --> hop["Re-check every hop (≤ 3)"] --> check
resp -- "4xx / 5xx / network error" --> fail
fail --> next
The interval adapts to how often a feed actually updates (5 minutes to 24 hours) and respects Retry-After, Cache-Control and Expires. After repeated failures it backs off exponentially, and a feed that has been broken for a week is paused. The full design is in docs/design.md (Chinese).
Proxies
flowchart LR
feed["Feed"] --> mode{"Network setting"}
mode -- "Use default" --> def{"Default proxy set?"}
def -- no --> direct["Direct: resolve + check every IP, connect to the checked IP"]
def -- yes --> proxy
mode -- "Direct" --> direct
mode -- "Named proxy" --> proxy{"Proxy type"}
proxy -- "socks5" --> local["Resolve and check locally, send the IP to the proxy"]
proxy -- "socks5h / http(s)" --> remote["Proxy resolves the name; hostname-level check only"]
local & remote --> failclosed["Proxy down → fetch fails (never direct)"]
Configuration
Environment variables (all prefixed NANORSS_):
| Variable | Default | Description |
|---|---|---|
BASE_URL |
http://localhost:8080 |
External URL: origin checks, absolute links in public feeds, cookie policy |
LISTEN |
0.0.0.0:8080 |
Listen address |
DATA_DIR |
/data |
Data directory |
KEK_FILE |
/run/secrets/nanorss_kek |
32-byte KEK (raw bytes or base64) |
TRUSTED_PROXIES |
empty | Reverse-proxy CIDRs whose X-Forwarded-For is trusted, comma separated |
PASSWORD_HASH |
standard |
Password hashing cost (Argon2id): standard needs 19 MiB for a moment at each login, strong 64 MiB and more CPU time. A change applies at the next login |
FETCH_CONCURRENCY / FETCH_PER_HOST |
8 / 2 |
Global / per-host fetch concurrency |
FETCH_TIMEOUT |
20s |
Per-request timeout |
FETCH_MAX_BODY |
15MiB |
Maximum decompressed body |
FETCH_ALLOW_CIDRS |
empty | Private ranges you allow fetching from (all private targets are refused by default) |
FETCH_ALLOW_PORTS |
empty | Target ports allowed in addition to 80/443 |
LOG / LOG_FORMAT |
info / text |
Log filter and format (text / json) |
Everything else lives in the web UI under Settings → General: default proxy, polling interval, retention, shortcuts, theme and language.
Proxy with warpsocks
warpsocks exposes Cloudflare WARP as a SOCKS5 proxy. It registers a free WARP identity on first start (no account needed), which gives feed fetching a different egress.
In
compose.yaml, set up the sidecar:- uncomment the
warpsocksservice and changeSOCKS_PASS; - uncomment
depends_on: [warpsocks]undernanorss.
It needs no published port; NanoRSS reaches it over the compose network.
- uncomment the
docker compose up -d.In NanoRSS, go to Settings → Proxies → Add proxy:
- protocol
socks5h, hostwarpsocks, port1080; - the same username and password;
- then run the test.
- protocol
Make it the default proxy under Settings → General, or pick it for individual feeds.
socks5h is recommended: names are resolved on the proxy side, through WARP. WARP cannot reach your LAN, so set LAN feeds to Direct.
GitHub repositories
Under Settings → GitHub, enter owner/repo or a repository URL and choose Releases, Commits and/or Tags.
- Without a token: only GitHub's public Atom feeds are used (about the latest 10 items per source), and no API quota is spent.
- With a token:
- older Releases (30) and Commits (50) are backfilled when you subscribe;
- renames and default-branch changes are synced daily;
- a repository that turns private is removed from the public page automatically.
Use a fine-grained personal access token with Repository access set to "Public repositories (read-only)" and no extra permissions. The token is stored encrypted and sent only to api.github.com.
Public page
Under Settings → Public page:
- Give the page a title.
- Choose the feeds or folders to share. Feeds added to a folder later are included automatically.
- Turn on Publish this page and save.
| URL | Content |
|---|---|
/p/<slug> |
Web page (no JavaScript, paginated) |
/p/<slug>/<time>-<id> |
One article (unless the page shows titles only) |
/p/<slug>/feed.xml |
RSS 2.0 |
/p/<slug>/feed.atom |
Atom 1.0 |
/p/<slug>/feed.json |
JSON Feed 1.1 |
/p/<slug>/subscriptions.opml |
OPML (opt-in; exposes the feed URLs) |
Defaults:
- a random slug, which you can customise or rotate to invalidate old links;
- summaries only;
- source URLs hidden;
noindex.
The page's own text follows the visitor's browser language (Chinese or English). An unpublished or unknown page always returns 404. Each IP may make 120 requests per minute.
Backup
Settings → General → System → Back up now writes a consistent SQLite snapshot into the data directory.
Keep the KEK (nanorss_kek, or data/kek if you did not create one) together with the backup. Without it, the encrypted GitHub token and proxy passwords cannot be decrypted.
Development
The toolchain is managed by mise (mise.toml). Rust builds and tests run on Linux, and GitHub Actions is the source of truth.
mise install # rust / node / pnpm (plus zig and cargo-zigbuild on Linux)
mise run web-build # build the SPA into web/dist
mise run test # Rust tests
mise run lint # rustfmt + clippy + svelte-check
mise run dev-server # backend on :8080
mise run dev-web # Vite dev server (proxies /api to :8080)
mise run docker # build the image
CI/CD
flowchart LR
push["push / PR / tag"] --> web["web: check + bundle budget"]
push --> lint["fmt · clippy"]
push --> test["test · scale budget"]
push --> deny["cargo-deny"]
push --> build["build amd64 · arm64 (static musl, builds the SPA itself)"]
build --> image["image: size, cold-start, memory budgets + hardened smoke test"]
web & lint & test & deny & image --> gate{"all green"}
gate -- "master" --> edge["push :edge"]
gate -- "tag vX.Y.Z" --> rel["push :vX.Y.Z + :latest"]
gate -- "tag vX.Y.Z" --> ghrel["GitHub Release: binaries, checksums, bilingual notes"]
Pull requests build with a faster link profile. master and tags build the fully optimised release binary. A separate workflow runs CodeQL code scanning on pull requests, master and weekly.
Stack: Rust (axum · rusqlite · reqwest · ammonia · feed-rs) and a Svelte 5 SPA (Vite · TypeScript). Read CONTRIBUTING.md (workflow, tests, releases) and AGENTS.md before contributing; the test strategy is in docs/testing.md. Report vulnerabilities privately as described in SECURITY.md. Changes are listed in CHANGELOG.md.
License
Explore projetos relacionados
Carregando…