Prerequisites
Before setting up PrivyCode locally, ensure you have the following installed:Go 1.23+
Required for running the Go backend server
PostgreSQL
Database for storing users and viewer links
GitHub OAuth App
For authenticating users via GitHub
Git
For cloning the repository
Step 1: Clone the Repository
Step 2: Set Up PostgreSQL Database
Step 3: Create GitHub OAuth App
Go to GitHub Developer Settings
Navigate to GitHub Developer Settings → OAuth Apps → New OAuth App
Step 4: Configure Environment Variables
Step 5: Run Database Migrations
Uncomment migration line
Open
cmd/server/main.go and uncomment the migration line:cmd/server/main.go
Step 6: Start the Development Server
http://localhost:8080
Your server is now running! You should see:
Testing the API
Common Issues
Error loading .env file
Error loading .env file
Make sure your
.env file exists in the project root and is not named .env.txt or similar.Error connecting to DB
Error connecting to DB
- Verify PostgreSQL is running:
psql -U postgres -c "SELECT 1;" - Check your
DATABASE_URLformat - Ensure the database exists:
psql -U postgres -l
GitHub OAuth errors
GitHub OAuth errors
- Verify your
GITHUB_CALLBACK_URLmatches exactly what’s in GitHub OAuth settings - Check that
GITHUB_CLIENT_IDandGITHUB_CLIENT_SECRETare correct - Ensure your frontend URL is in the CORS allowed origins
Port already in use
Port already in use
Change the
PORT in your .env file or kill the process using port 8080:Next Steps
Environment Variables
Learn about all available configuration options
Deployment
Deploy your server to production
API Reference
Explore the available API endpoints
Authentication
Understand how authentication works