Deploy VitePress on AWS
Vite & Vue powered static site generator for documentation sites.
vitepress.devDeploy your VitePress documentation sites to AWS using Thunder. VitePress generates a fully static site at build time, making S3 and CloudFront the ideal hosting target.
Available Patterns
Prerequisites
Getting Started
Create Project
Scaffold a new VitePress project using your preferred package manager. This sets up the project structure, installs dependencies, and prepares you for development.
bun create vitepress my-vitepress-sitecd my-vitepress-sitebun installnpm create vitepress@latest my-vitepress-sitecd my-vitepress-sitenpm installpnpm create vitepress my-vitepress-sitecd my-vitepress-sitepnpm installInstall Thunder
Add Thunder as a development dependency. It provides the CDK constructs you’ll use to define your AWS infrastructure.
bun add @thunder-so/thunder --developmentnpm install @thunder-so/thunder --save-devpnpm add -D @thunder-so/thunderVitePress Static Site Deployment
Deploy your VitePress site to S3 with CloudFront as the CDN. VitePress outputs the built site to docs/.vitepress/dist/ by default — Thunder uploads these files to S3 and provisions the CloudFront distribution in front of them.
Stack
The Static construct provisions an S3 bucket, a CloudFront distribution, and optionally a Route53 DNS record.
import { Cdk, Static, type StaticProps } from '@thunder-so/thunder';
const config: StaticProps = { env: { account: 'YOUR_ACCOUNT_ID', region: 'us-east-1' }, application: 'myapp', service: 'docs', environment: 'prod', rootDir: '.', // e.g. 'frontend' for monorepos outputDir: 'docs/.vitepress/dist',};
new Static(new Cdk.App(), `${config.application}-${config.service}-${config.environment}-stack`, config);Deploy
Build your VitePress site first to generate the static output, then deploy with CDK. CDK uploads the files to S3 and provisions the CloudFront distribution.
bun run docs:buildnpx cdk deploy --app "bunx tsx stack/prod.ts" --profile defaultnpm run docs:buildnpx cdk deploy --app "npx tsx stack/prod.ts" --profile defaultpnpm run docs:buildpnpm exec cdk deploy --app "pnpm exec tsx stack/prod.ts" --profile defaultAfter deployment, CDK outputs a CloudFront URL where your documentation site is live.