
ORM / Query Layer
Raw SQL
Just write SQL — a thin driver like `pg` or `postgres.js`.
Monthly cost
Free
Popularity
5/5
LLM knowledge
5/5
Difficulty
Medium
#open-source
What Raw SQL is good at
Strengths
- +Zero abstraction
- +Maximum perf
- +No ORM tax
Tradeoffs
- −No type safety for free
- −Manual mapping
Coding-agent prompt
Drop into Claude / Cursor to get idiomatic Raw SQL code.
You're working with Raw SQL. Just write SQL — a thin driver like `pg` or `postgres.js`. Best practices: - Lean on: zero abstraction - Lean on: maximum perf - Lean on: no orm tax Things to watch for: - Watch out for: no type safety for free - Watch out for: manual mapping General guidance: - Follow the official docs — don't invent APIs. - Keep secrets in environment variables, never commit them. - Write TypeScript where the ecosystem supports it; add types to every exported function. - Add tests for the critical paths before declaring the task done. - Read-the-docs is usually faster than guessing — cite the docs page in code comments when you apply a non-obvious pattern.
Beginner's guide to Raw SQL
In one line: Skip the ORM — write SQL by hand for maximum control.
You use a simple driver like `pg` or `postgres.js` and write SQL queries directly. Zero abstraction, maximum performance, but no type safety for free.
Try it in your terminal
npm install pgInstall the Postgres driver.
Browse all categories