Self-hosting
1. Database (Supabase, free tier)
Section titled “1. Database (Supabase, free tier)”- Create a project at supabase.com.
- Open SQL Editor and run
supabase/migrations/0001_init.sql. - In Authentication → URL Configuration, set Site URL to your app URL and add
https://YOUR-APP/auth/callback(andhttp://localhost:3000/auth/callback) to Redirect URLs.
2. Google sign-in
Section titled “2. Google sign-in”- In Google Cloud Console → APIs & Services → OAuth consent screen, configure an External app.
- 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.
- In Supabase → Authentication → Sign In / Providers → Google, paste the client ID and secret and enable it.
3. Environment variables
Section titled “3. Environment variables”| 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 |
4. Deploy to Vercel
Section titled “4. Deploy to Vercel”Create two Vercel projects from the same repository:
| Project | Root directory | Framework |
|---|---|---|
prompy |
web |
Next.js |
prompy-docs |
docs |
Astro |
npm i -g vercelcd web && vercel link && vercel env add IMGBB_API_KEY && vercel --prodcd ../docs && vercel link && vercel --prod5. AI providers (optional)
Section titled “5. AI providers (optional)”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:
- Pick a provider. The form says whether it’s free and links straight to its key page.
- 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.
- 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.
6. Google Drive backups (optional)
Section titled “6. Google Drive backups (optional)”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.
One-time setup
Section titled “One-time setup”- In Google Cloud Console, open your project and enable the Google Drive API (APIs & Services → Library).
- Credentials → Create credentials → OAuth client ID, type Web application. Add
https://developers.google.com/oauthplaygroundas an authorized redirect URI. - 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. - 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.
- Add
GOOGLE_DRIVE_CLIENT_ID,GOOGLE_DRIVE_CLIENT_SECRET,GOOGLE_DRIVE_REFRESH_TOKENandCRON_SECRETto the Vercel project (Production), then redeploy. - As a super admin, open Admin → Backups and press Create backup folder. The folder must be created by Prompy, because
drive.filecan’t see folders made by hand. - Press Back up now to check it works, then turn on the
backupsflag in Admin → Flags for the daily run.
How it runs
Section titled “How it runs”web/vercel.tsschedulesGET /api/cron/backupdaily at 03:00 UTC (on the Hobby plan Vercel picks the minute). The route only acceptsAuthorization: Bearer $CRON_SECRET, which Vercel Cron sends; anything else gets401. With thebackupsflag 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.successorbackup.failedentry 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, updateGOOGLE_DRIVE_REFRESH_TOKENand redeploy.
Restoring
Section titled “Restoring”Download a backup from Drive, then from web/:
# 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 --applyRun 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.
Local development
Section titled “Local development”cd web && cp .env.example .env.local && npm install && npm run dev # http://localhost:3000cd docs && npm install && npm run dev # http://localhost:4321