A privacy-focused Twitter/X frontend written in Rust.
Public instance: nitter.cf (also xitter.cf).
- Privacy-focused: No third-party JavaScript, tracking, ads, or remote fonts
- RSS feeds: Subscribe to any user's tweets
- SOCKS5 exits for GraphQL: Pin each cookie session to one proxy port so its apparent IP stays stable
- In-process cache: First-page search, profiles, and stale-while-revalidate so repeats do not wait on X
- FxEmbed-style Discord embeds:
- Multiple images displayed in carousel on mobile
- Videos play directly in the embed
- Proper image dimensions for better layout
- ActivityPub JSON endpoint for rich embeds
- Rust 1.96.1+
- Twitter/X session tokens for API access
- Optional: SOCKS5 endpoints if X blocks the server's own IP
cargo build --releaseThe crate and binary stay named teapot so existing configs and process
managers keep working.
- Copy the example config:
cp config/teapot.example.toml config/teapot.toml-
Edit
config/teapot.toml. Settitle = "teapawt"(or whatever you want shown in the navbar). -
Behind nginx or another TLS terminator, set
https = trueandpublicPort = 443so prefs bookmarks, RSS, andog:imagelinks omit the listen port (8471or whateverportis). -
Create a sessions file with your Twitter/X credentials:
cp sessions.example.jsonl sessions.jsonl
# Edit sessions.jsonl with your auth_token and ct0 from browser cookiesCookie sessions use auth_token and ct0. OAuth sessions use
oauth_token and oauth_secret. See sessions.example.jsonl for the JSONL
shape.
Never commit a real sessions.jsonl, config/teapot.toml, proxies.txt,
or session-proxies.json. Those paths are gitignored.
X GraphQL (search, profiles, tweets) can go out through SOCKS5. Media (/pic,
/video, /gif) stays on the optional HTTP proxy and does not use the
SOCKS list.
cp proxies.example.txt proxies.txt
# one host:port:user:pass per line# config/teapot.toml
socksProxiesFile = "proxies.txt"
sessionProxiesFile = "session-proxies.json"All lines must share one hostname (different ports are the rotating exits).
On startup teapawt DNS-probes that host, keeps the lowest-ping A record, and
pins each session id to one port. Pins are rewritten to sessionProxiesFile
as { "sessionId": port } only — credentials stay in proxies.txt.
apiProxy is an HTTP/HTTPS proxy for GraphQL when you are not using SOCKS.
It is ignored when socksProxiesFile is set.
Tunnels to x.com are HTTP/1.1 over TLS with keep-alive, TCP_NODELAY, and
rustls session resumption. Idle tunnels are reused for a short window so a
second search does not pay a new SOCKS + TLS handshake.
maxConcurrentReqsis per cookie session, not global. A busy public instance should set it to1000000. At that size the cap never queues a call, which matters once the instance is popular enough that every account would otherwise sit at a small limit.clientBudgetcaps how fast one visitor IP can spend uncached X calls. Cache hits, media, and static files are free. SearchTimeline costs 2 tokens.- First-page search is cached for 60 seconds, then served stale for 4 more minutes while a refresh runs.
- Profiles are cached for 5 minutes, then served stale for 20 more minutes.
- Search result pages seed user ids and prefetch a few profiles so a click often hits cache.
Empty HTTP 404s from SearchTimeline are treated as a brief X/WAF blip
(TransientUpstream) and retried on another session. Dead cookies are 401,
or 403 with code 326 — not those empty 404s.
Some queries fail with X error 214 (Query is denylisted in Search Content Control tool). That is X's platform denylist, not a teapawt setting.
# Development
cargo run
# Production
./target/release/teapotThe server listens on http://localhost:8080 by default (address / port
in the config).
To use the Twitter API, you need session tokens from a logged-in Twitter account:
- Log into Twitter/X in your browser
- Open Developer Tools (F12) → Application → Cookies
- Copy the values of
auth_tokenandct0 - Add them to
sessions.jsonl
teapawt/
├── src/
│ ├── main.rs # Entry point
│ ├── config.rs # Configuration
│ ├── error.rs # Error types
│ ├── types/ # Data structures (User, Tweet, Timeline, etc.)
│ ├── api/ # Twitter API client, SOCKS5 pool, OAuth, parsing
│ ├── cache/ # In-process cache (TTL + stale-while-revalidate)
│ ├── routes/ # HTTP route handlers
│ ├── views/ # Maud HTML templates
│ └── utils/ # Utilities (HMAC, formatters)
├── public/ # Static assets (CSS, JS, fonts, logo)
├── config/ # teapot.example.toml only
├── proxies.example.txt # Dummy SOCKS5 list
├── sessions.example.jsonl
└── Cargo.toml
This rewrite includes FxEmbed-style improvements for Discord embeds:
Discord can display all images from a tweet in a carousel. This works via an ActivityPub JSON endpoint at /users/{username}/statuses/{id} that returns media attachments.
Videos can be played directly in Discord embeds using twitter:player meta tags:
twitter:player- Embed URLtwitter:player:stream- Direct MP4 URLtwitter:player:width/height- Dimensions
All images include og:image:width and og:image:height meta tags for proper layout.
Running the public instance costs money for servers, bandwidth and the accounts and exits that keep it working. If nitter.cf is useful to you, donations help keep it online. Nothing is required.
| Coin | Address |
|---|---|
| BTC | bc1qtm4rep7kyp2p28hlkfktpnd0j7uew47vnt2mev |
| LTC | ltc1q9xlaysse0mpfwf025esd69kt9zu3md22gh23du |
| ETH | 0x6abA18D203520c8F90ca63eE7426a7bC345D98e6 |
| SOL | E5ekoiauCR8yiNp451dmuPzhUxo84P5x3m9WJBK5kxZe |
| XRP | r3jYXNdMk2Vz5hXhKCKE9re8uz93JQFG1r |
| DOGE | DSBq5jRWkiwmEh1G7zBwmQDgRkvRr61fmb |
| XMR | 85CTwq5wGjWZw5GgzgwZPrHyZxpLXMK5oZSSSk5j4x9w1bpqzisaWAUZYaAPfh6rP2MZJcaFqF1XmEzkw6YCqJSS2Txu6Z8 |