Vite integration for
deploy-stack. Automatically scaffold production-ready AWS ECS Fargate infrastructure and GitHub Actions CI/CD pipelines natively during your Vite build process.
Instead of manually configuring infrastructure or writing Terraform, this plugin hooks into Vite's closeBundle lifecycle. When you run npm run build, it silently reads your configuration and generates a highly-optimized Dockerfile, AWS Fargate Terraform modules, and keyless GitHub Actions deployment pipelines perfectly tailored to your static site.
Install the plugin as a development dependency:
npm install -D vite-plugin-deploy-stack(Note: You do not need to install deploy-stack itself. The plugin automatically fetches and executes the latest CLI version via npx.)
Add the plugin to your vite.config.js (or vite.config.ts):
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import deployStack from 'vite-plugin-deploy-stack';
export default defineConfig({
plugins: [
react(),
deployStack({
// Optional: Pass any headless flags to customize your infrastructure.
// See the full list of flags at: https://github.com/anton-codes-iac/deploy-stack/blob/main/docs/guides/headless.md
region: 'us-east-1',
size: 'micro'
})
]
});- Build: Run
npm run build. Vite compiles your frontend. - Generate: The plugin intercepts the end of the build and safely generates the
terraform/,.github/, andDockerfileinside your project root. - Deploy: Run
npx --yes deploy-stack applyin your terminal to provision the AWS infrastructure. - Automate: Push to GitHub. The generated CI/CD pipeline will automatically deploy all future changes securely using IAM OIDC (no long-lived AWS keys).
Running the apply command translates the generated Terraform into real AWS resources:
- Amazon ECS (Fargate): Serverless container compute running your Vite app.
- Application Load Balancer (ALB): Distributes traffic and handles health checks.
- Amazon CloudFront: Global CDN for edge caching and SSL termination.
- Amazon S3 & DynamoDB: Encrypted remote backend and state-locking for Terraform.
- Amazon ECR: Private container registry for your Docker images.
To completely remove all provisioned infrastructure and stop AWS billing, run:
npx --yes deploy-stack destroyThis plugin is a headless automation wrapper around the core deploy-stack CLI.
If you prefer an interactive terminal experience, need advanced configuration, or want to explore the full capabilities of the tool for other frameworks, check out the main deploy-stack repository!
This tool provisions real AWS resources which will incur charges on your AWS bill. An ECS Fargate cluster with an Application Load Balancer running 24/7 typically costs around ~$15 - $20/month minimum, depending on your region and configuration.
Disclaimer: vite-plugin-deploy-stack and its maintainers are not responsible for any unexpected AWS charges, security breaches, or data loss. Please monitor your AWS Billing Dashboard and review the generated Terraform code before applying.
MIT