How abr-098/showcase works
Project type and purpose
• This is a full-stack, cloud-infrastructure management platform backed by AI.
• Purpose: accept natural-language VM requirements, use a fine-tuned OpenAI model to generate an optimal VM configuration, then provision and monitor VMs on Google Cloud via Terraform, all behind a responsive web UI.
Infer the file structure
• app/ ← Flask application (routes, controllers, services)
• app/ai_integration/ ← OpenAI client, prompt building, fine-tuning logic
• app/vm_manager/ ← VM lifecycle service code (create, read, update, delete)
• app/tasks/ ← Celery task definitions and workers
• config/ ← environment settings, .env loader
• infra/terraform/ ← Terraform modules, HCL scripts for GCP resources
• templates/ ← Jinja2 HTML templates
• tests/ ← unit & integration tests
• Dockerfile, docker-compose.yml
• .github/workflows/ ← CI/CD pipeline definitions
• scripts/ ← helper scripts (e.g. local setup, migrations)
Main components and their roles
a. User Layer
• Web browser / Mobile client → static JS/CSS → interacts with Flask API (REST/WebSocket).
b. External Services
• OpenAI API (GPT-FTM) for NLP and configuration generation
• Google Cloud APIs for provisioning (Compute Engine, Networking, IAM)
• Terraform CLI/engine invoked as a subprocess or via Terraform Cloud
c. Application Layer
• API Gateway / Flask Router – HTTP endpoints, middleware for auth & rate limiting
• Authentication subsystem – Flask-Session + Redis for session store, RBAC checks
• AI Integration service – OpenAI client wrapper & fine-tuning logic
• VM Management service – triggers Terraform jobs, tracks VM status, persists metadata
• Task Manager – Celery broker + workers for asynchronous infrastructure tasks
d. Data Layer
• PostgreSQL – persistent storage for users, VM registry, audit logs
• Redis – caching layer for sessions, Celery task results, VM status snapshots
• File storage – Terraform state files, generated config files, SSH keys
e. Infrastructure / Cloud Layer
• Terraform modules executing on GCP
• Multi-region deployment zones behind a global Load Balancer
• GCP Cloud Monitoring, structured logging, alerting
Relationships & Interactions
User → [Web UI static assets] → Flask API
Flask API → Authentication → Database/Redis
Flask API → AI Integration → OpenAI API → AI Integration → Flask API
Flask API → Task Manager (Celery broker) → Worker → Terraform Engine → GCP API
Terraform Engine → GCP → Compute resources; Terraform state → Storage
Worker → Database & Redis for status updates
Flask API → Database/Redis to serve real-time status to UI
Architectural patterns & design principles
• Layered architecture: separate presentation, business logic, data, infra
• Asynchronous processing: Celery task queue decouples long-running infra operations
• Infrastructure as Code: Terraform modules versioned alongside application code
• Micro-modular services: AI logic, VM lifecycle logic, auth logic each in its own module
• External integration façade: wrap third-party APIs behind your own service interfaces