Development Environment
The reptidex development environment provides a mixed architecture with backend services running in Docker and frontend applications running locally for optimal development experience.Architecture Overview
Services (14 Total)
- 6 Backend Services (FastAPI + Python 3.12) - Docker containers
- 1 Backend Package (@repti-logging) - Shared logging library
- 4 Frontend Applications (Vite + React 19 + TypeScript) - Local development
- 3 Shared Packages (@reptidex-app/ui, @reptidex-app/core, @reptidex-app/logging) - pnpm workspace
- Infrastructure (PostgreSQL, Redis, Nginx) - Docker containers
Technology Stack
- Backend: FastAPI, Python 3.12, SQLAlchemy, Pydantic (Docker)
- Frontend: Vite, React 19, TypeScript, Tailwind CSS, Radix UI (Local)
- Shared Packages: Vite build system, TypeScript, pnpm workspace
- Databases: PostgreSQL 15 (6 separate databases), Redis 7
- Infrastructure: Docker Compose, Nginx (API Gateway)
- Environment Variables: Vite’s
import.meta.envfor frontend (notprocess.env)
Prerequisites
System Requirements
- Docker Desktop 24.0+
- Docker Compose 2.21+
- Git 2.30+
- 8GB+ RAM recommended
- 20GB+ free disk space
Platform Support
- ✅ macOS (ARM64 & Intel)
- ✅ Linux (x86_64 & ARM64)
- ✅ Windows (WSL2 recommended)
Quick Start
1. Complete Environment Setup
- Clone all service repositories into the correct directory structure
- Start all infrastructure services (databases, Redis, Nginx)
- Prepare the environment for service development
2. Verify Setup
3. Start Development Services
Development Scripts
Main Script: ./scripts/dev.sh
Our primary development management script provides comprehensive service orchestration:
Setup & Repository Management
Service Management
Service Groups
Development Tasks
Database & Maintenance
Health Monitoring: ./scripts/health-check.sh
Advanced health monitoring for all services:
Service URLs & Access
Frontend Applications (Local Development)
| Service | Direct URL | Development Mode | Purpose |
|---|---|---|---|
| Web Public | http://localhost:3000 | npm run dev (local) | Marketing & discovery |
| Web Breeder | http://localhost:3001 | npm run dev (local) | Breeder dashboard |
| Web Admin | http://localhost:3002 | npm run dev (local) | Admin interface |
| Web Embed | http://localhost:3003 | npm run dev (local) | Embeddable widgets |
Backend APIs (Docker Services)
| Service | URL | Health Check | Container |
|---|---|---|---|
| API Gateway | http://localhost:80 | http://localhost:80/health | Nginx |
| Repti Core | http://localhost:8001 | http://localhost:8001/api/v1/health | Docker |
| Repti Animal | http://localhost:8002 | http://localhost:8002/api/v1/health | Docker |
| Repti Commerce | http://localhost:8003 | http://localhost:8003/api/v1/health | Docker |
| Repti Media | http://localhost:8004 | http://localhost:8004/api/v1/health | Docker |
| Repti Community | http://localhost:8005 | http://localhost:8005/api/v1/health | Docker |
| Repti Ops | http://localhost:8006 | http://localhost:8006/api/v1/health | Docker |
Database Connections
| Database | Host:Port | Database Name |
|---|---|---|
| Core | localhost:5432 | repti_core_db |
| Animal | localhost:5433 | repti_animal_db |
| Commerce | localhost:5434 | repti_commerce_db |
| Media | localhost:5435 | repti_media_db |
| Community | localhost:5436 | repti_community_db |
| Ops | localhost:5437 | repti_ops_db |
| Redis | localhost:6379 | - |
reptidex / reptidex_dev_password
Project Structure
After running./scripts/dev.sh setup, your directory structure will be:
Creating New Frontend Applications
Frontend Application Template System
Reptidex provides a comprehensive frontend template system for rapidly creating new applications with consistent architecture, tooling, and patterns.Template Features
- ✅ Vite + React 19 + TypeScript - Modern development stack
- ✅ Radix UI + Tailwind CSS - Accessible components with utility styling
- ✅ Zustand + React Query - Client state and server state management
- ✅ Vitest + React Testing Library - Comprehensive testing setup
- ✅ ESLint + Prettier - Code quality and formatting
- ✅ Docker Support - Development and production containers
- ✅ Hot Module Replacement - Instant feedback during development
Creating a New Frontend Application
Application Types & Configurations
Each app type comes with pre-configured features and navigation:| App Type | Features | Port | Purpose |
|---|---|---|---|
| web-public | Search, Community, Marketplace | 3000 | Marketing & discovery |
| web-breeder | Auth, Search, Marketplace, Community | 3001 | Breeder dashboard |
| web-admin | Auth, Search, Admin, All features | 3002 | Admin interface |
| web-embed | Search, Embedding only | 3003 | Embeddable widgets |
Shared Package Templates
Create reusable packages for UI components and business logic:Frontend Template Structure
Each generated application includes:Development Workflow
Frontend Workspace Setup
Set up the complete frontend monorepo workspace:Docker Development
Shared Package Integration
All frontend applications automatically include and can use:VS Code Integration
The workspace includes complete VS Code setup:- Recommended Extensions - Tailwind, Prettier, ESLint, TypeScript
- Debug Configurations - Launch any frontend app with F5
- Tasks - Build, test, lint, type-check via Ctrl+Shift+P
- Settings - Automatic formatting, path intellisense, Tailwind autocomplete
Creating New Backend Services
FastAPI Service Template
reptidex provides a comprehensive FastAPI service template that ensures consistency across all backend services. The template includes all necessary components following our architectural patterns and coding standards.Template Features
- ✅ Multi-tenant Architecture: Row-level security with organization context
- ✅ Repository Pattern: Clean data access layer separation
- ✅ Service Layer: Business logic encapsulation with hooks
- ✅ Dependency Injection: FastAPI’s dependency system for auth and database
- ✅ Comprehensive Testing: Unit, integration, and E2E tests with fixtures
- ✅ Code Quality: Black, isort, flake8, mypy configurations
- ✅ Docker Support: Multi-stage builds for development and production
- ✅ Database Migrations: Alembic with async PostgreSQL support
Creating a New Service
The template setup process has been streamlined to work correctly with existing git repositories:Template Structure
The template provides a complete service structure:Setup Script Features
Thesetup-service.sh script automatically:
- Replaces placeholders with your service name in all configuration files (
{service}→servicename,{Service}→Servicename) - Checks for existing database initialization script and uses it if available, or creates a new template
- Updates service configuration in
app/core/config.pywith service-specific settings - Configures Docker Compose with correct service name and database connections
- Sets up Alembic with service-specific database URL and migration settings
- Creates development scripts (dev.sh, test.sh, lint.sh, migrate.sh) with proper permissions
- Initializes environment file (.env) from the customized template
- Validates service name format (lowercase letters, numbers, hyphens only)
Setup Process Flow
- File Customization: Updates all template files with service-specific names
- Database Integration: Links to existing database init scripts or creates new ones
- Environment Setup: Creates .env file with service-specific database URLs and settings
- Script Generation: Creates all development scripts with proper executable permissions
- Validation: Ensures all required files are present and correctly configured
Integration with Development Environment
After creating a new service:- Add to Docker Compose: Include the service in
docker-compose.dev.yml - Update development scripts: Add to
BACKEND_SERVICESarray inscripts/dev.sh - Configure API Gateway: Add routing rules to
scripts/nginx.dev.conf - Database setup: Initialize and run migrations
- Health checks: Verify the service appears in health monitoring
Current reptidex Services
All reptidex backend services have been successfully set up using this template system:| Service | Purpose | Database | Status |
|---|---|---|---|
| repti-core | Auth, Config, Billing, Events | repti_core_db | ✅ Ready |
| repti-animal | Animals, Lineage, Genetics | repti_animal_db | ✅ Ready |
| repti-commerce | Marketplace, Sales, Transactions | repti_commerce_db | ✅ Ready |
| repti-media | Files, Rendering, Embeds, Content | repti_media_db | ✅ Ready |
| repti-community | Search, Notifications, Community, Ads | repti_community_db | ✅ Ready |
| repti-ops | Admin, Audit, Integrations, Logging | repti_ops_db | ✅ Ready |
Template System Benefits
This template system ensures all reptidex backend services:- ✅ Follow consistent architectural patterns (Repository, Service Layer, Dependency Injection)
- ✅ Maintain high code quality with automated linting, formatting, and type checking
- ✅ Integrate seamlessly with the development environment and database setup
- ✅ Support multi-tenant architecture with Row-Level Security (RLS) policies
- ✅ Include comprehensive testing (unit, integration, end-to-end) from day one
- ✅ Provide identical development experience across all services
- ✅ Enable rapid service creation with minimal manual configuration
Creating Additional Services
For future services (e.g., analytics, reporting, webhooks):Database Setup & Migrations
Alembic Integration
Our database initialization scripts are designed to work seamlessly with Alembic:- Database Setup (extensions, roles, RLS policies)
- Alembic Migrations (table schemas)
- Sample Data (development data)
Setup Sequence
Database Utilities
Each database has helper functions for post-migration setup:Development Workflow
Daily Development
Integrated Frontend & Backend
The development environment provides seamless integration between frontend and backend:Service Communication
- API Gateway: Nginx at port 80 routes requests to appropriate services
- Frontend → Backend: Apps automatically proxy
/api/*requests through the gateway - Domain-based routing: Each frontend app has its own subdomain for isolation
- Hot reload: Changes in frontend apps and shared packages trigger immediate updates
- Shared packages: UI and core packages automatically rebuild and link to apps
Development Flow
Hot Reload Development
All services are configured with volume mounts for instant code changes:- Backend: FastAPI auto-reload on Python file changes
- Frontend: Vite HMR (Hot Module Replacement)
- Shared Packages: Watch mode with automatic rebuilding
Working with Individual Services
Environment Configuration
Environment Variables
Copy and customize the environment template:Key Configuration Sections
- Database URLs: Individual connection strings for each service
- Service URLs: Internal Docker network communication
- Frontend API URLs: External URLs for browser access
- Multi-tenant Settings: Default organization and tenant headers
- Feature Flags: Development-specific toggles
Example Configuration
Troubleshooting
Common Issues
Services Won’t Start
Database Connection Issues
Frontend Build Issues
API Gateway Issues
Repository Management Issues
Performance Issues
Log Analysis
Advanced Usage
Custom Service Configurations
Each service can be customized by modifying its section indocker-compose.dev.yml:
Network Configuration
Services communicate through Docker networks:- External Network: Browser → Nginx (port 80) → Backend Services
- Internal Network: Service-to-service communication via service names
- Database Network: Services → PostgreSQL/Redis via internal hostnames
Volume Management
Multi-Platform Development
The environment supports ARM64 and AMD64 architectures:Security Considerations
Development Security
- Credentials: Use only development credentials (never production)
- Network: Services isolated within Docker networks
- Data: Local development data only
- Access: No external access to development databases
Environment Isolation
Secret Management
Getting Help
Documentation Resources
- Architecture Overview
- Coding Standards
- Getting Started
- API Documentation (when services are running)
Team Communication
- Slack: #engineering-general for questions
- Slack: #development-environment for setup issues
- GitHub Issues: For bugs and feature requests
- Team Wiki: Internal documentation and runbooks
Self-Service Debugging
- Check service health:
./scripts/dev.sh health - Review logs:
./scripts/dev.sh logs [service] - Verify configuration: Check
.env.devfile - Test connectivity: Use health check endpoints
- Restart services:
./scripts/dev.sh restart
Contributing to the Development Environment
Making Changes
- Test locally: Verify changes work in your environment
- Update documentation: Update this file for any changes
- Test setup from scratch:
./scripts/dev.sh clean && ./scripts/dev.sh setup - Create PR: Include testing steps and migration notes
Common Improvement Areas
- Performance: Optimize build times and resource usage
- Developer Experience: Improve scripts and automation
- Documentation: Keep guides current and comprehensive
- Compatibility: Support new platforms and Docker versions

