Skip to content

NpgsqlRestAutomatic PostgreSQL Web Server

Create professional, high-performance HTTP REST APIs for PostgreSQL databases in minutes and generate type-safe client code automatically.

NpgsqlRest
NpgsqlRest Architecture - PostgreSQL at the center with automatic REST API, TypeScript generation, authentication, caching, and more

Clean PostgreSQL Architecture - PostgreSQL First Architecture - PostgreSQL Driven Architecture

  • โœ“ Schema as contract โ€” Tables, views, and functions become REST endpoints
  • โœ“ SQL comments as config โ€” Routes, auth, caching declared where the logic lives
  • โœ“ Types flow outward โ€” PostgreSQL types generate TypeScript clients automatically
  • โœ“ No middle tier โ€” No ORM mismatch, no N+1 queries, no boilerplate

Declarative Annotations โ€‹

Simple comment annotations turn PostgreSQL functions into fully-featured REST endpoints.

sql
create function api.get_users(
  _department_id int
  _format text
)
returns setof user_info 
language sql
as $$
select id, name, email, role 
from users 
where _department_id is null or department_id = _department_id;
$$;

comment on function api.get_users(int, text) is '
HTTP GET /users/
@authorize admin, user
@cached
@cache_expires_in 30sec
@timeout 10sec
@retry_strategy aggressive
@rate_limiter_policy authenticated_limit
@validate _format using json_or_excel
@table_format = {_format}
@tsclient_module = users
';

Blog โ€‹


Build, Test, Publish and ReleaseLicenseGitHub StarsGitHub ForksCrafted with Claude
โค๏ธ Support this project: Patreon ยท Buy Me a Coffee
Released under the MIT License.
Copyright ยฉ 2024-2026 VB Consulting