Run your own Minecraft server on AWS, control it from a web app, and keep idle cost low by stopping or hibernating when nobody is playing.
This project is web-app first. CLI/API/manual shell flows are supported as optional add-ons.
If you want the fastest path from clone to a live panel and server, use the setup script:
git clone <your-repo-url>
cd mc-aws
pnpm setuppnpm setup runs ./setup.sh, which automatically:
- Installs/verifies local tools (
mise, Node, pnpm, AWS CLI, CDK) - Launches the credential wizard (
scripts/setup-wizard.sh) - Deploys AWS infrastructure with CDK
- Stores deployment outputs (including
INSTANCE_ID) in.env.productionand.env.local - Deploys the Next.js app to Cloudflare Workers
- AWS account (for EC2/Lambda/SSM/SES/CDK)
- Cloudflare zone + DNS API token (for runtime DNS updates)
- Google OAuth client (for web app sign-in)
- GitHub token (
reposcope) plus repo/user values (currently required by CDK setup in this repo)
Setup guides:
cp .env.example .env.local
pnpm devOpen http://localhost:3000.
Local auth options:
- Google sign-in (when OAuth env vars are configured)
- Dev login route:
http://localhost:3000/api/auth/dev-login(pnpm devenables this by default)
- Server status, health, and player visibility
- Start, stop, resume, and hibernate operations
- Backup, restore, and backup listing
- Cost views and email allowlist management
- Admin shortcuts for common operational tasks
ADMIN_EMAIL: full accessALLOWED_EMAILS: can check status and start- signed-in users not listed above: status-only
Use mock mode when building UI/API behavior without touching real AWS resources:
pnpm dev:mock
pnpm test:mock
pnpm test:e2e:mock
pnpm mock:scenario running
pnpm mock:resetMore detail:
The web app is the default workflow. If you want terminal control, these commands call the same API routes:
pnpm server:status
pnpm server:start
pnpm server:stop
pnpm server:resume
pnpm server:hibernate
pnpm server:backup
pnpm server:backups
pnpm server:restore -- <backup-name>Manual EC2 shell access (advanced):
./bin/connect.sh
./bin/console.shPrimary routes live in app/api:
GET /api/statusPOST /api/startPOST /api/stopPOST /api/resumePOST /api/hibernatePOST /api/backupPOST /api/restoreGET /api/backupsGET /api/costsGET /api/emailsPUT /api/emails/allowlist
See API Reference for a broader route map.
After initial setup, normal app updates are usually:
wrangler login
pnpm deploy:cfpnpm deploy:cf uses .env.production by default.
It also writes a temporary .env.production.local during build so next build cannot be overridden by .env.local.
For explicit control:
ENV_FILE=.env.production pnpm deploy:cfFor infrastructure changes:
pnpm cdk:diff
pnpm cdk:deploy- Ensure
aws sts get-caller-identityworks - Ensure
.env.productionhas required values from the wizard - Re-run
pnpm installthenpnpm setup
- Add exact callback URLs in Google Console:
http://localhost:3000/api/auth/callbackhttps://<your-panel-domain>/api/auth/callback
- Make sure
NEXT_PUBLIC_APP_URLmatches the deployed panel URL
- Use Wrangler OAuth:
wrangler login - Keep DNS runtime token in your deployment env file as
CLOUDFLARE_DNS_API_TOKEN - Avoid exporting
CLOUDFLARE_DNS_API_TOKENglobally in your shell
mc-aws/
βββ app/ # Next.js app + API routes
βββ components/ # Frontend components
βββ hooks/ # Frontend hooks
βββ lib/ # Shared AWS/auth/types utilities
βββ scripts/ # Setup/deploy/dev helper scripts
βββ bin/ # Manual EC2 shell scripts
βββ infra/ # AWS CDK stack + Lambda/EC2 assets
βββ docs/ # Setup guides and deeper docs
βββ tests/ # Vitest + Playwright tests
