NpgsqlRest Installation Guide
Download Executable
Manual Installation
You can always manually download the latest version executable from the official Release page.
Release page downloads include builds for:
- Win64 Systems
- Linux64 Systems
- Linux ARM64 Systems - For Raspberry Pi, AWS Graviton, Apple Silicon Linux VMs, etc.
- MacOS ARM64 Systems
All executables are self-contained, around 35–40 MB depending on the platform, so the download can take up to 30 seconds depending on your connection speed.
The optional default configuration file is also included, but this is just for convenience; it works with the same default values without this configuration file.
Additional builds (e.g., MacOS x64) may be added in the future.
Command Line Download
Windows (x64)
powershell
# Download using PowerShell
Invoke-WebRequest -Uri "https://github.com/NpgsqlRest/NpgsqlRest/releases/latest/download/npgsqlrest-win64.exe" -OutFile "npgsqlrest.exe"
# Optionally add to PATH or move to desired locationLinux (x64)
bash
# Download the executable
wget https://github.com/NpgsqlRest/NpgsqlRest/releases/latest/download/npgsqlrest-linux64 -O npgsqlrest
# Make it executable
chmod +x npgsqlrest
# Optionally move to the system path
sudo mv npgsqlrest /usr/local/bin/Linux (ARM64)
bash
# Download the ARM64 executable (for Raspberry Pi, AWS Graviton, etc.)
wget https://github.com/NpgsqlRest/NpgsqlRest/releases/latest/download/npgsqlrest-linux-arm64 -O npgsqlrest
# Make it executable
chmod +x npgsqlrest
# Optionally move to the system path
sudo mv npgsqlrest /usr/local/bin/macOS (ARM64)
bash
# Download the executable
curl -L https://github.com/NpgsqlRest/NpgsqlRest/releases/latest/download/npgsqlrest-osx-arm64 -o npgsqlrest
# Make it executable
chmod +x npgsqlrest
# Optionally move to the system path
sudo mv npgsqlrest /usr/local/bin/Command Line Basic Commands
You can run some basic commands to test your installation. Assuming that the binary name is npgsqlrest, you can
- Check versions. This includes the client version and all included components:
bash
# Show versions
npgsqlrest --version
npgsqlrest -v- See some help information:
bash
# Show help
npgsqlrest --help
npgsqlrest -h- Inspect configuration with syntax highlighting:
bash
# Show current configuration (syntax highlighted in terminal, plain JSON when piped)
npgsqlrest --config- Validate configuration and database connectivity:
bash
# Pre-flight check (exits with code 0 on success, 1 on failure)
npgsqlrest --validate- List all supported SQL comment annotations:
bash
# Everything that is read from comments, as a JSON array: core annotations, and the annotations and
# custom parameters of every plugin and handler (upload, table formats, tsclient, dartclient, mcp,
# openapi), of SQL test files and of HTTP Custom Types
npgsqlrest --annotationsEach entry has name, aliases, syntax and description, and (since 4.0.0) owner (who reads it), form (keyword, key_value, keyword_or_key_value or line), contexts (routine, sql_file, sql_file_statement, test_file, type_comment), valueKind, and where they apply values, default and example. Editors use it for completion and validation.
- List the endpoints the current configuration creates, and what each comment did:
bash
# Needs the database: endpoints are built, printed as JSON, and the process exits
npgsqlrest --endpointsBesides the method, path, routine, parameters and settings, each endpoint lists (since 4.0.0) routine.sourceFile (the file of a SQL file endpoint), annotations (the comment lines read as annotations), commentLines (the prose, which OpenAPI and MCP publish as the description), unknownAnnotations (lines written as @name ... that nothing reads), unknownCustomParameters (key = value keys that nothing reads) and diagnostics (the warnings logged about that endpoint's comment).
- Find out why something is not an endpoint, and what was generated for each endpoint (since 4.1.0):
bash
# Needs the database, like --endpoints. Prints one JSON object: endpoints, notExposed, generatedFiles
npgsqlrest --inspectnotExposed lists every routine and SQL file that was looked at and did not become an endpoint, with a reason and a message that says what to change:
reason | What it means |
|---|---|
no_comment | It has no comment, and the CommentsMode creates endpoints only for annotated routines. |
no_http_annotation | Its comment (for a SQL file, its comments) has no HTTP line. |
unprefixed_annotations | Its HTTP line is written without @ and RequireAtPrefix is on. |
disabled | Its comment has the disabled annotation. |
tag_mismatch | Its HTTP line comes after a for <tags> line that does not name this routine. |
excluded_by_filter | A schema, name or language setting leaves it out; the message names the setting. Only routines whose comment has an HTTP line are reported. |
sql_error | A SQL file that PostgreSQL does not accept or the parser rejects; diagnostics has the error. |
empty_file | A SQL file without a statement. |
Like --endpoints and like a normal start, --inspect runs the enabled generators (it writes the client, HTTP and OpenAPI files; that is how it knows their lines). An endpoint without an HTTP route, such as an MCP-only tool, has "internalOnly": true.
A SQL file that is in neither list was never read: it is not matched by SqlFileSource:FilePattern, or it is matched by SkipPattern. --inspect keeps going when a SQL file has an error, so one broken file does not hide the others.
Each endpoint also has a generated list (in --endpoints too): the files written for it by the TypeScript client and its hooks, the Dart client, HTTP files and OpenAPI, with the name it has there (symbol) and the line where it begins in the file as written (line). generatedFiles lists every generated file once.
json
"generated": [
{ "generator": "tsclient", "file": "/app/src/api/orders.ts", "role": "client", "symbol": "getOrders", "line": 42 },
{ "generator": "httpfiles", "file": "/app/http/public.http", "role": "requests", "symbol": "GET {{host}}/api/orders", "line": 7 }
]- See how a comment is read, without a database (since 4.1.0):
bash
# The comments of a SQL file, as the SQL file source reads them ('-' reads standard input)
npgsqlrest --parse=sql/orders.sql
# The comment of a function, procedure, table or view (the text of COMMENT ON ... IS)
npgsqlrest --parse-comment=comment.txtThe output lists every comment line with its number and its kind: annotation (with the canonical name, the owner that reads it and its form), text (the description) or unknown_annotation (written with @, read by nothing). endpoint says whether the text would become an endpoint, and when not, reason and message say why. RequireAtPrefix and CommentsMode are taken from the configuration. What depends on the routine itself (parameters, tags, types) needs the database: use --inspect for that.
- Install the Claude Code skill matching your version:
bash
# Into the project (./.claude/skills/npgsqlrest — commit it for the whole team)
npgsqlrest --install-skill
# Or per user (~/.claude/skills/npgsqlrest)
npgsqlrest --install-skill globalNPM Installation
bash
# Install globally
npm install -g npgsqlrest
# Or install locally in the project
npm install npgsqlrest
# Or install locally as a dev dependency
npm install --save-dev npgsqlrestTo check versions or see help information, use the NPX runner:
bash
# Show versions
npx npgsqlrest --version
npx npgsqlrest -v
# Show help
npx npgsqlrest --help
npx npgsqlrest -hNote: The NPM package doesn't bundle the executable — a postinstall script downloads the appropriate binary for your operating system from the GitHub releases page during installation. The binary is around 35–40 MB, so the install can take up to 30 seconds depending on your connection speed.
Bun Installation
Bun blocks postinstall scripts by default, and the npgsqlrest package uses one to download the binary for your OS from the GitHub releases page. After installing, you need one additional step to mark the package as trusted:
bash
# Install locally in the project
bun add npgsqlrest
# Mark the package as trusted to run the postinstall script that downloads the binary
bun pm trust npgsqlrestOr do both in a single step with the --trust flag:
bash
# Install locally in a single step
bun add --trust npgsqlrest
# Install locally as a dev dependency
bun add --dev --trust npgsqlrest
# Install globally — the --trust flag is required here,
# because bun pm trust only works inside a project
bun add --global --trust npgsqlrestTo check versions or see help information, use the bunx runner:
bash
# Show versions
bunx npgsqlrest --version
bunx npgsqlrest -v
# Show help
bunx npgsqlrest --help
bunx npgsqlrest -hNote: Without the trust step, the package installs but the executable is never downloaded, and running it will fail. The trust step itself triggers the 35–40 MB binary download and can take up to 30 seconds.
Deno Installation
Deno also blocks npm lifecycle scripts by default, and it only runs them when the project uses a node_modules directory. In a Deno-first project, enable it in deno.json (projects that have a package.json already use one):
json
{
"nodeModulesDir": "auto"
}Then install with the --allow-scripts flag so the postinstall script can download the binary for your OS from the GitHub releases page — around 35–40 MB, up to 30 seconds:
bash
# Install locally in the project
deno install --allow-scripts=npm:npgsqlrest npm:npgsqlrest
# Install locally as a dev dependency
deno install --dev --allow-scripts=npm:npgsqlrest npm:npgsqlrest
# Install globally
deno install -g -A --allow-scripts npm:npgsqlrestTo check versions or see help information, use the Deno runner — -A grants the wrapper permission to execute the downloaded binary:
bash
# Show versions
deno run -A npm:npgsqlrest --version
# Show help
deno run -A npm:npgsqlrest --helpDocker Installation
Standard Image (AOT)
bash
# Pull the latest image (optional, docker run will do this if the image is not pulled)
docker pull vbilopav/npgsqlrest:latest
# Check versions for all components
docker run --name npgsqlrest -it vbilopav/npgsqlrest:latest --version
# See help
docker run --name npgsqlrest -it vbilopav/npgsqlrest:latest --help
# Run with configuration file and with default port exposed.
# The default Urls value (http://localhost:8080) binds only inside the container,
# so set Urls to http://*:8080 here or in the mounted appsettings.json.
docker run --name npgsqlrest -it -p 8080:8080 -e Urls="http://*:8080" -v ./appsettings.json:/app/appsettings.json vbilopav/npgsqlrest:latestJIT Image
A Docker image variant using .NET runtime with JIT (Just-In-Time) compilation instead of AOT:
bash
# Pull the JIT image variant
docker pull vbilopav/npgsqlrest:latest-jit
# Run with JIT runtime
docker run --name npgsqlrest-jit -it -p 8080:8080 -e Urls="http://*:8080" -v ./appsettings.json:/app/appsettings.json vbilopav/npgsqlrest:latest-jitIn the November 2026 benchmark, the JIT build had about 5% more throughput on average (10–20% on small requests, none on row-heavy ones), while the AOT build answered its first request about four times sooner (0.3 s against 1.2 s), idled on 23 MB instead of 39 MB and used about 40% less memory under load. That makes the AOT image the default choice; it is also smaller (~60 MB vs ~110 MB compressed on Docker Hub). Use the JIT image when you need the full .NET runtime (for example, for diagnostics tooling) or to compare the two under your own workload.
Available JIT image tags:
vbilopav/npgsqlrest:latest-jit- Latest version with JITvbilopav/npgsqlrest:v4.1.0-jit- Specific version with JIT
ARM64 Image
A Docker image variant for ARM64 architecture (Raspberry Pi, AWS Graviton, Apple Silicon Linux VMs, etc.):
bash
# Pull the ARM64 image variant
docker pull vbilopav/npgsqlrest:latest-arm
# Run with ARM64 runtime
docker run --name npgsqlrest-arm -it -p 8080:8080 -v ./appsettings.json:/app/appsettings.json vbilopav/npgsqlrest:latest-armThe ARM64 build is compiled natively on GitHub's ARM64 runners for optimal performance on ARM-based systems.
Available ARM64 image tags:
vbilopav/npgsqlrest:latest-arm- Latest version for ARM64vbilopav/npgsqlrest:v4.1.0-arm- Specific version for ARM64
Bun Runtime Image
A Docker image variant with pre-installed Bun JavaScript runtime is available:
bash
# Pull the Bun image variant
docker pull vbilopav/npgsqlrest:latest-bun
# Run with Bun runtime available
docker run --name npgsqlrest-bun -it -p 8080:8080 -v ./appsettings.json:/app/appsettings.json vbilopav/npgsqlrest:latest-bunThis image includes the Bun JavaScript runtime alongside NpgsqlRest, enabling proxy endpoints to execute Bun scripts within the same container. Useful for scenarios where you need lightweight proxy handlers without external service calls.
Available Bun image tags:
vbilopav/npgsqlrest:latest-bun- Latest version with Bunvbilopav/npgsqlrest:v4.1.0-bun- Specific version with Bun
Building From Source
Before building NpgsqlRest from source, ensure you have the following installed:
Latest .NET SDK (from https://dotnet.microsoft.com/download)
Git (to clone the repository)
PostgreSQL 13+ (for testing the build)
Clone the repository
bash
git clone https://github.com/NpgsqlRest/NpgsqlRest.git
cd NpgsqlRest- Standard Build
bash
dotnet build- AOT (Ahead-of-Time) Compilation
NpgsqlRest supports AOT compilation for native executables:
bash
# Windows (x64)
dotnet publish -r win-x64 -c Release --output ./dist
# Linux (x64) - must be run on Linux
dotnet publish -r linux-x64 -c Release --output ./dist
# macOS (ARM64)
dotnet publish -r osx-arm64 -c Release --output ./distFor more information on build targets for specific OS, see the .NET RID Catalog
The AOT-compiled executable will be approximately 35–40 MB depending on the target platform and is self-contained with no runtime dependencies. The built executable will have the same functionality as the pre-compiled releases available on the GitHub releases page.
Claude Code Skill
If you use Claude Code, install the official NpgsqlRest skill as part of your setup — it teaches the agent the exact annotations and configuration options for the current release, instead of guessing them from training data. It can be installed per project (committed to the repository, so the whole team gets it) or per user.
See the Claude Code Skill guide for what's in it and how to install it.
Next Steps
- Quick Start - Create your first endpoint
- Comment Annotations Guide - Use SQL comments to configure endpoints
- Annotations Reference - Complete reference of all annotations
- Configuration Reference - Complete reference for all configuration options