@aid-on/aidify
v0.1.2
Published
CLI for Aid-On Platform - Amplify-like deployment for Google Cloud + CDKTF + Cloudflare
Downloads
120
Readme
@aid-on/aidify
日本語 | English
✨ Key Features
- 🚀 One-Command Deploy - Deploy infrastructure and application together
- 🏗️ Infrastructure as Code - Declarative infra management with Terraform CDKTF
- 🔄 Multi-Environment Support - Easy switching between dev/stg/prod
- 💾 Database Migrations - Idempotent migration management for D1
- 🤝 Team Development - Terraform State sharing via R2 backend
- 🔐 Secure Secrets Management - Safe handling of environment variables and secrets
- 🩺 Health Checks and Diagnostics - Built-in tooling to verify deployment status
📋 Prerequisites
- Node.js >= 20.0.0
- npm >= 9.0.0
- Cloudflare account with the following credentials:
- Account ID
- API Key
- Zone ID (when using custom domains)
🚀 Quick Start
1. Installation
# Global install
npm install -g @aid-on/aidify
# Or as a dev dependency
npm install --save-dev @aid-on/aidify2. Configure Credentials
# Interactive configuration (saved to ~/.aidify)
aidify configure
# Or set environment variables
export CLOUDFLARE_ACCOUNT_ID="your-account-id"
export CLOUDFLARE_API_KEY="your-api-key"
export CLOUDFLARE_EMAIL="your-email"
export CLOUDFLARE_ZONE_ID="your-zone-id" # Optional3. Create a New Project
# Interactive project creation
aidify init my-app
cd my-app
# Verify configuration
aidify configure # Check and set credentials4. Deploy
# Deploy to development
aidify deploy dev
# Deploy to production (confirmation prompt)
aidify deploy prod
# Auto-approve mode
aidify deploy dev --auto-approve📁 Project Structure
my-app/
├── aidify.config.ts # Aidify configuration
├── src/
│ └── index.ts # Application entry point
├── migrations/ # D1 database migrations
│ └── 001_initial.sql
├── public/ # Static files
└── wrangler.toml # Wrangler config (auto-generated)⚙️ Configuration (aidify.config.ts)
import { defineConfig } from "@aid-on/aidify";
export default defineConfig({
name: "my-app",
framework: "qwik", // qwik, remix, astro, etc.
// Enable features
features: [
"d1-database", // D1 SQLite database
"r2-storage", // R2 object storage
"kv-namespace", // KV key-value store
"vectorize", // Vectorize vector search
"workers-ai", // Workers AI
"durable-objects", // Durable Objects
],
// Environment configuration
environments: {
dev: {
subdomain: "my-app-dev",
primary: false,
},
stg: {
subdomain: "my-app-stg",
primary: false,
},
prod: {
subdomain: "my-app",
primary: true, // Production flag
}
},
// Terraform State for team development (recommended)
state: {
type: "r2",
bucket: "terraform-state-bucket",
region: "auto"
},
// Build settings
build: {
command: "npm run build",
output: "dist"
},
// Secrets
secrets: [
"API_KEY",
"DATABASE_URL"
]
});🔧 Core Commands
Project Management
# Create a new project
aidify init <project-name>
# Check status
aidify status
# Health check
aidify health dev
aidify health dev --json # JSON output
# Dependency check
aidify doctorEnvironment Management
# Show current environment
aidify env get
# Switch environment
aidify env checkout dev
# List environments
aidify env list
# Add a new environment
aidify env add staging
# Remove an environment
aidify env remove stagingDeployment
# Full deploy (infrastructure + application)
aidify deploy dev
# Infrastructure only
aidify infra deploy dev
# Application only
aidify app deploy dev
# Dry run (no actual deploy)
aidify deploy dev --dry-runDatabase Migrations
# Create a migration
aidify migration create "create users table"
# Run migrations
aidify migration run dev
# Check migration status
aidify migration status dev
# Rollback
aidify migration rollback devResource Management
# Destroy environment resources
aidify destroy dev
# Destroy application only
aidify app destroy dev
# Destroy infrastructure only
aidify infra destroy dev🤝 Team Development
Terraform State Management
For team development, using the R2 backend for State management is strongly recommended:
- Create an R2 bucket
wrangler r2 bucket create terraform-state-prod- Set credentials
export AWS_ACCESS_KEY_ID=<r2-access-key>
export AWS_SECRET_ACCESS_KEY=<r2-secret-key>- Configure in aidify.config.ts
state: {
type: "r2",
bucket: "terraform-state-prod",
region: "auto"
}See docs/terraform-state.md for details.
🏗️ Supported Frameworks
- Qwik - Edge-optimized framework
- Remix - Full-stack web framework
- Astro - Content-focused static site generator
- Vanilla - No framework
🌟 Cloudflare Features
Data Storage
- D1 Database - SQLite-based serverless SQL
- R2 Storage - S3-compatible object storage
- KV Namespace - Globally distributed key-value store
- Durable Objects - Strongly consistent stateful objects
AI/ML
- Vectorize - Vector database and similarity search
- Workers AI - AI model inference at the edge
Other
- Authentication - Google OAuth integration
- LLM Integration - LLM integration via unilmp
- Monitoring - OpenTelemetry support
📚 Advanced Usage
CI/CD Pipeline
Example automated deployment with GitHub Actions:
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 20
- run: npm ci
- run: npm run build
- name: Deploy to Production
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CLOUDFLARE_API_KEY: ${{ secrets.CF_API_KEY }}
CLOUDFLARE_EMAIL: ${{ secrets.CF_EMAIL }}
run: npx aidify deploy prod --auto-approveCustom Domain Configuration
// aidify.config.ts
environments: {
prod: {
subdomain: "www",
customDomain: "example.com",
primary: true
}
}Environment Variable Management
# .env.dev
DATABASE_URL=dev-database-url
API_ENDPOINT=https://api-dev.example.com
# .env.prod
DATABASE_URL=prod-database-url
API_ENDPOINT=https://api.example.com🔍 Troubleshooting
Authentication Errors
# Reconfigure credentials
aidify configure
# Show current settings
aidify configure --showDeploy Errors
# Check health status
aidify health dev --verbose
# View logs
wrangler pages deployment list --project-name=<project>Migration Errors
# Check migration status
aidify migration status dev
# Validate migrations
aidify migration validate dev🐛 Known Issues
- Vectorize deletion requires direct API usage as Wrangler CLI does not support it
- Durable Objects namespaces are automatically cleaned up on Worker deletion
📄 License
MIT © Aid-On
🤝 Contributing
Issues and pull requests are welcome!
- Fork this repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a pull request
📮 Support
- Issues: GitHub Issues
- Docs: Documentation
Deploy to the edge. Manage with confidence.
