Prerequisites
Before you begin, ensure you have the following installed:- Go 1.25+ - The API server and CLI are written in Go
- PostgreSQL - For local database development
- Docker & Docker Compose - For running local infrastructure
- Cloudflare R2 credentials - For tarball storage (or S3-compatible alternative)
- OAuth credentials - GitHub and/or Google OAuth app credentials
Quick Start
Configure environment variables
Open
.env and fill in the required values:You can configure one or both OAuth providers. At least one is required for authentication.
Start local PostgreSQL
- User:
prompt - Password:
prompt - Database:
promptsdev - Port:
5432
The database container includes a health check that waits for PostgreSQL to be ready.
Makefile Commands
The project includes a comprehensive Makefile for common development tasks:Infrastructure
Development
Testing & Quality
Using the CLI Locally
Run the CLI directly with Go:The CLI stores authentication tokens in
~/.prompts/config.json after successful login.Database Migrations
Migrations are located in themigrations/ directory and are automatically applied when the API server starts.
Manual migration run:
Docker Compose Configuration
Thedocker-compose.yml defines the local PostgreSQL service:
postgres_data Docker volume. Use make reset to clear it.
Environment Variables Reference
All available environment variables from.env.example:
| Variable | Required | Default | Description |
|---|---|---|---|
PORT | No | 8080 | API server port |
APP_ENV | No | development | Application environment |
DATABASE_URL | Yes | - | PostgreSQL connection string |
JWT_SECRET | Yes | - | Secret for signing JWT tokens |
JWT_EXPIRY_HOURS | No | 720 | JWT token expiry (30 days) |
GITHUB_CLIENT_ID | Conditional | - | GitHub OAuth app client ID |
GITHUB_CLIENT_SECRET | Conditional | - | GitHub OAuth app secret |
GITHUB_REDIRECT_URL | Conditional | - | GitHub OAuth callback URL |
GOOGLE_CLIENT_ID | Conditional | - | Google OAuth app client ID |
GOOGLE_CLIENT_SECRET | Conditional | - | Google OAuth app secret |
GOOGLE_REDIRECT_URL | Conditional | - | Google OAuth callback URL |
R2_ACCOUNT_ID | Yes | - | Cloudflare R2 account ID |
R2_BUCKET | Yes | prompts-tarballs | R2 bucket name |
R2_ACCESS_KEY_ID | Yes | - | R2 access key |
R2_SECRET_ACCESS_KEY | Yes | - | R2 secret access key |
CLI_OAUTH_PORT | No | 9876 | Local port for CLI OAuth callback |
At least one OAuth provider (GitHub or Google) must be configured for authentication to work.
Troubleshooting
Migration Errors
Problem: Database migration fails on startup Solution:- Verify
DATABASE_URLis correct - Check PostgreSQL is running:
docker ps - Ensure database user has proper permissions
- Check migration files in
migrations/directory
OAuth Provider Errors
Problem: “OAuth provider unsupported” error Solution:- Ensure provider credentials are configured in
.env - Verify redirect URLs match your OAuth app configuration
- Check that at least one provider (GitHub or Google) is fully configured
R2 Client Initialization Fails
Problem: R2 storage client fails to initialize Solution:- Verify all R2 credentials:
R2_ACCOUNT_ID,R2_BUCKET,R2_ACCESS_KEY_ID,R2_SECRET_ACCESS_KEY - Ensure the bucket exists in your R2 account
- Check that API keys have proper permissions
401 Unauthorized Responses
Problem: CLI requests return 401 errors Solution:- Confirm you’ve logged in:
go run ./cmd/cli login --provider github - Check JWT token exists in
~/.prompts/config.json - Verify
JWT_SECRETis consistent between logins - Token may have expired (default: 30 days)