Annotate PostgreSQL functions and SQL files with comments to declare HTTP routes, auth, caching, retries, and rate limits. Get a fast, typed REST API — no controllers, no models, no boilerplate. Then test it with SQL files too.
NewsNpgsqlRest 4.0 is here: over 20% more requests per second with about 30% less CPU and half the memory or less, now on .NET 11. Benchmarks are coming soon. What's new →
News Try PlumeSQL, our new PostgreSQL IDE that turns SQL into tools, now in beta. Extensible, featherweight, free, no account. macOS, Windows and Linux. NpgsqlRest integration is coming soon. Download →
⚡
Fast & native
AOT executables. 3,500+ req/s on 4 dedicated cores in reproducible benchmarks.
📝
Declare in SQL
Caching, auth, retries, rate limits — declared as SQL comments next to the query.
🐘
Database-first
PostgreSQL is the architecture — not a detail to abstract away.
🔄
Typed clients
PostgreSQL types generate typed TypeScript and Dart (Flutter) clients — plus TanStack Query hooks (v3.20). No drift.
🔒
Secure by default
Cookies, JWT, OAuth2, conditional caching, per-user limits — built in.
🤖
AI-agent ready
@mcp exposes any endpoint as an MCP tool for AI agents — same auth, same rate limits — plus OpenAI/Anthropic tool schemas and llms.txt (v3.20).
✅
Tests in SQL
npgsqlrest --test runs plain .sql tests against real endpoints, in-process and transactional — with watch mode and endpoint coverage (v3.19).
💚
Open source
MIT-licensed. No paid tier, no telemetry, no vendor lock-in.
No middle tier — no controllers, no models, no mapping layers, no boilerplate.
Iterate 5× faster — schema is the single source of truth; signature changes propagate to typed clients automatically, and an entire class of type-drift bugs simply cannot happen.
Production-grade by default — response caching, rate limiting, retries, PostgreSQL multi-host failover, load balancing, and Excel/HTML response rendering — configured in JSON, not custom middleware.
You write SQL, not a URL query language — unlike client-composed query APIs, the API surface is exactly the SQL you wrote: joins, CTEs, window functions — auditable with grep.
The whole dev loop in SQL — tests are plain .sql files run against real endpoints in-process (--test), and watch mode (--watch) restarts on SQL, config, and even database routine changes.
Built for the AI era — one type system to reason about, machine-verified output (schema check at startup, generated TypeScript checked by tsc), and @mcp tools for AI agents — with OpenAI/Anthropic tool schemas and llms.txt generated from the same catalog.
PostgreSQL in. REST API, typed TypeScript client, and AI-agent tools out — with real, reproducible numbers from a product in production. Use the arrows, thumbnails, or your keyboard (←/→, F for fullscreen, N for speaker notes).
SQL declares what data. Annotations declare what behavior. Configuration declares what infrastructure. Tests declare what correctness — also in SQL. There is no imperative glue anywhere — no controllers, no services, no mappers to keep in sync. And it is built on the declarative language that has been running the world's data for 50 years — the one every developer, and every LLM, already knows: SQL.
No test framework, no running server, no mocks. npgsqlrest --test invokes the real endpoint pipeline in-process, on the test's own transaction — insert fixtures, call the endpoint (it sees your uncommitted rows), assert with SQL, roll back.
sql
-- tests/get_users.test.sqlbegin;insert into users (email) values ('fixture@example.com');/*GET /api/get-users# @claim user_id=1*/select status = 200, 'authenticated caller gets 200' from _response;select body::jsonb @> '[{"email": "fixture@example.com"}]', 'fixture is listed' from _response;rollback;
Parallel isolated connections, throwaway test databases, per-test clones, tags, JUnit XML, and endpoint coverage with a CI threshold gate. And with --watch, the running server restarts on SQL file, configuration, and database routine changes — create or replace a function in psql and the endpoint is live seconds later, TypeScript client regenerated.