Architecture Pitfalls: Don’t use your ORM entities for everything — embrace the SQL!

This page summarizes the projects mentioned and recommended in the original post on /r/programming

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • sqlx

    🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, and SQLite. (by launchbadge)

  • The sqlx library is what I hope to see the next generation of ORMs to look like though technically it's anti-ORM in a lot of ways. Embracing the features of an advanced object relational database like PostgreSQL directly is a major productivity and expressiveness boost but yes, manually mapping your rows to your DTOs and working with raw strings is major source of bugs. sqlx virtually solves this by:

  • gnorm

    A database-first code generator for any language

  • Furthermore, there can be a lot of boilerplate queries we do that it's nice to not have to write, say, the same kind of delete query over and over. In the past I've used gnorm as one way of generating all that boilerplate code based on the actual database design, and it works reasonably well, but again it plays a similar role to an ORM.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • supabase

    The open source Firebase alternative.

  • Just as an addendum, the supabase.com team are bullish on the power and value of leaning heavily into the database. iirc, they're also the team behind postgREST which makes it easy to spin up a full REST API on the back of a PostgREST database. I used to think this kind of approach was a disaster, but I've changed my mind significantly. When being willing to use stored procedures, you can spin up this REST API, AND use the same stored procedures for your application as well, to ensure consistency of business logic, all without needing a separate business logic API middleware service between DB and the rest of the world. It's not all roses, but it is pretty amazing.

  • postgrest

    REST API for any Postgres database

  • Just as an addendum, the supabase.com team are bullish on the power and value of leaning heavily into the database. iirc, they're also the team behind postgREST which makes it easy to spin up a full REST API on the back of a PostgREST database. I used to think this kind of approach was a disaster, but I've changed my mind significantly. When being willing to use stored procedures, you can spin up this REST API, AND use the same stored procedures for your application as well, to ensure consistency of business logic, all without needing a separate business logic API middleware service between DB and the rest of the world. It's not all roses, but it is pretty amazing.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts