frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: 15 yrs of Django in prod: patterns I keep using (agent skills)

https://github.com/dvf/opinionated-django
5•vanflymen•3h ago

Comments

vanflymen•3h ago
I've been building in Django for a long time and I love the framework, but some things have always bugged me:

- Typing is exceptionally painful...and getting proper type safety across a Django project is a fight

- the ORM leaks throughout your project: it's easy to chain ORM methods in a view, a serializer, a template tag, a Celery task, etc and N+1s end up being difficult to find

- models become god objects: custom managers, save overrides, signal handlers, computed properties, validation logic, your models attract everything until they're 500 lines of tangled responsibilities.

- tests become slow over time because you either hit the DB for everything or mock too aggressively: this is because there's no clear encapsulated layers.

and a ton of other stuff including aesthetics...

Anyway, the short version of my solution is to push all ORM work into repositories that return Pydantic DTOs. Services get repos via constructor injection and contain pure business logic with zero model imports. Your views become one-liners. Every layer boundary is typed, and each layer is independently testable.

Some of the opinions:

- Prefixed ULID primary keys: double-clickable Stripe-style IDs like ord_01jq3v... on every model.

- Models are dumb but aesthetic: Meta first, fields in a strict order (identifiers, times, status, domain, relations), all indexes and constraints declared explicitly in Meta, zero business logic.

- Repositories return DTOs, never querysets so the ORM never leaks past this layer. This is where 90% of Django's typing hassles end.

- Services own the business logic injected via https://svcs.hynek.me, tested without a database by mocking the repo. This makes tests super fast and composable.

- Thin django-ninja routes give you input validation and OpenAPI for free, handlers are just calling services get(MyService).do_thing() in a DI-esque way.

- Reliable signals via Celery side-effects enqueued inside the DB transaction so rollbacks are respected. This gets us pretty close to a DBOS or Temporal. Adapted from https://hakibenita.com/django-reliable-signals.

Three test layers the repos test against a real DB, service against mocked repos, API through mocked services. This keeps the tests fast and clean.

Disclaimer: These are super opinionated. They won't be everyone's cup of tea, and that's fine. But they've held up well on large-scale projects and I thought they might be useful to others who are looking for a clean way to structure Django beyond the "everything in views.py" stage.

Show HN: boringBar – a taskbar-style dock replacement for macOS

https://boringbar.app/
477•a-ve•1d ago•272 comments

Show HN: Bloomberg Terminal for LLM ops – free and open source

5•amans9712•2h ago•1 comments

Show HN: Oberon System 3 runs natively on Raspberry Pi 3 (with ready SD card)

https://github.com/rochus-keller/OberonSystem3Native/releases
230•Rochus•1d ago•79 comments

Show HN: I built a social media management tool in 3 weeks with Claude and Codex

https://github.com/brightbeanxyz/brightbean-studio
167•JanSchu•9h ago•111 comments

Show HN: 15 yrs of Django in prod: patterns I keep using (agent skills)

https://github.com/dvf/opinionated-django
5•vanflymen•3h ago•1 comments

Show HN: Equirect – a Rust VR video player

https://github.com/greggman/equirect
11•greggman65•10h ago•1 comments

Show HN: Crafto – AI carousel post generator for LinkedIn and Instagram

https://crafto.ai
4•xz_tie•4h ago•0 comments

Show HN: Claudraband – Claude Code for the Power User

https://github.com/halfwhey/claudraband
114•halfwhey•1d ago•42 comments

Show HN: The Infinite Tolkien – endless narration of Middle-earth

http://infinitetolkien.com/
3•Jarlakxen•6h ago•1 comments

Show HN: Turn your favorite YouTube channels into a streaming experience

https://minitube.tv
6•renatoworks•6h ago•9 comments

Show HN: Git-style branching for your Rails database

https://github.com/carldaws/activerecord-postgresql-branched
3•carldaws•7h ago•0 comments

Show HN: Pardonned.com – A searchable database of US Pardons

495•vidluther•2d ago•268 comments

Show HN: Real-Time, Streaming SQL Queries on Flight Data

https://dashboard.transcend.modolap.com/queries?mode=demo
4•ronfriedhaber•8h ago•0 comments

Show HN: Kyomu - 13 puzzles from math and physics that map your cognitive style

https://mostlykiguess.github.io/Kyomu/
4•mostlyk•9h ago•2 comments

Show HN: A social feed with no strangers

https://www.grateful.so/
8•rpatni•20h ago•5 comments

Show HN: FluidCAD – Parametric CAD with JavaScript

https://fluidcad.io/
155•maouida•3d ago•37 comments

Show HN: Bad Apple (Oscilloscope-Like) – one stroke per frame

https://bad-apple-on-oscilloscope.pages.dev/
5•araniwa•13h ago•1 comments

Show HN: A WYSIWYG word processor in Python

https://codeberg.org/chrisecker/miniword
87•chrisecker•3d ago•39 comments

Show HN: I built a Cargo-like build tool for C/C++

https://github.com/randerson112/craft
174•randerson_112•4d ago•166 comments

Show HN: Eve – Managed OpenClaw for work

https://eve.new/login
71•zachdive•3d ago•39 comments

Show HN: Narrate – Generate multi-voice long-form audio with one command

https://github.com/zackham/narrate
5•zackham•16h ago•2 comments

Show HN: Waffle – Native macOS terminal that auto-tiles sessions into a grid

https://waffle.baby
38•olleeolleeollee•2d ago•20 comments

Show HN: CSS Studio. Design by hand, code by agent

https://cssstudio.ai
172•SirHound•4d ago•107 comments

Show HN: Local LLM on a Pi 4 controlling hardware via tool calling

https://github.com/stfurkan/pi-llm
3•stfurkan•19h ago•3 comments

Show HN: Keeper – embedded secret store for Go (help me break it)

https://github.com/agberohq/keeper
63•babawere•3d ago•33 comments

Show HN: Rekal – Long-term memory for LLMs in a single SQLite file

https://github.com/janbjorge/rekal
3•jeeybee•21h ago•2 comments

Show HN: SnatchHub – An App That Solves The "who's using staging?" Problem

https://getsnatchhub.com
3•boothemoo•21h ago•0 comments

Show HN: Druids – Build your own software factory

https://github.com/fulcrumresearch/druids
64•etherio•4d ago•15 comments

Show HN: Stork – MCP server so Claude/Cursor can search 14k MCP servers AI tools

https://www.stork.ai
2•usestork•22h ago•0 comments

Show HN: A Better Internet

https://tomclancy.info/pages/abi-a-better-internet.html
10•tclancy•1d ago•3 comments