Snooooze
Really, I just want to find interesting news and then splice, dice, and cherish it.
Stories older than about 10 days are archived. Stories you've liked are kept.
Under the hood
A news reader built by one developer to see how far a deliberately small stack can go: no web framework, no ORM, no front-end framework, and a server whose only third-party dependency is the Postgres driver.
Platform
- Server: Python 3.13 on its standard library alone (its own HTTP server, routing, sessions and templating). Runs in one Docker image; a scheduled job from the same image fetches the news.
- Data: PostgreSQL in production, SQLite on a laptop: the same portable SQL runs on both, with schema migrations applied at start-up. On Postgres, text search uses its full-text engine with per-language stemming and relevance ranking.
- Browser: plain TypeScript in strict mode, bundled per page with esbuild; no framework, and no state kept in the browser beyond the sign-in cookie: everything lives in the URL or the database.
- Language processing: a separate worker using spaCy's multilingual named-entity model and an offline index of Wikipedia titles and redirects to link names to Wikidata.
Features
- Several hundred RSS/Atom feeds and news APIs from around the world, in dozens of languages and scripts.
- Moods: saved searches made of clauses (sources, languages, labels, words, other moods), typed or picked as pills in one search box, combined with AND within a mood and OR between moods.
- Entities: people, places and organisations found in every story and identified by their Wikidata item, so "Путин" and "Putin" are the same person; browse them, chart how they co-occur, and search by them.
- Clusters: related stories grouped across languages, by shared words and shared entities.
- A raw-text view of each story with its entities highlighted where they were found, personal feeds, likes, and paywall labels for the papers you subscribe to.
Architecture
- Fetch reads every feed in parallel and stores new stories with their source's languages and labels.
- Enrich runs independently and can run on several machines at once: each claims a batch of stories, newest first, finds the names in them, resolves each to a Wikidata item and records where in the text it was found.
- Serve answers the pages and a small JSON API: a search is compiled to one SQL query; clustering builds TF-IDF and entity vectors for the stories shown and groups them by label propagation over their nearest neighbours.
- Old stories are pruned after about ten days (liked ones stay), keeping the database small.
Code quality
- Roughly 9,000 lines of Python and 4,500 of TypeScript, with about 250 unit tests (around 4,000 lines) run against SQLite, Postgres-specific tests against a throwaway Postgres, and a browser smoke test that signs in and opens every tab.
- TypeScript type-checked in strict mode; an average cyclomatic complexity of B (about 5) by Radon. Every API response has a declared shape that the tests check.
- Open source under the MIT License.
Released under the MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.