Development Environment Setup
This guide will help you set up your development environment for working with the ProductFlo API, with a focus on integrating with our WebSocket and AI capabilities.Prerequisites
Before you begin, make sure you have the following installed:- Python 3.11 or higher (Python 3.12 recommended)
- Redis (for WebSocket state and cache management)
- PostgreSQL 14+ (for database operations)
- Node.js 18+ (for testing WebSocket clients)
- Docker and Docker Compose (for containerized development)
Local Setup
Clone the Repository
Environment Setup Options
Option 1: Using Docker Compose (Recommended)
The simplest way to get started is with Docker Compose:- FastAPI application
- Redis
- PostgreSQL (Supabase)
- RabbitMQ
- Celery workers
- Flower monitoring
http://localhost:8030
.
Option 2: Local Python Environment
Environment Configuration
Copy the example environment file and update it with your settings:.env
file:
Core Development Commands
WebSocket Development
Our API implements both native WebSocket and Socket.IO protocols with a unified interface. The system is designed around room-based communication for efficient message routing.Testing WebSocket Connections
You can use the WebSocket testing endpoint for development:Implementing Custom Message Handlers
The WebSocket system is implemented with theWebSocketManager
class in utils/websocket_manager.py
. To implement a custom message handler:
AI Integration
The ProductFlo API integrates with multiple LLM providers through a unified interface:Supported AI Providers
- OpenAI (GPT-4o, GPT-4, GPT-3.5-Turbo)
- Anthropic (Claude 3 Opus, Sonnet, Haiku)
- Groq (Llama-3-70b, Mixtral-8x7b)
- Deepseek (DeepSeek-Coder)
- Google (Gemini Pro, Gemini Ultra)
Multi-tenancy
The ProductFlo API implements schema-based tenant isolation. Each tenant gets their own PostgreSQL schema within the same database.Common Issues & Solutions
WebSocket Connection Rejected
WebSocket Connection Rejected
Check that your authentication token is valid and properly formatted.
Database Connection Issues
Database Connection Issues
If you’re seeing database connection errors, ensure Supabase is running:
Celery Tasks Not Processing
Celery Tasks Not Processing
Ensure RabbitMQ and Celery workers are running: