Stop leaking API keys. This template project has all the automated security guardrails pre-configured so you can vibe-code safely at hackathons.
| Guardrail | What It Does | When It Runs |
|---|---|---|
.gitignore |
Prevents .env, *.pem, serviceAccountKey.json from ever being tracked |
Always |
.gitleaks.toml |
Custom rules to catch GCP, Firebase, Gemini, AWS, Stripe, and GitHub secrets | With gitleaks |
| Pre-commit hook | Blocks commits containing secrets before they hit your local git history | Every git commit |
| GitHub Action | Scans every push and PR for leaked secrets in CI/CD | Every push/PR |
.env.example |
Template for all your environment variables (safe to commit) | Reference |
Click "Use this template" on GitHub, or clone it:
git clone https://github.com/rominirani/hackathon-safe-starter.git my-hackathon-project
cd my-hackathon-project# Install gitleaks (secret scanner)
brew install gitleaks # macOS
# OR: See https://github.com/gitleaks/gitleaks#installing for other OS
# Install pre-commit (hook manager)
pip install pre-commit
# Install the git hooks
pre-commit install# Copy the template
cp .env.example .env
# Edit .env and add your real API keys
# β οΈ .env is in .gitignore β it will NEVER be committedThe guardrails are active. If you accidentally try to commit a secret, gitleaks will block it:
$ git commit -m "add feature"
gitleaks...................................................................Failed
- hook id: gitleaks
- exit code: 1
Finding: client = genai.Client(api_key="AIzaSy...")
Secret: AIzaSy...
RuleID: google-api-key
See tests/test_secrets/INSTRUCTIONS.md for hands-on exercises.
Quick test:
# Copy a fake secret out of the safe directory
cp tests/test_secrets/fake_gemini_key.py ./leaked.py
# Try to commit it
git add leaked.py
git commit -m "oops"
# π‘οΈ BLOCKED by gitleaks!
# Clean up
git rm --cached leaked.py && rm leaked.py| File | What It Shows |
|---|---|
samples/secure_gemini.py |
β Gemini API with env vars |
samples/secure_firebase.js |
β Firebase config with Vite env vars |
samples/secure_cloud_storage.py |
β GCS with Application Default Credentials |
samples/secure_groq.js |
β Groq/OpenAI with env vars |
hackathon-safe-starter/
βββ .github/workflows/
β βββ security-scan.yml β GitHub Action: scans every push/PR
βββ .gitignore β Blocks .env, *.pem, keys from tracking
βββ .gitleaks.toml β Custom detection rules
βββ .pre-commit-config.yaml β Pre-commit hook config
βββ .env.example β Safe template (commit this!)
βββ samples/ β Secure code examples
β βββ secure_gemini.py
β βββ secure_firebase.js
β βββ secure_cloud_storage.py
β βββ secure_groq.js
βββ tests/test_secrets/ β Fake secrets for testing guardrails
β βββ INSTRUCTIONS.md
β βββ fake_aws_key.txt
β βββ fake_gcp_key.json
β βββ fake_gemini_key.py
β βββ fake_github_token.txt
β βββ fake_stripe_key.txt
βββ README.md β You are here
βββ WALKTHROUGH.md β Step-by-step participant guide
- Never hardcode secrets β use environment variables
- Always have a
.gitignoreβ block.envand key files - Install the pre-commit hook β it's your last line of defense before a push
- Copy
.env.exampleto.envβ fill in your values there - Rotate immediately if you ever leak a key β assume it's compromised
- π Original Blog Post : The Hackathon Security Guide: How to Vibe-Code Without Burning Down Your Project
- π Hackathon Security Bible β Full walkthrough guide
- π Gitleaks β Secret scanner
- π GitHub Secret Scanning β Built-in GitHub protection
- π GitGuardian State of Secrets Sprawl 2025 β Why this matters
Built with π for hackathon participants everywhere. Vibe code safely!