Infrastructure & Configuration
Relevant source files
The following files were used as context for generating this wiki page:
The Infrastructure and Configuration of the GoHighLevel Clone project provide a production-ready environment designed for scalability, security, and multi-tenancy. The system leverages a modern cloud-native architecture, utilizing containerization with Docker and automated CI/CD pipelines to ensure consistent deployments across various environments including local development, Railway, and Vercel. Sources: README.md, INFRASTRUCTURE_SETUP_COMPLETE.md
The scope of this infrastructure encompasses multi-stage Docker builds, health monitoring, environment-specific configurations, and automated quality gates. These components work together to support a full-stack application composed of a FastAPI backend and a Next.js frontend, integrated with PostgreSQL for persistence and Redis for caching and rate limiting. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, FINAL_REPORT.md
System Architecture
The project follows a distributed architecture where the frontend and backend are decoupled and hosted on specialized platforms. The backend API communicates with a PostgreSQL database and a Redis cache, all coordinated through Docker for local development. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md
The following diagram illustrates the high-level infrastructure components and their interactions:
Diagram showing the relationship between the Vercel-hosted frontend and the Railway-hosted backend services. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, FINAL_REPORT.md
Containerization and Local Development
The project utilizes Docker and Docker Compose to provide an identical environment for both development and production. This ensures that dependencies and configurations remain consistent throughout the software development lifecycle (SDLC). Sources: README.md, INFRASTRUCTURE_SETUP_COMPLETE.md
Docker Configuration
The system employs multi-stage Docker builds to optimize image sizes and enhance security by using non-root users in the runner stages. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, frontend/DEPLOYMENT.md
| Component | Technology | Features |
|---|---|---|
| Backend Docker | Python 3.12-slim | Multi-stage, health checks, non-root user |
| Frontend Docker | Node 20-alpine | Standalone build, optimized static assets |
| Orchestration | Docker Compose | Links App, DB, and Redis for local dev |
Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, frontend/DEPLOYMENT.md
Local Service Stack
For local development, the docker-compose.yml file defines the full stack, allowing developers to start the entire environment with a single command. Sources: README.md, INFRASTRUCTURE_SETUP_COMPLETE.md
# Simplified service structure derived from documentation
services:
backend:
build: ./backend
ports: ["8000:8000"]
environment: [DATABASE_URL, REDIS_URL]
frontend:
build: ./frontend
ports: ["3000:3000"]
environment: [NEXT_PUBLIC_API_URL]
postgres:
image: postgres:16
redis:
image: redis:7
Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, FINAL_REPORT.md
CI/CD Pipeline
Automated pipelines are implemented via GitHub Actions to enforce code quality and handle deployments. The pipeline consists of four primary stages: Test, Build, Deploy, and Integration. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, FINAL_REPORT.md
Pipeline Flow
The CI/CD workflow ensures that no code is deployed to production without passing the defined quality gates, including linting, unit tests, and security scans. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md
Sequence diagram of the automated CI/CD process from code push to production deployment. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, FINAL_REPORT.md
Environment Configuration
The system relies on environment variables to manage sensitive information and platform-specific settings. Templates are provided as .env.example files to guide setup. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, frontend/DEPLOYMENT.md
Key Configuration Categories
| Category | Variables | Description |
|---|---|---|
| Database | DATABASE_URL | PostgreSQL connection string |
| Caching | REDIS_URL | Redis connection for cache and rate limits |
| Auth | SECRET_KEY, CLERK_JWT | Keys for JWT signing and external auth providers |
| CORS | CORS_ORIGINS | Allowed frontend domains for API access |
| Frontend API | NEXT_PUBLIC_API_URL | Backend URL for frontend requests |
Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, FINAL_REPORT.md, frontend/DEPLOYMENT.md
Health Monitoring & Security
The infrastructure includes dedicated health check endpoints and security measures to maintain system reliability and data integrity. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md
Health Check Endpoints
The backend implements a comprehensive health module that monitors both the application status and its dependencies. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md
GET /health: Returns a full status report of the database and Redis connections.GET /health/live: Liveness probe for orchestration heartbeat.GET /health/ready: Readiness probe to ensure dependencies are available.
Security Architecture
Infrastructure security is built into the container and networking layers:
- Networking: TLS 1.3 is enforced for all communications, with private networking used for internal service traffic between Railway components. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md
- Isolation: Multi-tenancy is enforced at the infrastructure level through account-scoped data isolation and row-level security policies. Sources: README.md, FINAL_REPORT.md
- Access Control: JWT-based authentication with RS256 signing is used for API access, combined with Redis-backed rate limiting per account. Sources: README.md, FINAL_REPORT.md
Summary
The "Infrastructure & Configuration" of the GoHighLevel Clone project establishes a robust foundation for an enterprise-grade marketing automation platform. By utilizing multi-stage Docker builds, a rigorous CI/CD pipeline, and comprehensive health monitoring, the project ensures high availability and security. The architecture's reliance on decoupled, cloud-native services like Railway and Vercel allows for independent scaling of the frontend and backend components while maintaining strict multi-tenant isolation. Sources: INFRASTRUCTURE_SETUP_COMPLETE.md, FINAL_REPORT.md