Deploying Hoppscotch
Introduction
Hoppscotch is a lightweight, open-source API development ecosystem that serves as an alternative to Postman. It provides a beautiful, fast, and free interface for testing REST, GraphQL, WebSocket, Server-Sent Events (SSE), and Socket.IO APIs. Deploying Hoppscotch on Klutch.sh gives you a self-hosted API testing platform with full control over your data, team collaboration features, and seamless integration with your development workflow.
This comprehensive guide walks you through deploying Hoppscotch on Klutch.sh using a Dockerfile, configuring environment variables, setting up persistent storage for collections and environments, and implementing production-ready best practices for scalability and security.
Prerequisites
- A Klutch.sh account (sign up at klutch.sh/app)
- A GitHub repository for your Hoppscotch deployment
- Basic knowledge of Docker and API development tools
- (Optional) PostgreSQL database for production deployments
- (Optional) OAuth provider credentials (GitHub, Google, Microsoft) for authentication
Understanding Hoppscotch Architecture
Hoppscotch consists of two main components:
- Frontend Application: The Vue.js-based web interface that users interact with
- Backend Services (optional): Provides authentication, collections sync, and team collaboration features
For basic deployments, you can run just the frontend with local storage. For production deployments with team features, you’ll need both frontend and backend services with a PostgreSQL database.
Project Layout
A minimal repository layout for deploying Hoppscotch:
hoppscotch-deploy/├── Dockerfile├── .env.example├── docker-compose.yml (for local testing only)└── README.mdFor production deployments, keep sensitive configuration in environment variables, not in the repository.
1. Basic Dockerfile (Frontend Only)
This Dockerfile creates a lightweight Hoppscotch frontend deployment suitable for individual use or small teams. It uses the official Hoppscotch Docker image as a base:
FROM hoppscotch/hoppscotch:latest
# Set environment variables for frontendENV VITE_ALLOWED_AUTH_PROVIDERS=GITHUB,GOOGLE,EMAILENV VITE_BASE_URL=https://example-app.klutch.shENV VITE_SHORTCODE_BASE_URL=https://example-app.klutch.sh
# Expose the application portEXPOSE 3000
# The base image already contains the start command# CMD is inherited from the base imageNotes:
- The official Hoppscotch image listens on port
3000by default - This basic setup stores data in the browser’s local storage
- For team features and data persistence, you’ll need the backend services (see next section)
2. Production Dockerfile with Backend Services
For production deployments with authentication, collection syncing, and team collaboration, deploy both the frontend and backend:
Backend Service Dockerfile
FROM hoppscotch/hoppscotch-backend:latest
# The backend requires PostgreSQL connectionENV DATABASE_URL=postgresql://YOUR_USERNAME:YOUR_PASSWORD@postgres-host:5432/hoppscotchENV JWT_SECRET=GENERATE_32_CHAR_RANDOM_STRING_HEREENV SESSION_SECRET=GENERATE_32_CHAR_RANDOM_STRING_HEREENV REDIRECT_URL=https://example-app.klutch.shENV WHITELISTED_ORIGINS=https://example-app.klutch.shENV VITE_ALLOWED_AUTH_PROVIDERS=GITHUB,GOOGLE,EMAIL
# GitHub OAuth (optional)ENV GITHUB_CLIENT_ID=YOUR_GITHUB_CLIENT_IDENV GITHUB_CLIENT_SECRET=YOUR_GITHUB_CLIENT_SECRETENV GITHUB_CALLBACK_URL=https://example-app.klutch.sh/v1/auth/github/callback
# Google OAuth (optional)ENV GOOGLE_CLIENT_ID=YOUR_GOOGLE_CLIENT_IDENV GOOGLE_CLIENT_SECRET=YOUR_GOOGLE_CLIENT_SECRETENV GOOGLE_CALLBACK_URL=https://example-app.klutch.sh/v1/auth/google/callback
# SMTP Configuration (for email auth)ENV MAILER_SMTP_HOST=smtp.example.comENV MAILER_SMTP_PORT=587ENV MAILER_SMTP_USER=noreply@example.comENV MAILER_SMTP_PASSWORD=YOUR_SMTP_APP_PASSWORDENV MAILER_ADDRESS_FROM=noreply@example.com
# Expose backend portEXPOSE 3100
# Start command is inherited from base imageFrontend Service with Backend Integration
FROM hoppscotch/hoppscotch:latest
# Configure frontend to use backend services# Note: VITE_BACKEND_API_URL and VITE_BACKEND_WS_URL should point to your backend service URLENV VITE_BASE_URL=https://example-app.klutch.shENV VITE_SHORTCODE_BASE_URL=https://example-app.klutch.shENV VITE_BACKEND_API_URL=https://backend.example-app.klutch.shENV VITE_BACKEND_WS_URL=wss://backend.example-app.klutch.shENV VITE_ALLOWED_AUTH_PROVIDERS=GITHUB,GOOGLE,EMAIL
EXPOSE 30003. Environment Variables Configuration
Essential Variables for Frontend
# Base URLsVITE_BASE_URL=https://example-app.klutch.shVITE_SHORTCODE_BASE_URL=https://example-app.klutch.sh
# Authentication providers (comma-separated)VITE_ALLOWED_AUTH_PROVIDERS=GITHUB,GOOGLE,EMAILEssential Variables for Backend
# DatabaseDATABASE_URL=postgresql://YOUR_USERNAME:YOUR_PASSWORD@postgres-host:5432/hoppscotch
# Security (generate secure random strings - minimum 32 characters)JWT_SECRET=GENERATE_32_CHAR_RANDOM_STRING_HERESESSION_SECRET=GENERATE_32_CHAR_RANDOM_STRING_HERE
# URLsREDIRECT_URL=https://example-app.klutch.shWHITELISTED_ORIGINS=https://example-app.klutch.sh
# GitHub OAuthGITHUB_CLIENT_ID=YOUR_GITHUB_CLIENT_IDGITHUB_CLIENT_SECRET=YOUR_GITHUB_CLIENT_SECRETGITHUB_CALLBACK_URL=https://example-app.klutch.sh/v1/auth/github/callbackGITHUB_SCOPE=user:email
# Google OAuthGOOGLE_CLIENT_ID=YOUR_GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET=YOUR_GOOGLE_CLIENT_SECRETGOOGLE_CALLBACK_URL=https://example-app.klutch.sh/v1/auth/google/callbackGOOGLE_SCOPE=email,profile
# Email ConfigurationMAILER_SMTP_ENABLE=trueMAILER_USE_CUSTOM_CONFIGS=trueMAILER_SMTP_HOST=smtp.example.comMAILER_SMTP_PORT=587MAILER_SMTP_SECURE=trueMAILER_SMTP_USER=noreply@example.comMAILER_SMTP_PASSWORD=YOUR_SMTP_APP_PASSWORDMAILER_ADDRESS_FROM=noreply@example.com
# Rate LimitingRATE_LIMIT_TTL=60RATE_LIMIT_MAX=100Important Security Notes:
- Never commit secrets to your repository
- Use Klutch.sh’s environment variable management to store sensitive values
- Generate strong random strings for
JWT_SECRETandSESSION_SECRET(minimum 32 characters) - Use secure SMTP credentials for email functionality
4. Persistent Storage Configuration
Hoppscotch stores user data differently depending on your deployment mode:
Frontend-Only Deployment
Data is stored in the browser’s local storage. No persistent volumes are needed, but users will lose data if they clear their browser cache.
Backend-Enabled Deployment
All user data is stored in the PostgreSQL database. You need persistent storage for:
-
Database Volume: Mount a persistent volume for PostgreSQL data
- Mount path:
/var/lib/postgresql/data - Recommended size: 10GB (increases with usage)
- Mount path:
-
Backend Application Data (optional)
- Mount path:
/app/data - Recommended size: 5GB
- Mount path:
Setting Up Volumes on Klutch.sh
When creating your app on Klutch.sh:
- Navigate to your app’s settings in the Klutch.sh dashboard
- Go to the “Volumes” section
- Create a new volume with the mount path
/var/lib/postgresql/data - Set the size to at least 10GB
- Save and restart your application
For more details, see the Volumes Guide.
5. Database Setup
For production deployments with backend services, you need a PostgreSQL database.
Option 1: Deploy PostgreSQL on Klutch.sh
- Create a new app in Klutch.sh for PostgreSQL
- Use the official PostgreSQL Docker image
- Attach a persistent volume to
/var/lib/postgresql/data - Set environment variables:
Terminal window POSTGRES_DB=hoppscotchPOSTGRES_USER=hoppscotch_userPOSTGRES_PASSWORD=your-secure-password - Configure TCP traffic on port 8000 (internal port: 5432)
- Note the connection details for your Hoppscotch backend configuration
For detailed PostgreSQL deployment instructions, see the PostgreSQL Guide.
Option 2: Use a Managed PostgreSQL Service
Use external services like AWS RDS, Google Cloud SQL, or DigitalOcean Managed Databases. Simply provide the connection URL in your DATABASE_URL environment variable.
6. Deploying to Klutch.sh — Step-by-Step
Deploying Frontend-Only (Basic Setup)
- Create a new GitHub repository and add the Dockerfile from section 1
- Commit and push your changes to GitHub
- Log in to the Klutch.sh dashboard at klutch.sh/app
- Create a new project (or use an existing one)
- Create a new app and connect your GitHub repository
- Klutch.sh will automatically detect the Dockerfile in the root directory
- Configure the internal port to
3000 - Select HTTP traffic type
- Add environment variables from section 3 (frontend variables)
- Click “Deploy” to build and start your Hoppscotch instance
Deploying Full Stack (Production Setup)
- First, deploy a PostgreSQL database (see section 5)
- Create a GitHub repository for the backend service with the backend Dockerfile
- In Klutch.sh, create a new app for the backend:
- Connect your backend repository
- Configure internal port to
3100 - Select HTTP traffic type
- Add all backend environment variables from section 3
- Include the
DATABASE_URLpointing to your PostgreSQL instance - Deploy the backend service
- Create a second GitHub repository for the frontend with the frontend Dockerfile
- In Klutch.sh, create a new app for the frontend:
- Connect your frontend repository
- Configure internal port to
3000 - Select HTTP traffic type
- Add frontend environment variables
- Set
VITE_BACKEND_API_URLto your backend’s Klutch.sh URL - Set
VITE_BACKEND_WS_URLto your backend’s WebSocket URL - Deploy the frontend service
- Access your Hoppscotch instance at the frontend app’s URL
7. Configuring OAuth Authentication
To enable social login with GitHub or Google:
GitHub OAuth Setup
- Go to GitHub Developer Settings
- Click “New OAuth App”
- Fill in the application details:
- Application name: Your Hoppscotch Instance
- Homepage URL:
https://example-app.klutch.sh - Authorization callback URL:
https://example-app.klutch.sh/v1/auth/github/callback
- Click “Register application”
- Copy the Client ID and generate a new Client Secret
- Add these to your backend environment variables:
Terminal window GITHUB_CLIENT_ID=your-client-idGITHUB_CLIENT_SECRET=your-client-secretGITHUB_CALLBACK_URL=https://example-app.klutch.sh/v1/auth/github/callback
Google OAuth Setup
- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to “APIs & Services” > “Credentials”
- Click “Create Credentials” > “OAuth client ID”
- Configure the consent screen if prompted
- Select “Web application” as the application type
- Add authorized redirect URIs:
https://example-app.klutch.sh/v1/auth/google/callback
- Copy the Client ID and Client Secret
- Add these to your backend environment variables:
Terminal window GOOGLE_CLIENT_ID=your-client-idGOOGLE_CLIENT_SECRET=your-client-secretGOOGLE_CALLBACK_URL=https://example-app.klutch.sh/v1/auth/google/callback
8. Custom Domain Configuration
To use your own domain with Hoppscotch:
- In the Klutch.sh dashboard, navigate to your app settings
- Go to the “Domains” section
- Click “Add Custom Domain”
- Enter your domain (e.g.,
api-tools.yourdomain.com) - Configure your DNS provider to point to the Klutch.sh provided address
- Klutch.sh automatically manages TLS certificates for custom domains
- Update your environment variables to reflect the new domain:
Terminal window VITE_BASE_URL=https://api-tools.yourdomain.comREDIRECT_URL=https://api-tools.yourdomain.comWHITELISTED_ORIGINS=https://api-tools.yourdomain.com - Redeploy your application for the changes to take effect
For detailed instructions, see the Custom Domains Guide.
9. Getting Started with Hoppscotch
Once your Hoppscotch instance is deployed, you can start testing APIs immediately:
Testing a Simple REST API
- Open your Hoppscotch instance in a web browser
- In the request builder, enter a URL (e.g.,
https://api.github.com/users/octocat) - Select the HTTP method (GET, POST, PUT, DELETE, etc.)
- Click “Send” to make the request
- View the response in the response panel
Creating and Saving Collections
- Click the “Collections” tab in the sidebar
- Click “New Collection” to create a collection
- Add requests to your collection by clicking “Add Request”
- Organize requests into folders for better management
- Collections are saved to your backend database (if enabled) or browser local storage
Sample API Request Example
Here’s a sample request to test your Hoppscotch instance with the JSONPlaceholder API:
GET https://jsonplaceholder.typicode.com/posts/1Content-Type: application/jsonExpected response:
{ "userId": 1, "id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit\nsuscipit recusandae consequuntur..."}Testing GraphQL APIs
- Switch to the “GraphQL” tab in Hoppscotch
- Enter a GraphQL endpoint (e.g.,
https://api.spacex.land/graphql/) - Write your GraphQL query in the query editor
- Click “Run Query” to execute
- View the response and explore the schema
Sample GraphQL query:
query { launchesPast(limit: 5) { mission_name launch_date_local rocket { rocket_name } }}Testing WebSocket Connections
- Switch to the “Realtime” tab
- Select “WebSocket” as the protocol
- Enter a WebSocket URL (e.g.,
wss://echo.websocket.org) - Click “Connect”
- Send messages and receive responses in real-time
10. Customization with Nixpacks
Klutch.sh uses Nixpacks for automatic builds. If you need to customize the build or runtime behavior, you can set environment variables:
Custom Build Command
If you need to run custom build steps:
# Buildtime environment variableNIXPACKS_BUILD_CMD=npm install && npm run buildCustom Start Command
To override the default start command:
# Runtime environment variableNIXPACKS_START_CMD=node server.jsInstall Additional Packages
To install system dependencies:
# Buildtime environment variableNIXPACKS_PKGS=postgresql opensslFor more information on Nixpacks customization, see the Nixpacks documentation.
11. Monitoring and Scaling
Performance Monitoring
- Monitor your app’s resource usage in the Klutch.sh dashboard
- Track response times and error rates
- Set up alerts for high CPU or memory usage
- Review application logs for errors and performance issues
For detailed monitoring features, see the Monitoring Guide.
Scaling Considerations
- Vertical Scaling: Increase instance size for more CPU and memory
- Database Performance: Ensure your PostgreSQL instance is appropriately sized
- Connection Pooling: Use connection pooling for database connections in high-traffic scenarios
- Caching: Consider implementing Redis caching for frequently accessed data
12. Troubleshooting
Common Issues and Solutions
Issue: Application won’t start
- Check logs in the Klutch.sh dashboard for error messages
- Verify all required environment variables are set
- Ensure the internal port is correctly configured to
3000(frontend) or3100(backend) - Confirm the Dockerfile is in the root directory of your repository
Issue: Cannot connect to database
- Verify the
DATABASE_URLis correct and includes proper credentials - Ensure the PostgreSQL service is running and accessible
- Check network connectivity between services
- For Klutch.sh PostgreSQL deployments, ensure you’re using port 8000 for external connections
Issue: OAuth authentication fails
- Double-check OAuth client IDs and secrets
- Verify callback URLs match exactly in both OAuth provider settings and environment variables
- Ensure
REDIRECT_URLandWHITELISTED_ORIGINSare set correctly - Check that your domain has valid TLS certificates
Issue: WebSocket connections fail
- Verify
VITE_BACKEND_WS_URLuseswss://(secure WebSocket) protocol - Check that the backend service is running and accessible
- Ensure no proxy or firewall is blocking WebSocket connections
Issue: Collections not saving
- For frontend-only deployments, check browser local storage permissions
- For backend deployments, verify database connection is working
- Check application logs for database errors
- Ensure the backend service is properly configured and running
Debugging Commands
To troubleshoot issues, you can review logs in the Klutch.sh dashboard or use the following approaches:
# Check if the application is listening on the correct portnetstat -tulpn | grep 3000
# Verify environment variables are setenv | grep VITE
# Test database connectivity (from backend container)psql $DATABASE_URL -c "SELECT version();"
# Check application logstail -f /var/log/hoppscotch/app.log13. Security Best Practices
- Use Strong Secrets: Generate cryptographically secure random strings for
JWT_SECRETandSESSION_SECRET(minimum 32 characters) - Enable HTTPS: Always use HTTPS for your Hoppscotch instance (Klutch.sh provides this automatically)
- Secure Database: Use strong database passwords and restrict network access
- OAuth Security: Keep OAuth client secrets confidential and rotate them periodically
- SMTP Credentials: Use app-specific passwords for SMTP authentication
- Regular Updates: Keep Hoppscotch and its dependencies up to date
- Access Control: Implement team workspaces and role-based access control for production use
- Environment Variables: Never commit secrets to your repository; use Klutch.sh’s environment variable management
- CORS Configuration: Properly configure
WHITELISTED_ORIGINSto prevent unauthorized access - Rate Limiting: Configure appropriate rate limits to prevent abuse
14. Backup and Data Management
Database Backups
For PostgreSQL deployments, implement regular backups:
# Create a backuppg_dump $DATABASE_URL > hoppscotch-backup-$(date +%Y%m%d).sql
# Restore from backuppsql $DATABASE_URL < hoppscotch-backup-20240101.sqlExporting Collections
Users can export their collections as JSON files from the Hoppscotch UI:
- Navigate to Collections
- Click on the collection menu (three dots)
- Select “Export”
- Choose JSON format
- Save the file securely
Automated Backup Strategy
Consider implementing automated backups:
- Schedule daily database dumps
- Store backups in object storage (S3-compatible)
- Implement backup retention policies (keep daily backups for 7 days, weekly for 4 weeks, monthly for 12 months)
- Test restore procedures regularly
15. Migration from Hosted Hoppscotch
If you’re migrating from the hosted Hoppscotch service:
- Export all collections from the hosted service
- Deploy your self-hosted instance following this guide
- Create user accounts on your self-hosted instance
- Import collections using the import feature
- Update team settings and permissions
- Notify team members of the new URL
16. Advanced Configuration
Environment-Specific Settings
Use different environment variables for development, staging, and production:
# DevelopmentVITE_BASE_URL=https://dev.example-app.klutch.shNODE_ENV=development
# ProductionVITE_BASE_URL=https://api.example-app.klutch.shNODE_ENV=productionCustom Themes
Hoppscotch supports custom theming. You can extend the frontend build to include custom themes:
- Fork the Hoppscotch repository
- Customize theme files in the source
- Build your custom image
- Deploy to Klutch.sh
Proxy Configuration
For testing APIs behind firewalls or with CORS restrictions, configure the Hoppscotch proxy:
# Backend environment variablePROXY_ENABLED=true17. Resources and Documentation
- Hoppscotch Official Documentation
- Hoppscotch GitHub Repository
- Hoppscotch Community Forum
- Klutch.sh Quick Start Guide
- Klutch.sh Volumes Guide
- Klutch.sh Networking Guide
- Klutch.sh Custom Domains Guide
Conclusion
Deploying Hoppscotch on Klutch.sh provides a powerful, self-hosted API development platform with full control over your data and infrastructure. Whether you’re running a simple frontend-only deployment for personal use or a full production setup with authentication and team collaboration, Klutch.sh’s automatic Dockerfile detection and managed infrastructure make deployment straightforward.
For production deployments, remember to:
- Use PostgreSQL for data persistence
- Configure OAuth providers for team authentication
- Implement regular database backups
- Monitor resource usage and scale as needed
- Keep Hoppscotch and dependencies updated
With Hoppscotch deployed on Klutch.sh, you have a reliable, scalable API testing platform that grows with your needs.