dubase
v1.0.0
Published
DuBase: Self-hosted, multi-project Supabase control repo
Downloads
7
Readme
DuBase
DuBase is a self-hosted, multi-project Supabase control repo.
It uses the official Supabase Docker stack under docker/ and adds one manager script so you can run isolated project instances side by side.
What You Get
- Full Supabase self-host stack (Postgres, Auth, REST, Realtime, Storage, Studio, etc.)
- Isolated env/data per project in
instances/<project>/ - Automatic secret generation and port allocation
- Optional S3-mode storage (MinIO-backed) per project
Prerequisites
- Docker + Docker Compose
openssl- Linux/macOS/Windows host with enough resources for Docker
System Requirements
| Resource | Minimum | Recommended | | --- | --- | --- | | RAM | 4 GB | 8 GB+ | | CPU | 2 cores | 4 cores+ | | Disk | 50 GB SSD | 80 GB+ SSD |
Quick Start (NPM)
The easiest way to use DuBase is via npx (requires Node.js):
# Start a new project named 'my-app'
# This initializes, pulls, starts the project, and prints your API keys.
npx dubase start my-appGenerate documentation for AI assistants:
npx dubase docsQuick Start
./scripts/dubase doctor
./scripts/dubase init project-one
./scripts/dubase pull project-one
./scripts/dubase up project-one
./scripts/dubase api project-one --token dev-secret-token
./scripts/dubase console --port 4173
./scripts/dubase status project-oneList all projects:
./scripts/dubase listStop one project:
./scripts/dubase down project-oneMain Commands
./scripts/dubase doctor
./scripts/dubase init <project-name> [--offset N]
./scripts/dubase credentials <project-name>
./scripts/dubase api <project-name> [--port N] [--token TOKEN]
./scripts/dubase console [--port N]
./scripts/dubase pull <project-name>
./scripts/dubase up <project-name> [--s3 | --file-storage]
./scripts/dubase update <project-name> [--s3 | --file-storage]
./scripts/dubase down <project-name>
./scripts/dubase status <project-name>
./scripts/dubase logs <project-name> [service]
./scripts/dubase destroy <project-name> [--delete-data]
./scripts/dubase listProject Layout
instances/<project>/.env- per-project secrets and portsinstances/<project>/data- per-project persisted DB/storage datadocker/- upstream Supabase Docker stack files
Storage Modes
- Default: file-backed storage (
DUBASE_STORAGE_MODE=file) - S3 mode: MinIO-backed (
DUBASE_STORAGE_MODE=s3)
Enable S3 mode:
./scripts/dubase up project-one --s3Switch back to file mode:
./scripts/dubase up project-one --file-storageSecurity Notes
initgenerates unique secrets per project ininstances/<project>/.env.- Before internet exposure, review production values for
SUPABASE_PUBLIC_URL,API_EXTERNAL_URL,SITE_URL,DASHBOARD_USERNAME, andDASHBOARD_PASSWORD. - Put the stack behind TLS/reverse proxy before production.
- Keep backups for
instances/<project>/data.
Accessing Services
After up, each project is available at the project's KONG_HTTP_PORT:
- Studio:
http://localhost:<KONG_HTTP_PORT> - REST:
http://localhost:<KONG_HTTP_PORT>/rest/v1/ - Auth:
http://localhost:<KONG_HTTP_PORT>/auth/v1/ - Storage:
http://localhost:<KONG_HTTP_PORT>/storage/v1/ - Realtime:
http://localhost:<KONG_HTTP_PORT>/realtime/v1/ - Functions:
http://localhost:<KONG_HTTP_PORT>/functions/v1/hello
Frontend Console
Run the project API and frontend:
./scripts/dubase api project-one --token dev-secret-token
./scripts/dubase console --port 4173Open http://localhost:4173 and connect with:
- DuBase API URL:
http://127.0.0.1:7000(or your chosen API port) - API Token:
dev-secret-token(if set)
The console includes:
- database list + create database
- schema/table browser
- bucket/object browser + create bucket
- SQL runner (read-only safety toggle)
API Keys For Other Projects
To get keys and URLs for a DuBase project:
./scripts/dubase credentials project-oneIt prints:
API URL(Supabase base URL)ANON_KEY(safe for client-side use with RLS)SERVICE_ROLE_KEY(server-only full access)
Use ANON_KEY in frontend apps, and keep SERVICE_ROLE_KEY only in trusted backend services.
DuBase API (Databases, Tables, RLS)
Start API:
./scripts/dubase api project-one --token dev-secret-tokenExample requests:
Create database:
curl -X POST http://127.0.0.1:7000/v1/databases \
-H "Authorization: Bearer dev-secret-token" \
-H "Content-Type: application/json" \
-d '{"name":"appdb"}'Note: Supabase API services in this stack are wired to the configured POSTGRES_DB value (default postgres). Extra databases are raw Postgres databases; for most projects, create separate DuBase instances or use separate schemas.
Create table and enable RLS:
curl -X POST http://127.0.0.1:7000/v1/tables \
-H "Authorization: Bearer dev-secret-token" \
-H "Content-Type: application/json" \
-d '{
"schema":"public",
"name":"profiles",
"columns":[
{"name":"id","type":"uuid","nullable":false,"default":"gen_random_uuid()"},
{"name":"user_id","type":"uuid","nullable":false},
{"name":"display_name","type":"text","nullable":true}
],
"primary_key":["id"],
"enable_rls":true
}'Enable RLS later:
curl -X POST http://127.0.0.1:7000/v1/rls/enable \
-H "Authorization: Bearer dev-secret-token" \
-H "Content-Type: application/json" \
-d '{"schema":"public","table":"profiles","force":false}'Create RLS policy:
curl -X POST http://127.0.0.1:7000/v1/rls/policies \
-H "Authorization: Bearer dev-secret-token" \
-H "Content-Type: application/json" \
-d '{
"schema":"public",
"table":"profiles",
"name":"profiles_select_own",
"command":"SELECT",
"roles":["authenticated"],
"using":"auth.uid() = user_id"
}'Run SQL directly:
curl -X POST http://127.0.0.1:7000/v1/sql/run \
-H "Authorization: Bearer dev-secret-token" \
-H "Content-Type: application/json" \
-d '{"sql":"select * from public.profiles limit 10","read_only":true}'Rootless Docker Note
If rootless Docker is detected, DuBase sets DOCKER_SOCKET_LOCATION to /run/user/<uid>/docker.sock automatically during init.
Upstream Base
The docker/ directory is sourced from the official Supabase repository and then adapted here for multi-instance operation.
