gregrickaby/viewer-for-reddit
gregrickaby/viewer-for-reddit has 58 GitHub stars and 18 forks. GitHot measured 0 stars in 24 hours and 0 in 7 days. Last checked 2026-11-18 13:02 UTC. Last push 2026-11-16.
Measured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
π Surf Reddit without ads or algorithms.
Web & AppsREADME.md
OriginalViewer for Reddit
Surf Reddit without ads or algorithms: https://reddit-viewer.com
Viewer for Reddit is a Reddit client built on Next.js and React Server Components. It signs in with Reddit's official OAuth. The browser never calls Reddit's API: the server makes every read and write, through Server Components and Server Actions, and sends pages already rendered.
- Feeds: home, popular, subreddits, multireddits, user profiles, saved posts, search.
- Actions: vote, save, comment, reply, edit and delete, subscribe to communities and follow users, and create and edit multireddits. Each one updates the page at once and rolls back if Reddit refuses.
- Media: images, galleries with a lightbox, GIF loops, Reddit video with sound (HLS), and click-to-load embeds (YouTube, Vimeo, Streamable, Twitch, Redgifs, Giphy, Imgur, TikTok, Spotify, SoundCloud), plus inline images and GIFs in comments.
- Live: a thread sorted by New polls for new comments and for edits to the post, such as a score, every 15 seconds. Reddit live threads (
/live/β¦) show updates as they are posted, and/activelists the busiest game, match, and daily threads. The server does the polling through Server Actions, so the browser still never calls Reddit, and public threads are cached for 10 seconds to stay inside Reddit's shared request limit. - Settings: light, dark, or system theme, and "Blur NSFW media". Both are stored in cookies.
Version 10 is a ground-up rewrite. Version 9 and earlier (built with Mantine) are in the 9.1.0 tag.
Setup
Requirements: Node 24 and npm.
Create a Reddit app at https://www.reddit.com/prefs/apps:
- Type: web app.
- Redirect URI:
https://localhost:3000/api/auth/callback/reddit.
Configure the environment:
cp .env.example .env.localFill in the client id and secret, a
USER_AGENTsuch asweb:viewer-for-reddit:10.0.0 (by /u/yourname), and two secrets:openssl rand -base64 48 # SESSION_SECRET (32+ characters) openssl rand -base64 32 # NEXT_SERVER_ACTIONS_ENCRYPTION_KEY.env.localis git-ignored. Never commit it.Install and run:
npm install npm run devThe dev server runs over HTTPS (
next dev --experimental-https), because Reddit requires a secure redirect URI and the session cookies areSecure. Open https://localhost:3000 and accept the local certificate.
Scripts
| Command | What it does |
|---|---|
npm run dev |
Dev server on https://localhost:3000 |
npm run build / npm start |
Production build and server |
npm run check |
CSS module types, tsc, Oxlint and Stylelint, then unit tests with coverage |
npm test |
Vitest with coverage; fails below 90% branches, functions, lines, or statements |
npm run test:e2e |
Playwright: builds the app and runs it against a mock Reddit (no credentials needed) |
npm run format |
Oxfmt |
npm run types:generate |
Regenerates lib/reddit/schemas/generated.ts from the committed samples in fixtures/reddit/things |
npm run media:corpus |
Rebuilds tests/media/corpus from local raw captures |
Before running e2e for the first time, install the browser with npx playwright install chromium.
Fixtures and types
Types come from real Reddit JSON:
- Sign in on the dev server, then visit https://localhost:3000/api/dev/capture. It captures a scrubbed set of listings, threads, and account data into
fixtures/reddit/raw/. This is local only and git-ignored. The route returns 404 outsidenext dev. npm run types:generateextracts per-kind samples intofixtures/reddit/things/(committed), then generates Zod schemas with quicktype.
Curated schemas in lib/reddit/schemas sit on top of the generated ones.
Testing and CI
- Unit tests (Vitest, in
tests/unit) render Server Components to HTML withprerender, and test client islands in happy-dom. - End-to-end tests (Playwright, in
e2e/) run againste2e/mock-reddit/server.ts. It is an in-memory Reddit that records writes and can inject latency and failures. The tests use it to check optimistic updates and their rollback. - GitHub Actions:
ci.ymlruns the checks and e2e on every push and PR.
Security
- OAuth tokens live only in sealed, httpOnly cookies.
proxy.tsrefreshes them. - All Reddit HTML is sanitized before it renders.
- Every response carries a static Content Security Policy plus
X-Content-Type-Options,Referrer-Policy,Permissions-Policy,Cross-Origin-Opener-Policy, and (over HTTPS)Strict-Transport-Security, all set inlib/security/headers.ts. - The policy has no nonces. A nonce needs every page rendered per request, and Partial Prerendering serves a prerendered shell.
Support
- Report bugs and request features in GitHub Issues.
- Support the project: Buy Me a Coffee, Venmo, PayPal.
License
MIT Β© Greg Rickaby. See LICENSE.
Viewer for Reddit is an independent project not affiliated with Reddit, Inc. "Reddit" and the Snoo logo are trademarks of Reddit, Inc. See Reddit's brand guidelines, API terms, and API documentation.