# QueryAPIGate - self-hosted service that turns saved SQL queries into REST endpoints with per-key access control (source-available) — retained record

> Retained reddit record from reddit:selfhosted.

Canonical: https://highsignal.app/data/records/3472103dae889470

[← sources](https://highsignal.app/data)


source: [reddit](https://highsignal.app/data/reddit) (reddit:selfhosted)  published 2026-09-26 04:10 ingested 2026-09-27 02:38

[original source ↗](https://www.reddit.com/r/selfhosted/comments/1wqgusv/queryapigate_selfhosted_service_that_turns_saved/)

## retained text



```
I built a small self-hosted service for a problem I kept hitting: someone needs "just these numbers" from a database as
an API, and I did not want to hand out database credentials or write another controller.

You write a SQL query once, save it, and it becomes an endpoint with validated parameters. Then you decide who can call
it: API keys can be scoped to specific queries (or a group of them), with expiry, rate limits and an IP allowlist. Every
admin change is written to an audit log. There is an admin UI, OpenAPI docs and Prometheus metrics.

**Run it** (this exact command is tested):

    docker run -d -p 5000:5000 -v queryapigate-data:/data \
      -e QUERYAPIGATE_API_KEY=change-me -e QUERYAPIGATE_LOAD_EXAMPLES=yes \
      ghcr.io/anantharajuc/queryapigate:latest
    # then open http://localhost:5000/ui  (paste the key into the box at the top)

**Self-hoster details**
- One container, one volume: everything (connections, saved queries, keys, audit log) is plain JSON in `/data`, so backup
  is copying a folder. (A named volume needs no host permission setup; a bind-mounted folder must be writable by uid 1000.)
- Idle memory was about 70 MiB in my test; the image is about 230 MB and runs as a non-root user.
- It makes no outbound network calls of its own - it only talks to the databases you configure. No telemetry.
- Databases: MySQL, PostgreSQL, ClickHouse, SQLite, DuckDB, H2, generic JDBC.
- Read-only by default; write access is opt-in and can be limited per key.
- Put it behind your reverse proxy for TLS; connection passwords can be `${ENV_VAR}` references or encrypted at rest.

**Honest limits:** it is a single process (rate limits and in-app metrics are per process), the config is JSON files rather
than a database, and it is a young project (v0.7).

**License:** source-available (FSL-1.1-MIT) - free to run at home or at work, not to resell as a competing product/service,
and each release turns into MIT after two years. I know that is not everyone's cup of tea; I would rather say it upfront.

Repo: https://github.com/AnanthaRajuC/QueryAPIGate  ·  60-second demo: https://youtu.be/WWImFj4m95o

Happy to answer questions or take feedback on what you would want before running something like this.

```



document fetched 2026-09-27 00:30 · canonical https://reddit.com/r/selfhosted/comments/1wqgusv/queryapigate_selfhosted_service_that_turns_saved
