Skip to content

Self-hosting

  1. Create a project at supabase.com.
  2. Open SQL Editor and run supabase/migrations/0001_init.sql.
  3. In Authentication → URL Configuration, set Site URL to your app URL and add https://YOUR-APP/auth/callback (and http://localhost:3000/auth/callback) to Redirect URLs.
  1. In Google Cloud Console → APIs & Services → OAuth consent screen, configure an External app.
  2. Credentials → Create credentials → OAuth client ID, type Web application.
    • Authorized JavaScript origins: your app URL.
    • Authorized redirect URI: https://YOUR-PROJECT.supabase.co/auth/v1/callback.
  3. In Supabase → Authentication → Sign In / Providers → Google, paste the client ID and secret and enable it.
Variable Where Example
NEXT_PUBLIC_SUPABASE_URL web https://abc.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY web anon / publishable key
IMGBB_API_KEY web (server only) from api.imgbb.com
NEXT_PUBLIC_SITE_URL web https://prompy.vercel.app
NEXT_PUBLIC_DOCS_URL web https://prompy-docs.vercel.app
NEXT_PUBLIC_STATUS_URL web (optional) public Gatus status page
HEALTH_CHECK_TOKEN web (server only, optional) token for detailed /api/health checks
SUPABASE_SERVICE_ROLE_KEY web (server only, needed for AI providers) trusted server-side Supabase operations, including saving AI providers
ENCRYPTION_SECRET web (server only, needed for AI providers) 32 random bytes in base64 (openssl rand -base64 32); encrypts stored AI provider keys
GOOGLE_DRIVE_CLIENT_ID, GOOGLE_DRIVE_CLIENT_SECRET web (server only, needed for backups) OAuth client for Google Drive backups (section 6)
GOOGLE_DRIVE_REFRESH_TOKEN web (server only, needed for backups) refresh token for the account that stores backups, scope drive.file
GOOGLE_DRIVE_FOLDER_ID web (server only, optional) overrides the folder created from Admin → Backups
CRON_SECRET web (server only, needed for backups) 16+ random characters (openssl rand -hex 32); Vercel Cron sends it to /api/cron/backup
PUBLIC_APP_URL docs https://prompy.vercel.app
PUBLIC_DOCS_URL docs https://prompy-docs.vercel.app

Create two Vercel projects from the same repository:

Project Root directory Framework
prompy web Next.js
prompy-docs docs Astro
Terminal window
npm i -g vercel
cd web && vercel link && vercel env add IMGBB_API_KEY && vercel --prod
cd ../docs && vercel link && vercel --prod

Pip, the in-app assistant, and the editor’s AI helpers (Enhance prompt, Suggest tags) need at least one AI provider. A super admin adds them at Admin → AI providers, and Prompy tries them in priority order (lower first), failing over to the next if one is down.

Three providers have free tiers, so you can run Prompy’s AI features without a card:

Provider Free? Get a key
Google Gemini Free tier on the Flash models aistudio.google.com/api-keys
Groq Free plan with rate limits console.groq.com/keys
OpenRouter A rotating set of :free models openrouter.ai/settings/keys
Anthropic Paid platform.claude.com/settings/keys
OpenAI Paid platform.openai.com/api-keys

Adding a provider needs ENCRYPTION_SECRET and SUPABASE_SERVICE_ROLE_KEY on the server (see the table above). If either is missing or malformed, the page shows a setup note naming it instead of saving.

The Add provider form walks you through it:

  1. Pick a provider. The form says whether it’s free and links straight to its key page.
  2. Paste the key and press Load models. Prompy asks the provider which models your key can use and marks the free ones. OpenRouter’s free models show up without a key.
  3. Pick a model (or a suggested one), and save.

Keys are encrypted at rest and only their last characters are ever shown. When you edit a provider, Load models uses its saved key, so you don’t need to paste it again. An OpenAI-compatible endpoint needs a public HTTPS base URL; private and internal addresses are refused.

Supabase’s free plan keeps only short daily backups with no point-in-time recovery. Prompy can copy its whole database to a Google Drive folder every day, for free.

What’s in a backup. One gzipped JSON file, prompy-backup-<time>.json.gz, with every row of profiles, workspaces, workspace_members, prompts, likes, comments, workflows, workflow_steps, app_ratings, learning_resources, feature_flags and app_settings, plus user metadata (id, email, created_at, last_sign_in_at, provider). It leaves out API key hashes (users re-issue keys), AI provider key material (provider rows are kept without keys) and activity logs. Backups contain personal data such as emails: keep the Drive folder private and never share it by link.

Why an OAuth refresh token and not a service account

Section titled “Why an OAuth refresh token and not a service account”

Service accounts have no Drive storage of their own, so uploading into a normal My Drive folder fails with storageQuotaExceeded. The only way round that is a Workspace Shared Drive. Prompy instead uses an OAuth refresh token for a regular Google account, with the narrow drive.file scope: the app can only see the files and folder it created.

  1. In Google Cloud Console, open your project and enable the Google Drive API (APIs & Services → Library).
  2. Credentials → Create credentials → OAuth client ID, type Web application. Add https://developers.google.com/oauthplayground as an authorized redirect URI.
  3. Open the OAuth 2.0 Playground. Under the settings gear, tick Use your own OAuth credentials and paste the client ID and secret. In step 1, enter the scope https://www.googleapis.com/auth/drive.file, authorize as the Google account that should hold the backups, then Exchange authorization code for tokens and copy the refresh token.
  4. On the OAuth consent screen, press Publish app so its status is In production. It can stay unverified for a single user. Refresh tokens of apps left in Testing expire after 7 days.
  5. Add GOOGLE_DRIVE_CLIENT_ID, GOOGLE_DRIVE_CLIENT_SECRET, GOOGLE_DRIVE_REFRESH_TOKEN and CRON_SECRET to the Vercel project (Production), then redeploy.
  6. As a super admin, open Admin → Backups and press Create backup folder. The folder must be created by Prompy, because drive.file can’t see folders made by hand.
  7. Press Back up now to check it works, then turn on the backups flag in Admin → Flags for the daily run.
  • web/vercel.ts schedules GET /api/cron/backup daily at 03:00 UTC (on the Hobby plan Vercel picks the minute). The route only accepts Authorization: Bearer $CRON_SECRET, which Vercel Cron sends; anything else gets 401. With the backups flag off it returns { "skipped": "flag off" }.
  • Back up now works even with the flag off. Only one backup runs at a time: a second trigger gets 409 (or an “already running” message).
  • After each upload Prompy keeps the newest N backups (30 by default, change it on the page) and moves older ones to the Drive trash. It also purges activity logs older than 180 days.
  • Every run appears in the history on Admin → Backups and as a backup.success or backup.failed entry in Admin → Logs. If the last success is over 48 hours old, the page shows it in red.
  • If Google revokes the refresh token (invalid_grant), runs fail with “Reconnect Google Drive”. Repeat step 3, update GOOGLE_DRIVE_REFRESH_TOKEN and redeploy.

Download a backup from Drive, then from web/:

Terminal window
# Dry run: checks the file and prints row counts. Writes nothing.
SUPABASE_URL=https://TARGET.supabase.co SUPABASE_SERVICE_ROLE_KEY=... node scripts/restore-backup.mjs prompy-backup-….json.gz
# Restore: recreates users (same IDs and emails, no passwords) and upserts every table.
SUPABASE_URL=https://TARGET.supabase.co SUPABASE_SERVICE_ROLE_KEY=... node scripts/restore-backup.mjs prompy-backup-….json.gz --apply

Run every migration on the target first. Restore into a fresh project or branch and check it before pointing the app at it. Users sign in again with Google or reset their password; AI providers and API keys must be added again.

Terminal window
cd web && cp .env.example .env.local && npm install && npm run dev # http://localhost:3000
cd docs && npm install && npm run dev # http://localhost:4321