Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

KeepSupabaseAlive logo

KeepSupabaseAlive

Self-hosted dashboard & scheduler to keep free-tier Supabase projects from pausing.

MIT License Bun Next.js 16 TypeScript shadcn/ui Docker Coolify

KeepSupabaseAlive — dashboard for Supabase health checks

Quick start · Features · Coolify · How it works · API · Contributing


Note: This project is not affiliated with, endorsed by, or sponsored by Supabase. It is an independent open-source tool built by the community for developers who self-host their infrastructure.

The problem

Supabase pauses free-tier projects after about 7 days without API activity. If a project stays paused for 90 days, it can be permanently deleted.

Many developers run side projects on the free tier and forget to touch them — this app automates scheduled database pings so your projects stay awake.

Features

📊 Dashboard All projects, live status, 24h success rate
➕ Project management Add, pause, resume, delete from the UI
📈 Activity chart shadcn/ui stacked area chart (24h / 3d / 7d)
⏱️ Built-in scheduler Cron-style checks every minute; pings when due
⚡ Manual ping Trigger an immediate health check
🐳 Self-hosted SQLite only (one file + WAL), Docker, Coolify — no other database backends
🔐 Dashboard auth Optional HTTP Basic Auth via DASHBOARD_PASSWORD (recommended in production)
🛡️ Safe by design Auth token ping only — no accounts created, no data read or written, no service_role key

How it works

flowchart LR
  A[Scheduler] --> B{Due?}
  B -->|yes| C["POST /auth/v1/token"]
  C --> D[Supabase project]
  D --> E[SQLite logs]
  E --> F[Dashboard chart]
Loading

Every minute, the built-in scheduler checks which projects are due. For each project it sends:

POST https://<project-ref>.supabase.co/auth/v1/token?grant_type=password
apikey: <your-anon-public-key>
Authorization: Bearer <your-anon-public-key>
Content-Type: application/json

{"email":"[email protected]","password":"keepalive-ping-do-not-create"}

GoTrue receives this request and queries auth.users to verify the credentials — a real PostgreSQL round-trip that Supabase’s inactivity tracker counts as project activity. The credentials are intentionally fake; GoTrue returns 400 invalid_grant, which the app treats as success (the project is alive and responsive). A 5xx or network timeout means the project is paused or unreachable.

Why not /auth/v1/health? Supabase excludes health-check endpoints from activity tracking to prevent abuse. Any real API request (one that queries the database) is required to reset the inactivity timer.

What this app does not do

  • Create user accounts or send emails
  • Read or write your application data
  • Use the service_role key

Only the public anon key is stored, and only on your self-hosted instance.

Quick start

Prerequisites

  • Bun 1.2+ (recommended) or Node.js 24+ (LTS)

Local development

git clone https://github.com/flogesell/keepsupabasealive.git
cd keepsupabasealive
cp .env.example .env
bun install
bun run dev

Open http://localhost:3000 → Add project and fill in:

Field Where to find it Example
Name Any label My side project
URL or ref Project Settings → API → Project URL https://abcdefgh.supabase.co or abcdefgh
Anon key Project Settings → API → anon public eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Interval How often to ping Every 6 hours (recommended)

Use the anon public key only. Never use service_role.

Dashboard URLs like https://supabase.com/dashboard/project/<ref> are also accepted — the project ref is extracted automatically.

Deploy with Coolify

Persistence: this app only supports SQLite at DATABASE_PATH (default /data/keepsupabasealive.db in Docker). There is no PostgreSQL or other database option — mount a directory volume on /data as documented below.

Coolify   Add this GitHub repository as your Coolify application source.

  1. In Coolify → + New → Application.

  2. Under Source, choose GitHub (or GitLab / Gitea) and select this repository — public or private after authorizing Coolify once.

  3. Pick your branch (e.g. main) and set the build pack to Dockerfile.

  4. Add Persistent Storage (application → Storages → + Add).

    Volume mount (recommended)

    Field Value
    Name data (Coolify may append your app UUID to avoid clashes)
    Source Path (leave empty — Docker creates the volume)
    Destination Path /data

    On first start the entrypoint runs briefly as root to chown the database directory, then node runs as UID 1001 (nextjs). Do not mount a single file to DATABASE_PATH — use a volume on /data with an empty Source Path. The production image defaults to SQLITE_JOURNAL_MODE=DELETE (no -wal / -shm); set SQLITE_JOURNAL_MODE=WAL only if you prefer WAL and your volume supports it.

  5. Add these environment variables:

Variable Value Required
DATABASE_PATH /data/keepsupabasealive.db Yes — never ./data/... in Coolify
DASHBOARD_PASSWORD Long random password Yes (production)
ENCRYPTION_KEY openssl rand -hex 32 Yes (production)
CRON_SECRET openssl rand -hex 32 Yes (production)
DASHBOARD_USER admin (default) No
PORT 3000 Usually set by Coolify
  1. Set health check path to /api/health → Deploy.

Scheduled health checks: the app runs an in-process scheduler (every minute). After deploy, logs should show [scheduler] Started. If automatic pings still do not run, add a Coolify Scheduled Task (every minute):

curl -fsS -X POST -H "Authorization: Bearer YOUR_CRON_SECRET" https://your-domain.example/api/cron

Do not set DISABLE_SCHEDULER=true unless you rely on that external cron only.

Docker Compose

docker compose up -d --build

Data persists in the keepsupabasealive-data volume.

Environment variables

Variable Default Description
DATABASE_PATH ./data/keepsupabasealive.db SQLite database file
DASHBOARD_PASSWORD — HTTP Basic Auth (required in production)
DASHBOARD_USER admin Username for Basic Auth
ENCRYPTION_KEY — AES-256-GCM encryption for anon keys at rest (required in production)
CRON_SECRET — Bearer token for POST /api/cron (required in production)
DISABLE_SCHEDULER false Set true to disable built-in pings
SQLITE_JOURNAL_MODE WAL Use DELETE only if the DB volume cannot create WAL sidecars (rare)
DRIZZLE_MIGRATIONS_FOLDER (auto) Absolute path to drizzle/ if not next to the server
PORT 3000 HTTP port

Generate secrets:

openssl rand -hex 32   # ENCRYPTION_KEY and/or CRON_SECRET

API

Method Path Description
GET /api/projects List projects with stats (anon keys omitted)
POST /api/projects Create a project
PATCH /api/projects/:id Update a project
DELETE /api/projects/:id Delete a project
POST /api/projects/:id/ping Run a health check now
GET /api/stats?hours=24 Chart data (hours: 1–168)
POST /api/cron Run all due pings (Authorization: Bearer <CRON_SECRET>, required in production)
GET /api/health App health check

Security

Production checklist

When NODE_ENV=production, the app refuses to start without:

Variable Purpose
DASHBOARD_PASSWORD HTTP Basic Auth on dashboard + API
ENCRYPTION_KEY Encrypts Supabase anon keys in SQLite
CRON_SECRET Bearer token for POST /api/cron

Deployment checklist:

  • Set all three variables above (use openssl rand -hex 32)
  • Serve the app over HTTPS (Coolify / reverse proxy)
  • Mount /data on a persistent volume with restricted host access
  • The container starts as root only for the entrypoint (chown on /data), then runs Node as UID 1001
  • Never store service_role keys — anon public keys only
  • Restrict who can reach the URL (VPN / IP allowlist optional extra layer)
  • Back up /data securely — backups contain encrypted keys
  • After enabling ENCRYPTION_KEY, restart once — existing plaintext keys are auto-migrated

What is protected

