Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

vite-plugin-deploy-stack (for AWS ECS Fargate) ☁️🚀

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.

NPM Version Vite compatibility

Why?

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.

Installation

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.)

Usage

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'
    })
  ]
});

How it Works

  1. Build: Run npm run build. Vite compiles your frontend.
  2. Generate: The plugin intercepts the end of the build and safely generates the terraform/, .github/, and Dockerfile inside your project root.
  3. Deploy: Run npx --yes deploy-stack apply in your terminal to provision the AWS infrastructure.
  4. Automate: Push to GitHub. The generated CI/CD pipeline will automatically deploy all future changes securely using IAM OIDC (no long-lived AWS keys).

🏗️ What gets provisioned?

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.

🗑️ Teardown (Stopping AWS Billing)

To completely remove all provisioned infrastructure and stop AWS billing, run:

npx --yes deploy-stack destroy

🧠 Powered by deploy-stack

This 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!

💰 AWS Costs & Disclaimer

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.

License

MIT

About

A Vite plugin to automatically scaffold and deploy AWS ECS Fargate infrastructure via deploy-stack

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages