🚀 A complete example application demonstrating agent-cloud deployment capabilities
This is a simple REST API built with Node.js and Express that showcases how to deploy applications to AWS, GCP, or Azure using the agent-cloud CLI tool.
This example demonstrates:
- ✅ AI-Powered Deployment - Let AI analyze and deploy your application
- ✅ Multi-Cloud Support - Deploy to AWS, GCP, or Azure with one command
- ✅ Container Deployment - Automatically containerized and deployed
- ✅ Production-Ready - Complete with health checks, error handling, and logging
- ✅ Zero Configuration - No manual infrastructure setup required
This simple Task Management API includes:
- CRUD Operations - Create, Read, Update, Delete tasks
- RESTful Design - Standard HTTP methods and status codes
- Health Checks - Built-in health endpoint for monitoring
- Statistics - Track completed vs pending tasks
- Error Handling - Comprehensive error messages
- Docker Support - Ready for containerized deployment
Before deploying, make sure you have:
- agent-cloud installed (see main README)
- Node.js 18+ installed
- Cloud provider CLI configured (AWS, GCP, or Azure)
- AI API key (OpenAI or Gemini)
# Navigate to this directory
cd examples/simple-nodejs-api
# Install dependencies
npm install
# Copy environment file
cp .env.example .env
# Start the server
npm start
# In another terminal, test the API
npm testThe API will be available at http://localhost:3000
# Make sure you're in the example directory
cd examples/simple-nodejs-api
# Deploy to AWS (ECS Fargate)
cloud-agent deploy --cloud aws
# Review the deployment plan
# The AI will show you:
# - Detected project type (Node.js API)
# - Deployment target (ECS Fargate)
# - Estimated costs
# - Required resources
# Approve when ready
# ✓ Confirm deployment
# Wait for deployment (~2-3 minutes)
# Your API will be deployed to:
# https://your-service.region.amazonaws.comcd examples/simple-nodejs-api
# Deploy to Google Cloud Run
cloud-agent deploy --cloud gcp
# The AI will automatically:
# 1. Build your Docker container
# 2. Push to Google Container Registry
# 3. Deploy to Cloud Run
# 4. Configure health checks
# 5. Return your public URL
# Your API will be available at:
# https://simple-nodejs-api-xyz.run.appcd examples/simple-nodejs-api
# Deploy to Azure Container Apps
cloud-agent deploy --cloud azure
# The AI handles:
# 1. Container registry setup
# 2. Container build and push
# 3. Container App creation
# 4. Environment configuration
# 5. Public endpoint setup
# Your API will be live at:
# https://simple-nodejs-api.azurecontainerapps.ioOnce deployed, your API will have the following endpoints:
GET /Returns API status and available endpoints.
Example:
curl https://your-deployed-url.com/GET /api/tasksReturns all tasks in the system.
Example Response:
{
"success": true,
"count": 3,
"data": [
{
"id": 1,
"title": "Learn Agent Cloud",
"completed": false,
"createdAt": "2026-01-20T08:00:00.000Z"
}
]
}GET /api/tasks/:idExample:
curl https://your-deployed-url.com/api/tasks/1POST /api/tasks
Content-Type: application/json
{
"title": "Your task title"
}Example:
curl -X POST https://your-deployed-url.com/api/tasks \
-H "Content-Type: application/json" \
-d '{"title": "Deploy to production"}'PUT /api/tasks/:id
Content-Type: application/json
{
"title": "Updated title",
"completed": true
}Example:
curl -X PUT https://your-deployed-url.com/api/tasks/1 \
-H "Content-Type: application/json" \
-d '{"completed": true}'DELETE /api/tasks/:idExample:
curl -X DELETE https://your-deployed-url.com/api/tasks/1GET /api/statsReturns task completion statistics.
Example Response:
{
"success": true,
"data": {
"total": 5,
"completed": 2,
"pending": 3,
"completionRate": "40.00%"
}
}After deployment, test your live API:
# Set your deployment URL
export API_URL=https://your-deployed-url.com
# Test the API
npm test
# Or manually test endpoints
curl $API_URL
curl $API_URL/api/tasks
curl -X POST $API_URL/api/tasks -H "Content-Type: application/json" -d '{"title":"Test task"}'When you run cloud-agent deploy, here's what the AI does:
✓ Detecting project type... Node.js API
✓ Found package.json
✓ Found Dockerfile
✓ Identifying framework... Express.js
✓ Analyzing dependencies... 1 dependency
✓ Selected deployment target: ECS Fargate / Cloud Run / Container Apps
✓ Estimated cost: $20-45/month
✓ Required resources:
- Container registry
- Container orchestration
- Load balancer
- Public IP
✓ Building Docker image...
✓ Pushing to container registry...
✓ Creating cloud resources...
✓ Deploying container...
✓ Configuring health checks...
✓ Setting up networking...
✓ Deployment successful!
✓ Health check passed
✓ Public URL: https://...
✓ Duration: 142.3s
✓ Estimated cost: $25.00/month
| Cloud | Service | Type | Description |
|---|---|---|---|
| AWS | ECS Fargate | Container | Serverless container platform |
| GCP | Cloud Run | Container | Fully managed container platform |
| Azure | Container Apps | Container | Serverless container service |
All these services automatically handle:
- ✅ Auto-scaling based on traffic
- ✅ Load balancing
- ✅ HTTPS/SSL certificates
- ✅ Health monitoring
- ✅ Zero-downtime deployments
simple-nodejs-api/
├── src/
│ ├── index.js # Main API server
│ └── test.js # API tests
├── package.json # Dependencies
├── Dockerfile # Container configuration
├── .dockerignore # Docker ignore rules
├── .gitignore # Git ignore rules
├── .env.example # Environment template
└── README.md # This file
Want to modify this example? Here are some ideas:
// Add MongoDB, PostgreSQL, or DynamoDB
const mongoose = require('mongoose');
// Connect and use persistent storage// Add JWT or OAuth
const jwt = require('jsonwebtoken');
// Protect your endpoints// Add user management
app.post('/api/users', ...);
app.get('/api/users/:id', ...);# Add to .env
DATABASE_URL=mongodb://...
JWT_SECRET=your-secret
REDIS_URL=redis://...Then redeploy with cloud-agent deploy --cloud <provider>!
Approximate monthly costs for this example:
| Cloud | Service | Estimated Cost |
|---|---|---|
| AWS | ECS Fargate (0.25 vCPU, 0.5 GB) | $15-25/month |
| GCP | Cloud Run (with request-based pricing) | $10-20/month |
| Azure | Container Apps (consumption plan) | $15-25/month |
Note: These are estimates for low-traffic applications. Costs scale with usage.
Port already in use:
# Change port in .env
PORT=3001Dependencies won't install:
# Clear cache and reinstall
rm -rf node_modules package-lock.json
npm installAuthentication failed:
# AWS
aws configure
# GCP
gcloud auth login
# Azure
az loginBuild failed:
# Test Docker build locally
docker build -t test-api .
docker run -p 3000:3000 test-apiDeployment timeout:
- Check cloud provider quotas
- Verify network connectivity
- Review logs in
.agent-cloud/logs/
After successfully deploying this example:
- Try Other Cloud Providers - Deploy the same app to different clouds
- Monitor Your Deployment - Check logs and metrics in your cloud console
- Modify the App - Add features and redeploy
- Deploy Your Own App - Use agent-cloud with your real projects
- Share Feedback - Help improve agent-cloud!
- Main Documentation: ../../README.md
- Express.js: https://expressjs.com/
- Docker: https://docs.docker.com/
- AWS ECS: https://aws.amazon.com/ecs/
- Google Cloud Run: https://cloud.google.com/run
- Azure Container Apps: https://azure.microsoft.com/en-us/products/container-apps
Having issues? Check:
- Logs:
.agent-cloud/logs/deployment-*.log - Main README: ../../README.md
- GitHub Issues: https://github.com/intojhanurag/agent-cloud/issues
Built with ❤️ by ojha_verse
Star the project if you find it useful! ⭐