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
3•vanflymen•1h ago

Comments

vanflymen•1h 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.

The AI build-out is powering global goods trade

https://www.ft.com/content/ad169119-4a62-437b-b6ec-70819b1e8b4f
1•alephnerd•1m ago•0 comments

Mist: Open-source Markdown editor with AI-native comments and suggested edits

https://interconnected.org/home/2026/04/10/open-mist
1•austinbirch•1m ago•0 comments

Cloudflare Turnstile Is Down

1•owenthejumper•2m ago•0 comments

Unpatched vuln in RAGFlow allows for post-auth RCE

https://zeropath.com/blog/ragflow-rce-unpatched-vulnerability
1•NonStopOyster•3m ago•0 comments

Does Trump think he's God?

https://www.taxresearch.org.uk/Blog/2026/04/13/does-trump-think-hes-god/
3•only_in_america•4m ago•0 comments

Tell HN: Claude-code prompt-cache fix

1•g4cg54g54•5m ago•1 comments

Gas Town Notes and Spaced Repetition Prompts

https://www.meadow-notes.com/sites/v5v5wwby974a-gas-town-vGEa1tk/gt/Gas%20Town.html
3•gmccreight2•6m ago•1 comments

What Now (and What's Next)

https://www.strix.ai/blog/your-first-visitors-arent-users-theyre-bots
2•bearsyankees•7m ago•0 comments

The GPU Moat Has a Side Door: AI Research Outside the Frontier Labs

https://mangeshgupte.substack.com/p/the-gpu-moat-has-a-side-door
1•achllies•7m ago•0 comments

Agentic Search Leaderboard

https://www.algolia.com/llm-leaderboard/
1•matthieu_bl•9m ago•0 comments

Artemis II Is Back

1•anju-kushwaha•11m ago•0 comments

Did you notice the command error exit in the shell?

https://monzool.net/blog/2026/04/10/error-banner-in-shell/
1•birdculture•12m ago•0 comments

Beyond the Sky: How Jeffery Yan built Hyperliquid

https://colossus.com/article/beyond-the-sky-jeffrey-yan-hyperliquid/
1•firloop•12m ago•0 comments

Show HN: Turn Text into Beautiful Font

https://fontgeneratorx.com/
2•artiomyak•13m ago•0 comments

Cognitive science can help us design better software – CogZest

https://cogzest.com/2026/04/how-cognitive-science-can-help-us-design-better-software/
2•LucCogZest•15m ago•0 comments

137-Year-Old Piece of Eiffel Tower to Be Auctioned in Paris

https://www.nytimes.com/2026/04/09/world/europe/eiffel-tower-auction.html
1•paulpauper•15m ago•0 comments

Show HN: A Chatting Website That Uses Nostr

https://inbondz-chat.pages.dev
1•wasimsk•15m ago•1 comments

The Effects of Gender Integration on Men: Evidence from the U.S. Military

https://academic.oup.com/qje/advance-article/doi/10.1093/qje/qjag016/8551347?login=false
2•paulpauper•15m ago•0 comments

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

2•amans9712•16m ago•0 comments

What explains heterogeneity in AI adoption?

https://www.siliconcontinent.com/p/what-explains-heterogeneity-in-ai
1•paulpauper•16m ago•0 comments

Draining Wallets via Prompt Injection in Coinbase AgentKit

https://457e884c.x402warden-blog.pages.dev/research/coinbase-agentkit-prompt-injection/
1•xxmrlnxx•18m ago•0 comments

The Process Is the Product

https://tylermaran.substack.com/p/the-process-is-the-product
1•themanmaran•18m ago•0 comments

The Rational Conclusion of Doomerism Is Violence

https://www.campbellramble.ai/p/the-rational-conclusion
7•thedudeabides5•19m ago•3 comments

Average Is All You Need

https://rawquery.dev/blog/average-is-all-you-need
1•AlexC04•19m ago•0 comments

Multiplicity

https://m-u-l-t-i-p-l-i-c-i-t-y.org/
1•marukodo•20m ago•0 comments

Consensus Formation and Change Are Enhanced by Neutrality

https://advanced.onlinelibrary.wiley.com/doi/10.1002/advs.202512301
1•PaulHoule•20m ago•0 comments

Warp DB

https://warp.thegeeksquad.io/
1•thunderbong•21m ago•0 comments

Gram 1.0 Released

https://gram.liten.app/posts/first-release/
1•DiabloD3•21m ago•0 comments

I Built an Autonomous Flying Umbrella [video]

https://www.youtube.com/watch?v=EYRrUiM_A6g
2•CharlesW•21m ago•0 comments

Show HN: Mcptube – Karpathy's LLM Wiki idea applied to YouTube videos

https://github.com/0xchamin/mcptube
1•0xchamin•22m ago•0 comments