Local Environment Setup
Set up a local environment to run Honcho for development, testing, or self-hosting
This guide helps you set up a local environment to run Honcho for development, testing, or self-hosting.
Overview
By the end of this guide, you’ll have:
- A local Honcho server running on your machine
- A PostgreSQL database with pgvector extension
- Basic configuration to connect your applications
- A working environment for development or testing
Prerequisites
Before you begin, ensure you have the following installed:
Required Software
- uv - Python package manager:
pip install uv
(manages Python installations automatically) - Git - Download from git-scm.com
- Docker (optional) - Download from docker.com
Database Options
You’ll need a PostgreSQL database with the pgvector extension. Choose one:
- Local PostgreSQL - Install locally or use Docker
- Supabase - Free cloud PostgreSQL with pgvector
- Railway - Simple cloud PostgreSQL hosting
- Your own PostgreSQL server
Docker Setup (Recommended)
The easiest way to get started is using Docker Compose, which handles both the database and Honcho server.
1. Clone the Repository
2. Set Up Environment Variables
Copy the example environment file and configure it:
Edit .env
and set your API keys (if using LLM features):
3. Start the Services
4. Verify It’s Working
Check that both services are running:
Test the Honcho API:
You should see a response indicating the service is healthy.
Manual Setup
For more control over your environment, you can set up everything manually.
1. Clone and Install Dependencies
2. Set Up PostgreSQL
Option A: Local PostgreSQL Installation
Install PostgreSQL and pgvector on your system:
macOS (using Homebrew):
Ubuntu/Debian:
Windows: Download from postgresql.org
Option B: Docker PostgreSQL
3. Create Database and Enable Extensions
Connect to PostgreSQL and set up the database:
4. Configure Environment
Create a .env
file with your settings:
Edit .env
with your configuration:
5. Run Database Migrations
6. Start the Server
The server will be available at http://localhost:8000
.
Cloud Database Setup
If you prefer to use a managed PostgreSQL service:
Supabase (Recommended)
- Create a Supabase project at supabase.com
- Enable pgvector extension in the SQL editor:
- Get your connection string from Settings > Database
- Update your
.env
file with the connection string
Railway
- Create a Railway project at railway.app
- Add a PostgreSQL service
- Enable pgvector in the PostgreSQL console
- Get your connection string from the service variables
- Update your
.env
file
Verify Your Setup
Once your Honcho server is running, verify everything is working:
1. Health Check
2. API Documentation
Visit http://localhost:8000/docs
to see the interactive API documentation.
3. Test with SDK
Create a simple test script:
Connect Your Application
Now that Honcho is running locally, you can connect your applications:
Update SDK Configuration
Next Steps
- Explore the API: Check out the API Reference
- Try the SDKs: See our guides for examples
- Configure Honcho: Visit the Configuration Guide for detailed settings
- Join the community: Discord
Troubleshooting
Common Issues
Database Connection Errors
- Ensure PostgreSQL is running
- Verify the connection string format:
postgresql+psycopg://...
- Check that pgvector extension is installed
API Key Issues
- Verify your OpenAI and Anthropic API keys are valid
- Check that the keys have sufficient credits/quota
Port Already in Use
- Change the port in your configuration:
FASTAPI_PORT=8001
- Or stop other services using port 8000
Docker Issues
- Ensure Docker is running
- Check container logs:
docker compose logs
- Restart containers:
docker compose down && docker compose up -d
Migration Errors
- Ensure the database exists and pgvector is enabled
- Check database permissions
- Run migrations manually:
uv run alembic upgrade head
Getting Help
- GitHub Issues: Report bugs
- Discord: Join our community
- Documentation: Check the Configuration Guide for detailed settings
Production Considerations
When self-hosting for production, consider:
- Security: Enable authentication, use HTTPS, secure your database
- Scaling: Use connection pooling, consider load balancing
- Monitoring: Set up logging, error tracking, health checks
- Backups: Regular database backups, disaster recovery plan
- Updates: Keep Honcho and dependencies updated