Skip to main content

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

The simplest way to get started is with Docker Compose:
This will start all required services:
  • FastAPI application
  • Redis
  • PostgreSQL (Supabase)
  • RabbitMQ
  • Celery workers
  • Flower monitoring
The API will be available at http://localhost:8030.

Option 2: Local Python Environment

Environment Configuration

Copy the example environment file and update it with your settings:
Update the following key variables in the .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:
Send a test message:

Implementing Custom Message Handlers

The WebSocket system is implemented with the WebSocketManager 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

Check that your authentication token is valid and properly formatted.
If you’re seeing database connection errors, ensure Supabase is running:
Ensure RabbitMQ and Celery workers are running:

Additional Resources