Layer Behavior
Dashboard & API HTTP Basic Auth when DASHBOARD_PASSWORD is set
Failed logins Rate limited (5 failures / 15 min per IP); browser is redirected to /rate-limited (no Basic Auth on that path)
Anon keys in DB Encrypted at rest with ENCRYPTION_KEY (AES-256-GCM)
API responses Anon keys never returned from GET /api/projects
SQL injection Drizzle ORM + Zod validation — no raw user SQL
Remote DB access SQLite file only — no open database port

Public endpoints (by design)

Path Why
/api/health Coolify / Docker health checks
/api/cron Requires Authorization: Bearer <CRON_SECRET> in production

Local development

With NODE_ENV unset or development, auth and encryption env vars are optional:

  • No DASHBOARD_PASSWORD → dashboard open
  • No ENCRYPTION_KEY → anon keys stored as plaintext in SQLite
  • No CRON_SECRET → /api/cron accepts unauthenticated requests

Login keeps asking for the password (production)

The browser dialog needs both username and password:

Field Value
Username admin (unless you set DASHBOARD_USER to something else)
Password Exactly DASHBOARD_PASSWORD from Coolify — no extra spaces or quotes

Common causes of an endless prompt:

  1. Blank DASHBOARD_USER in Coolify — Remove the variable entirely, or set a real username. An empty value is not the same as unset; the app used to expect an empty username in that case (fixed in recent versions — redeploy after updating).
  2. Trailing newline in Coolify — Re-paste the password or regenerate it; stray line breaks in the env value make every login fail.
  3. Wrong username — Safari/Chrome may pre-fill an email as the username; use admin (or your custom DASHBOARD_USER).
  4. Second HTTP Basic Auth in front — If Coolify/Traefik also has Basic Auth enabled for this app, disable it and rely on DASHBOARD_PASSWORD only (or you will get two prompts and mismatched credentials).
  5. Stale container env — After changing env vars, redeploy/restart the app so the running container picks them up.

Verify from your machine (replace host and password):

curl -s -o /dev/null -w "%{http_code}\n" -u admin:YOUR_PASSWORD https://your-domain.example/

200 means credentials match; 401 means username/password/env still do not match what the container has.

API returns 500 (Failed to load projects, Failed to create project, etc.)

  1. SQLite not writable — Use a directory volume on /data (empty Source Path), not a file mount for the .db file. In Coolify, clear any custom container user so the entrypoint can chown once. Check deploy logs for keepsupabasealive: — the container exits there with a concrete hint if the directory is not writable. As a last resort set SQLITE_JOURNAL_MODE=DELETE.
  2. Missing drizzle/ in the image — Deploy with the repo Dockerfile (it copies drizzle/). If you run the standalone bundle elsewhere, set DRIZZLE_MIGRATIONS_FOLDER to the folder that contains meta/_journal.json.
  3. Check container logs — The server logs the underlying error; the JSON body may include a hint field with a short explanation.

Container user (Docker / Coolify)

The long‑running process is not root: it runs as user nextjs (UID 1001). Only the entrypoint runs briefly as root to chown the /data volume so SQLite can create the DB and WAL files on typical Coolify/Docker mounts — no manual chown on the host.

If your platform disallows root entirely (including entrypoint), set a writable DATABASE_PATH for the user your platform assigns, or use a volume that is already owned by that UID.

Limitations

  • HTTP Basic Auth sends credentials per request (use HTTPS).
  • Encryption protects the DB file, not a compromised running container.
  • Single shared dashboard password — no per-user accounts yet.
  • Comply with Supabase Terms of Service.

Development

bun run dev          # Development server
bun run build        # Production build
bun run start        # Production server
bun run lint         # ESLint
bun run db:generate  # Generate Drizzle migrations

Migrations run automatically on startup.

Tech stack

Next.js React TypeScript SQLite Docker

Contributing

Contributions are welcome! Please open an issue or pull request.

License

MIT — free to use, modify, and distribute.



Built with ☕ for developers who forget to ping their side projects.

Supabase
Supabase® is a trademark of Supabase, Inc. This project is independent.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages