Skip to content

Production-ready project template for AI-assisted development. Built-in CI/CD, security scanning, verification scripts, and mode gates to prevent false-green builds.

License

Notifications You must be signed in to change notification settings

kobie3717/vibe-stack-template

Repository files navigation

πŸ—οΈ Vibe Stack Template

License: MIT GitHub stars Last commit

Stop shipping broken code with AI. This template catches it before you do.

A production-ready project template with built-in verification, security enforcement, and deployment discipline β€” designed for AI-assisted development.


Why This Exists

AI coding tools (Claude, Cursor, Copilot) let you ship fast. Too fast. They'll happily generate code that:

  • Passes no tests (because there aren't any)
  • Breaks the build (but CI was set to skip missing files)
  • Ships secrets (because nobody ran a scan)
  • Drifts from the spec (because the spec wasn't enforced)

This template adds guardrails so your AI copilot stays on the road. It gives you:

  • Protocols that keep AI agents disciplined (CLAUDE.md)
  • Verification scripts that catch problems locally before CI
  • A mode gate that prevents "false green" builds
  • Security scanning baked into the workflow, not bolted on

Built With Battle Scars

This isn't a theoretical template. It was extracted from running a real production SaaS where an AI agent handles autonomous development. Every protocol, every check, every "never do this" rule exists because something went wrong and we built the guardrail after.

The protocols (P1–P12) aren't aspirational β€” they're scar tissue turned into automation.


What's Included

File Purpose
CLAUDE.md AI assistant protocols for autonomous development
SPEC.md Product specification as source of truth
Verification Scripts Stack, security, contract, and environment checks
CI/CD Pipeline GitHub Actions with security scanning and mode-aware enforcement
Deployment Checklist Pre-deploy, staging, production, rollback procedures

Template Mode vs Project Mode

This template uses an explicit mode gate to ensure CI behavior is appropriate:

Mode TEMPLATE_MODE file CI Behavior
Template Mode true (default) Lightweight validation: file existence, config parsing, secret scanning
Project Mode false Full checks: lint, typecheck, build, tests, E2E, security β€” fails if files are missing

This prevents "false green" builds where CI passes by skipping checks.


Quick Start

1. Create from Template

Click "Use this template" on GitHub, or:

git clone https://github.com/YOUR_USERNAME/vibe-stack-template.git my-project
cd my-project
rm -rf .git && git init

2. Switch to Project Mode

echo "false" > TEMPLATE_MODE

⚠️ This is critical. In project mode, CI will fail loudly if required files are missing. No more hiding broken builds.

3. Configure PROJECT_KNOBS

Open CLAUDE.md and update:

PROJECT_NAME=my-project
BACKEND_PORT=4000
FRONTEND_PORT=5173
API_BASE_URL=http://localhost:4000/api
DOMAIN=myproject.com
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb
REDIS_URL=redis://localhost:6379

Also update package.json, SPEC.md, and DEPLOYMENT_SECURITY_CHECKLIST.md with your project details.

4. Install & Verify

npm install
cp backend/.env.example backend/.env
npm run check:template   # Validate template structure
npm run check:quick      # Fast health check (once you have code)

πŸ’‘ Note: This template provides the structure, scripts, and CI pipeline β€” not application code. The backend/ and frontend/ directories are starting points for you to build on.


Verification Commands

Command Time When to Use
npm run check:template ~5s Before pushing template changes
npm run check:quick ~5s After config changes
npm run check:fast ~90s After code changes
npm run check:full ~3-5min Before merge/release
npm run check:security ~30s Before deployment
npm run contract:check ~15s After API changes
npm run validate:env ~5s After env changes
npm run prerelease ~5min Before production deploy

System Status Levels

Status Meaning
PARTIALLY ACTIVE check:quick passes β€” basic health verified
ACTIVE check:fast passes β€” code quality verified
RELEASE-READY check:full + check:security + contract:check all pass

CI Pipeline

Template Mode (TEMPLATE_MODE=true)

Runs a single Template Validation job: file existence, YAML syntax, gitleaks secret scan, hardcoded secret patterns.

Project Mode (TEMPLATE_MODE=false)

Full pipeline:

  1. detect-mode β†’ reads TEMPLATE_MODE
  2. secrets-scan β†’ blocks if secrets detected
  3. security-validation β†’ CORS, rate limiting, auth checks
  4. stack-check β†’ contract and type alignment
  5. backend β†’ lint, typecheck, test, build
  6. frontend β†’ lint, typecheck, build
  7. e2e β†’ end-to-end tests (main branch only)

No conditional skipping. Missing files = loud failure.


Project Structure

β”œβ”€β”€ TEMPLATE_MODE               # 'true' or 'false' β€” CI mode gate
β”œβ”€β”€ CLAUDE.md                   # AI assistant protocols (P1–P12)
β”œβ”€β”€ SPEC.md                     # Product specification (source of truth)
β”œβ”€β”€ DEPLOYMENT_SECURITY_CHECKLIST.md
β”œβ”€β”€ .gitleaks.toml              # Secret scanning config
β”œβ”€β”€ .github/workflows/ci.yml   # Mode-aware CI pipeline
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ template-validate.sh    # Template structure validation
β”‚   β”œβ”€β”€ stack-check.sh          # Unified verification
β”‚   β”œβ”€β”€ security-check.sh       # Security validation
β”‚   β”œβ”€β”€ contract-check.sh       # Type alignment
β”‚   └── validate-env.sh         # Environment validation
β”œβ”€β”€ backend/                    # Express API (customize)
β”œβ”€β”€ frontend/                   # React + Vite (customize)
└── shared/                     # Shared types (optional)

Customization Checklist

  • TEMPLATE_MODE β†’ set to false
  • CLAUDE.md β†’ update PROJECT_KNOBS
  • package.json β†’ name, description
  • SPEC.md β†’ your product spec, API contracts, invariants
  • backend/ β†’ your backend implementation
  • frontend/ β†’ your frontend implementation
  • shared/ β†’ shared TypeScript types
  • DEPLOYMENT_SECURITY_CHECKLIST.md β†’ domain, contacts

The Golden Rule

If code and SPEC.md disagree, the code is BROKEN.

SPEC.md is the source of truth. Update it first, then implement.

Why No Conditional Skipping?

Previous versions used if: hashFiles('backend/tsconfig.json') != '' to skip checks when files were missing. This created a dangerous pattern: someone deletes package.json β†’ CI skips the build β†’ CI passes (false green) β†’ broken state gets merged.

The fix: Template Mode validates structure only. Project Mode requires all files and fails loudly. No hiding, no skipping, no false greens.



If this template saved you from a broken deploy, consider giving it a ⭐

Star this repo

License

MIT

About

Production-ready project template for AI-assisted development. Built-in CI/CD, security scanning, verification scripts, and mode gates to prevent false-green builds.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •