Branch Strategy
We use a three-tier branch strategy:Branch Descriptions
main - Production Branch
- Protected: Cannot push directly
- Deployment: Production site at https://jcv24fitness.com
- Updates: Only via Pull Request from
staging - Status: Should always be stable and deployable
staging - Development Branch
- Primary branch: Most work happens here
- Deployment: Auto-deploys to Cloudflare Pages staging environment
- Testing: Integration and manual testing environment
- Updates: Direct pushes allowed after build/test checks
feature/* - Feature Branches
- Optional: For large features that need isolation
- Naming:
feature/feature-name(e.g.,feature/pdf-export) - Merge target: Always merge to
stagingfirst, never tomain - Cleanup: Delete after merging
Development Workflow
Standard Workflow (staging)
For most changes, work directly onstaging:
Feature Branch Workflow
For large features requiring isolation:Pre-commit Checklist
CRITICAL: Always complete before committing:-
npm run buildpasses -
npm testpasses - No TypeScript errors
- Exports are correct (check
index.tsfiles) - New components exported from feature index
Commit Convention
We use Conventional Commits for clear commit history:Format
Types
feat: New featurefix: Bug fixdocs: Documentation changesrefactor: Code refactoring (no functional changes)test: Adding or updating testsstyle: Code style changes (formatting, whitespace)perf: Performance improvementschore: Build process, dependencies, toolingci: CI/CD configuration changes
Scopes
Common scopes matching features:auth- Authenticationwizard- Plan generator wizardpayment- Payment integrationsubscription- Subscription managementdashboard- User dashboardworkout- Workout plan featuremeal- Meal plan featurelanding- Landing pagesettings- User settings
Examples
Good Commits
Bad Commits
Multi-line Commits
For complex changes:Creating Pull Requests
Staging to Main (Production Deploy)
When ready to deploy to production:PR Template
Critical Rules
🚫 NEVER Do This
-
Never push directly to main
-
Never commit without building and testing
-
Never use
git add .blindly -
Never commit broken code
-
Never skip hooks (unless explicitly needed)
✅ Always Do This
-
Build and test before commit
-
Stage specific files
-
Write meaningful commit messages
-
Pull before push
-
Keep commits atomic
- One logical change per commit
- Related changes together
Common Commands
Daily Development
Fixing Mistakes
Sync with Remote
Handling Conflicts
If you encounter merge conflicts:Cloudflare Deployment
Staging Deployment
Automatic on push tostaging:
Production Deployment
Manual via PR merge:Worker Deployment
MercadoPago webhook worker:Code Review Guidelines
For Authors
- Keep PRs focused and reasonably sized
- Write clear PR descriptions
- Ensure all tests pass
- Test on staging before requesting review
- Respond to feedback promptly
For Reviewers
- Check that build and tests pass
- Verify commit messages follow convention
- Look for potential bugs or edge cases
- Ensure code follows project patterns
- Test changes locally if needed
- Be constructive and specific in feedback
Emergency Hotfixes
For critical production bugs:Tips for Success
- Commit often: Small, focused commits are easier to review and revert
- Pull frequently: Stay in sync with the team
- Test locally: Don’t rely on CI to catch issues
- Read error messages: Build and test failures tell you what’s wrong
- Ask for help: If stuck, ask before pushing broken code
- Document why: Commit messages should explain why, not just what
- Keep it simple: Don’t over-complicate the workflow