@webalexx/projen-multi-cloud-project
v0.0.9
Published
A projen library for multi-cloud Pulumi projects
Maintainers
Readme
@webalexx/projen-multi-cloud-project
A TypeScript Projen library for creating multi-cloud Pulumi projects with AWS EKS, Minikube, and FastAPI ML Services.
Features
- 🚀 FastAPI ML Services: Pre-configured FastAPI templates with LLM integration (AWS Bedrock)
- ☸️ Kubernetes Deployment: Support for Minikube and AWS EKS
- 🐳 Docker Multi-Stage Builds: Optimized container images for production
- 📊 Helm Charts: Complete Helm chart templates with HPA and Secrets management
- 🔐 AWS Secrets Manager: Native integration for secure credential management
- 🔄 GitHub Actions CI/CD: Complete workflows for testing, building, and deployment
- 🧪 Unit & Integration Tests: Pytest for Python services + Jest for TypeScript
Quick Start
Installation
npm install @webalexx/projen-multi-cloud-project --save-devCreate .projenrc.ts
import { MultiCloudPulumiProject, MLProject } from '@webalexx/projen-multi-cloud-project';
const project = new MultiCloudPulumiProject({
name: '@myorg/my-ml-project',
repositoryUrl: 'https://github.com/myorg/my-ml-project.git',
author: 'Your Name',
authorAddress: '[email protected]',
defaultReleaseBranch: 'main',
});
// Create an ML service
new MLProject(project, 'data-analyzer', {
projectName: 'data-analyzer',
awsRegion: 'us-east-1',
enableMinikube: true,
enableEks: true,
enableHelmChart: true,
});
project.synth();Generate Project
npx projenAPI Reference
MultiCloudPulumiProject
High-level construct that creates a Projen TypeScript project with multi-cloud Pulumi support.
| Class / Method | Description | Parameters |
| :--- | :--- | :--- |
| MultiCloudPulumiProject | Main project class combining all cloud components | options: MultiCloudPulumiProjectOptions |
| MultiCloudPulumiProjectOptions.author | Author name | string |
| MultiCloudPulumiProjectOptions.authorAddress | Author email address | string |
| MultiCloudPulumiProjectOptions.repositoryUrl | Git repository URL | string |
MLProject
High-level construct that generates a complete ML service with FastAPI, Docker, Helm, and Pulumi infrastructure.
| Class / Method | Description | Parameters |
| :--- | :--- | :--- |
| MLProject | Creates a complete ML service component | scope: TypeScriptProject, id: string, options: MLProjectOptions |
| MLProjectOptions.projectName | Name of the ML service (lowercase alphanumeric and hyphens, e.g. data-analyzer) | string (required) |
| MLProjectOptions.projectDescription | Human-readable service description | string (default: "ML Service: <projectName>") |
| MLProjectOptions.awsRegion | AWS region for deployment | string (default: "us-east-1") |
| MLProjectOptions.awsAccountId | AWS account ID for ECR image path | string (optional) |
| MLProjectOptions.llmProvider | LLM provider to use | string (default: "bedrock") |
| MLProjectOptions.imageRepository | Docker image repository name | string (default: "<projectName>-service") |
| MLProjectOptions.enableHelmChart | Generate Helm chart for Kubernetes deployment | boolean (default: true) |
| MLProjectOptions.enableMinikube | Generate GitHub Actions workflow for Minikube | boolean (default: true) |
| MLProjectOptions.enableEks | Generate GitHub Actions workflow for AWS EKS | boolean (default: true) |
Generated Files
When you instantiate MLProject, the following files are generated in your project:
| File | Description |
| :--- | :--- |
| services/<name>/main.py | FastAPI application with AWS Bedrock LLM integration |
| services/<name>/requirements.txt | Python dependencies |
| services/<name>/test_main.py | Pytest unit and integration tests |
| services/<name>/.env.example | Environment variable template (12-factor) |
| services/<name>/Dockerfile | Multi-stage production Docker image |
| services/<name>/.dockerignore | Docker build exclusions |
| infrastructure/pulumi/<name>-eks.ts | Pulumi code for AWS EKS cluster provisioning |
| infrastructure/pulumi/<name>-minikube.ts | Pulumi code for Minikube local deployment |
| helm-charts/<name>/Chart.yaml | Helm chart metadata |
| helm-charts/<name>/values.yaml | Helm chart default values |
| helm-charts/<name>/templates/deployment.yaml | Kubernetes Deployment manifest |
| helm-charts/<name>/templates/service.yaml | Kubernetes Service manifest |
| .github/workflows/deploy-minikube-<name>.yml | CI/CD workflow for Minikube (if enableMinikube: true) |
| .github/workflows/deploy-eks-<name>.yml | CI/CD workflow for AWS EKS (if enableEks: true) |
API Endpoints
Each generated FastAPI service provides:
| Endpoint | Method | Description |
| :--- | :--- | :--- |
| /health | GET | Health check endpoint |
| /info | GET | Service information (name, region, provider) |
| /analyze | POST | Analyze and rate content using LLM |
Example
# Health check
curl http://localhost:8000/health
# Analyze content
curl -X POST http://localhost:8000/analyze \
-H "Content-Type: application/json" \
-d '{"text": "Your content here..."}'Local Development
Docker
cd services/data-analyzer
docker build -t data-analyzer:latest .
# Use AWS IAM roles or OIDC for production; credentials are fetched at runtime
# from AWS Secrets Manager – do NOT pass secret keys as environment variables.
docker run -p 8000:8000 \
-e AWS_REGION=us-east-1 \
data-analyzer:latestMinikube
minikube start
eval $(minikube docker-env)
docker build -t data-analyzer:latest services/data-analyzer/
cd infrastructure/pulumi
pulumi stack init dev-minikube
pulumi upAWS EKS Deployment
# Using Helm
helm upgrade --install data-analyzer ./helm-charts/data-analyzer \
--namespace data-analyzer-prod \
--create-namespace
# Using Pulumi
cd infrastructure/pulumi
pulumi stack init prod-eks
pulumi config set target eks
pulumi upRunning Tests
# TypeScript library tests
npm test
# Python service tests
pytest services/data-analyzer/test_main.py -v --cov12-Factor Compliance
All generated services follow 12-factor app principles:
- Configuration via environment variables (not hardcoded)
- Secrets fetched from AWS Secrets Manager at runtime
- Stateless processes with no local state
License
Apache 2.0
