PART VIII
PROJECT STRUCTURE AND ORGANIZATION
Preamble to Project Structure Standards
We, the AI Agents operating within this constitutional framework, recognizing that well-organized projects are essential for maintainability, scalability, and collaborative development, do hereby establish these project structure and organization standards as mandatory requirements that shall govern all codebases developed within this framework.
These standards exist because:
- Consistent structure enables navigation by making codebase layout predictable
- Clear organization reduces cognitive load by grouping related concerns
- Standardized configuration prevents drift by establishing authoritative sources
- Proper versioning ensures reliability by tracking changes systematically
- Organized releases enable trust by providing clear upgrade paths
Every AI Agent shall treat these standards as foundational requirements that must be established before any significant development begins.
ARTICLE 1: DIRECTORY STRUCTURE STANDARDS
Section 1.1 - Statement of Requirement
All projects must follow a consistent, well-documented directory structure.
Directory structure requirements:
- Logical separation of concerns
- Clear separation between source, configuration, and artifacts
- Consistent naming across all projects
- Self-documenting structure
- Minimal nesting (maximum 4 levels deep)
Section 1.2 - Standard Directory Layout
project-root/
├── .github/ # GitHub configuration
│ ├── ISSUE_TEMPLATE/ # Issue templates
│ ├── PULL_REQUEST_TEMPLATE.md
│ └── workflows/ # GitHub Actions workflows
├── .husky/ # Git hooks configuration
├── .vscode/ # VS Code settings
│ ├── extensions.json
│ └── settings.json
├── docs/ # Documentation
│ ├── api/
│ ├── architecture/
│ └── guides/
├── scripts/ # Build and utility scripts
├── src/ # Source code
│ ├── components/ # Reusable components
│ ├── features/ # Feature modules
│ ├── services/ # Service layer
│ ├── utils/ # Utility functions
│ ├── types/ # TypeScript type definitions
│ └── index.ts # Main entry point
├── tests/ # Test files (mirrors src structure)
│ ├── unit/
│ ├── integration/
│ └── e2e/
├── config/ # Configuration files
│ ├── development/
│ ├── staging/
│ └── production/
├── tools/ # Development tools
├── .env.example # Environment variable template
├── .eslintrc.js # ESLint configuration
├── .prettierrc # Prettier configuration
├── tsconfig.json # TypeScript configuration
├── package.json # Package definition
├── README.md # Project documentation
└── CONTRIBUTING.md # Contribution guidelines
Section 1.3 - Directory Naming Conventions
| Directory | Purpose | Naming |
|---|---|---|
| Source code | Application code | src/ |
| Tests | Test files | tests/ or __tests__/ |
| Configuration | Config files | config/ or configs/ |
| Documentation | Docs | docs/ or documentation/ |
| Scripts | Build/utility scripts | scripts/ or scripts/ |
| Binaries | Compiled output | dist/ or build/ |
| Dependencies | Installed packages | node_modules/ |
| Assets | Static files | assets/ or public/ |
| Types | TypeScript types | types/ or @types/ |
| Utils | Utility functions | utils/ or utilities/ |
Section 1.4 - Feature-Based Directory Structure
For larger applications, organize by feature:
src/
├── features/
│ ├── auth/
│ │ ├── components/
│ │ ├── services/
│ │ ├── hooks/
│ │ ├── types/
│ │ ├── utils/
│ │ ├── auth.test.ts
│ │ └── index.ts
│ ├── users/
│ │ ├── components/
│ │ ├── services/
│ │ ├── hooks/
│ │ ├── types/
│ │ ├── utils/
│ │ ├── users.test.ts
│ │ └── index.ts
│ ├── orders/
│ │ ├── components/
│ │ ├── services/
│ │ ├── hooks/
│ │ ├── types/
│ │ ├── utils/
│ │ ├── orders.test.ts
│ │ └── index.ts
│ └── products/
│ └── ...
├── shared/
│ ├── components/
│ ├── hooks/
│ ├── utils/
│ └── types/
└── app/
└── main entry point
ARTICLE 2: FILE NAMING STANDARDS
Section 2.1 - Statement of Requirement
All files must follow consistent, descriptive naming conventions.
File naming requirements:
- Use kebab-case for most files
- Use PascalCase for components
- Use descriptive names that indicate purpose
- Include file type suffix
- Group related files with consistent prefixes
Section 2.2 - File Naming Conventions Table
| File Type | Convention | Example |
|---|---|---|
| TypeScript source | kebab-case | user-service.ts |
| React component | PascalCase | UserProfile.tsx |
| Type definitions | kebab-case | user.types.ts |
| Test files | kebab-case + .test | user-service.test.ts |
| Style files | kebab-case | button-styles.css |
| Configuration | dot-prefix | .eslintrc.js |
| Environment | dot-prefix | .env.production |
| Markdown docs | kebab-case | getting-started.md |
Section 2.3 - File Naming Examples
// Service files
user-service.ts
order-service.ts
payment-service.ts
notification-service.ts
// Component files
UserProfile.tsx
OrderList.tsx
PaymentForm.tsx
NotificationBell.tsx
// Hook files (if using hooks directory)
use-user-data.ts
use-authentication.ts
use-shopping-cart.ts
// Utility files
date-formatter.ts
currency-formatter.ts
validators.ts
constants.ts
// Type definition files
user.types.ts
order.types.ts
payment.types.ts
api.types.ts
// Test files
user-service.test.ts
user-service.integration.test.ts
user-service.e2e.test.ts
// Configuration files
.eslintrc.js
.prettierrc
tsconfig.json
jest.config.js
ARTICLE 3: CONFIGURATION MANAGEMENT STANDARDS
Section 3.1 - Statement of Requirement
Configuration must be centralized, documented, and environment-aware.
Configuration requirements:
- No hardcoded configuration values
- Environment-specific configuration files
- Secrets managed via environment variables
- Configuration validated at startup
- Configuration schema documented
Section 3.2 - Environment Configuration Structure
// config/index.ts
import { validateEnvironment } from './validation';
import { getEnvironment } from './environment';
const config = {
app: {
name: process.env.APP_NAME || 'MyApp',
port: parseInt(process.env.PORT || '3000', 10),
env: getEnvironment(),
},
database: {
host: getRequiredEnv('DB_HOST'),
port: parseInt(getRequiredEnv('DB_PORT'), 10),
name: getRequiredEnv('DB_NAME'),
user: getRequiredEnv('DB_USER'),
password: getRequiredEnv('DB_PASSWORD'),
ssl: process.env.DB_SSL === 'true',
pool: {
min: parseInt(process.env.DB_POOL_MIN || '2', 10),
max: parseInt(process.env.DB_POOL_MAX || '10', 10),
},
},
cache: {
host: getRequiredEnv('REDIS_HOST'),
port: parseInt(getRequiredEnv('REDIS_PORT'), 10),
password: process.env.REDIS_PASSWORD,
ttl: parseInt(process.env.REDIS_TTL || '3600', 10),
},
logging: {
level: process.env.LOG_LEVEL || 'info',
format: process.env.LOG_FORMAT || 'json',
},
features: {
enableNewCheckout: process.env.FEATURE_NEW_CHECKOUT === 'true',
enableBetaFeatures: process.env.FEATURE_BETA === 'true',
},
rateLimit: {
windowMs: parseInt(process.env.RATE_LIMIT_WINDOW || '60000', 10),
maxRequests: parseInt(process.env.RATE_LIMIT_MAX || '100', 10),
},
};
export type Config = typeof config;
export { config };
Section 3.3 - Environment File Structure
project-root/
├── .env # Default (development)
├── .env.local # Local overrides (gitignored)
├── .env.development # Development overrides
├── .env.staging # Staging environment
├── .env.production # Production environment
└── .env.test # Test environment
Section 3.4 - Environment Variable Standards
# .env.example - Document all environment variables
# Application
APP_NAME="My Application"
PORT=3000
NODE_ENV=development
# Database
DB_HOST=localhost
DB_PORT=5432
DB_NAME=myapp_dev
DB_USER=postgres
DB_PASSWORD= # Set in .env.local
DB_SSL=false
# Cache
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD= # Set in .env.local
# External Services
API_KEY= # Set in .env.local
API_SECRET= # Set in .env.local
# Feature Flags
FEATURE_NEW_CHECKOUT=false
FEATURE_BETA=false
# Rate Limiting
RATE_LIMIT_WINDOW=60000
RATE_LIMIT_MAX=100
# Logging
LOG_LEVEL=info
LOG_FORMAT=json
ARTICLE 4: DEPENDENCY MANAGEMENT STANDARDS
Section 4.1 - Statement of Requirement
Dependencies must be carefully selected, regularly updated, and minimally used.
Dependency requirements:
- No unnecessary dependencies
- Dependencies actively maintained
- Version constraints defined
- Dependencies audited for security
- Tree-shaking support preferred
Section 4.2 - Dependency Categories
{
"dependencies": {
"express": "^4.18.2",
"zod": "^3.22.0",
"winston": "^3.11.0",
"uuid": "^9.0.0"
},
"devDependencies": {
"typescript": "^5.3.0",
"eslint": "^8.55.0",
"prettier": "^3.1.0",
"jest": "^29.7.0",
"@types/node": "^20.10.0",
"husky": "^8.0.3",
"lint-staged": "^15.2.0"
},
"peerDependencies": {
"react": ">=17.0.0",
"react-dom": ">=17.0.0"
},
"optionalDependencies": {
"sharp": "^0.33.0"
}
}
Section 4.3 - Dependency Update Policy
| Dependency Type | Update Frequency | Approval Required |
|---|---|---|
| Major versions | Annually | Yes |
| Minor versions | Quarterly | No |
| Patch versions | Monthly | No |
| Security patches | Immediately | No |
Section 4.4 - Dependency Audit Requirements
AI Agents MUST:
- Run
npm auditbefore every release - Fix critical vulnerabilities immediately
- Fix high vulnerabilities within 7 days
- Document any accepted vulnerabilities
- Update dependencies regularly
ARTICLE 5: MONOREPO GOVERNANCE STANDARDS
Section 5.1 - Statement of Requirement
Monorepos must have clear boundaries, shared configuration, and controlled dependencies.
Monorepo requirements:
- Shared configuration at root
- Clear package boundaries
- Controlled cross-package dependencies
- Consistent tooling across packages
- Independent deployability where needed
Section 5.2 - Monorepo Structure
monorepo-root/
├── package.json # Root package.json
├── package-lock.json
├── tsconfig.base.json # Shared TypeScript config
├── .eslintrc.base.js # Shared ESLint config
├── .prettierrc # Shared Prettier config
├── jest.config.base.js # Shared Jest config
├── turbo.json # Turborepo config
├── packages/
│ ├── shared/ # Shared utilities
│ │ ├── package.json
│ │ ├── tsconfig.json
│ │ └── src/
│ │ ├── types/
│ │ ├── utils/
│ │ └── index.ts
│ ├── ui/ # UI components
│ │ ├── package.json
│ │ ├── tsconfig.json
│ │ └── src/
│ │ ├── components/
│ │ └── index.ts
│ ├── api/ # API server
│ │ ├── package.json
│ │ ├── tsconfig.json
│ │ └── src/
│ │ ├── routes/
│ │ ├── services/
│ │ └── index.ts
│ └── docs/ # Documentation
│ └── ...
├── apps/
│ ├── web/ # Web application
│ │ ├── package.json
│ │ └── src/
│ ├── mobile/ # Mobile application
│ │ └── ...
│ └── desktop/ # Desktop application
│ └── ...
└── scripts/ # Monorepo scripts
├── build-all.ts
├── test-all.ts
└── publish.ts
Section 5.3 - Monorepo Configuration Files
// tsconfig.base.json
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"lib": ["ES2022"],
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"composite": true
}
}
// turbo.json
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
},
"test": {
"dependsOn": ["build"],
"outputs": ["coverage/**"]
},
"lint": {
"outputs": []
},
"dev": {
"cache": false,
"persistent": true
}
}
}
ARTICLE 6: BUILD AND DEPLOYMENT STANDARDS
Section 6.1 - Statement of Requirement
Build and deployment must be automated, reproducible, and documented.
Build/deployment requirements:
- CI/CD pipeline for all environments
- Reproducible builds
- Automated testing
- Environment-specific configurations
- Rollback capability
Section 6.2 - Build Pipeline Standards
# .github/workflows/build.yml
name: Build and Test
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run lint
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run typecheck
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run test:ci
build:
name: Build
runs-on: ubuntu-latest
needs: [lint, typecheck, test]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- run: npm ci
- run: npm run build
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
Section 6.3 - Deployment Pipeline
# .github/workflows/deploy.yml
name: Deploy
on:
push:
tags:
- 'v*'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
deploy-staging:
name: Deploy to Staging
runs-on: ubuntu-latest
if: contains(github.ref, 'develop')
environment: staging
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy to staging
run: |
kubectl set image deployment/app app=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:staging
--namespace=staging
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
needs: [deploy-staging]
if: contains(github.ref, 'main')
environment: production
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Deploy to production
run: |
kubectl set image deployment/app app=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
--namespace=production
Section 6.4 - Build Environment Requirements
| Environment | Node Version | Cache | Artifacts |
|---|---|---|---|
| Development | Latest LTS | Yes | None |
| CI/CD | Exact version | Yes | dist/ |
| Staging | Exact version | Yes | Docker image |
| Production | Exact version | Yes | Docker image |
ARTICLE 7: VERSIONING STANDARDS
Section 7.1 - Statement of Requirement
All projects must follow Semantic Versioning (SemVer).
Versioning requirements:
- Use major.minor.patch format
- Increment appropriately based on changes
- Pre-release versions for unstable releases
- No breaking changes in minor/patch
- Document all breaking changes
Section 7.2 - Semantic Versioning Rules
| Change Type | Example | Increment |
|---|---|---|
| Bug fixes | Fix user login | patch: 1.0.0 → 1.0.1 |
| New features | Add dark mode | minor: 1.0.0 → 1.1.0 |
| Breaking changes | Rename API | major: 1.0.0 → 2.0.0 |
| Deprecations | Mark old method | minor: 1.0.0 → 1.1.0 |
| Security patches | Fix vulnerability | patch: 1.0.0 → 1.0.1 |
Section 7.3 - Version Number Examples
# Version formats
1.0.0 # Release version
1.0.0-alpha.1 # Alpha release
1.0.0-beta.1 # Beta release
1.0.0-rc.1 # Release candidate
1.0.0+build.123 # Build metadata
# npm version commands
npm version major # 1.0.0 → 2.0.0
npm version minor # 1.0.0 → 1.1.0
npm version patch # 1.0.0 → 1.0.1
npm version prerelease # 1.0.0 → 1.0.1-alpha.1
Section 7.4 - Breaking Change Standards
Breaking changes include:
-
API Changes
- Removing endpoints
- Changing parameter names
- Changing response structure
- Changing authentication methods
-
Data Changes
- Database schema changes
- Changing data types
- Removing fields
-
Behavior Changes
- Changing default values
- Changing error messages
- Changing validation rules
-
Dependency Changes
- Upgrading to incompatible versions
- Removing dependencies
ARTICLE 8: RELEASE MANAGEMENT STANDARDS
Section 8.1 - Statement of Requirement
Releases must be planned, tested, documented, and reversible.
Release requirements:
- Release planning and scheduling
- Feature freezes before releases
- Comprehensive testing
- Changelog documentation
- Rollback procedures defined
Section 8.2 - Release Types
| Release Type | Frequency | Scope | Testing |
|---|---|---|---|
| Hotfix | As needed | Critical fixes | Full |
| Patch | Monthly | Bug fixes | Full |
| Minor | Quarterly | New features | Full + Integration |
| Major | Annually | Breaking changes | Full + Migration |
| Beta | As needed | Pre-release testing | Full |
Section 8.3 - Release Checklist
RELEASE CHECKLIST
=================
PRE-RELEASE (1 week before):
[ ] All features merged
[ ] Code freeze in effect
[ ] Migration guide drafted
[ ] Changelog updated
[ ] Release notes drafted
TESTING:
[ ] Unit tests passing (100%)
[ ] Integration tests passing
[ ] E2E tests passing
[ ] Performance tests passing
[ ] Security scan complete
[ ] Accessibility audit complete
[ ] Browser compatibility tested
ARTIFACTS:
[ ] Build succeeds
[ ] Docker image built
[ ] Image pushed to registry
[ ] Documentation published
COMMUNICATION:
[ ] Changelog published
[ ] Release notes published
[ ] Stakeholders notified
[ ] Support team briefed
[ ] Marketing informed (if needed)
DEPLOYMENT:
[ ] Deployment plan reviewed
[ ] Rollback plan tested
[ ] Monitoring dashboards ready
[ ] Alerts configured
[ ] Runbook updated
POST-RELEASE:
[ ] Smoke tests passed
[ ] Monitoring healthy
[ ] No critical errors
[ ] Users notified
Section 8.4 - Release Process
# 1. Create release branch
git checkout develop
git pull origin develop
git checkout -b release/v1.2.0
# 2. Update version
npm version minor # or major/patch
# 3. Update changelog
# Edit CHANGELOG.md with release notes
# 4. Run final checks
npm run lint
npm run typecheck
npm run test:ci
npm run build
# 5. Merge to main
git checkout main
git merge release/v1.2.0
git tag v1.2.0
git push origin main --tags
# 6. Merge back to develop
git checkout develop
git merge release/v1.2.0
git push origin develop
# 7. Create GitHub release
gh release create v1.2.0 \
--title "Release v1.2.0" \
--notes "$(cat CHANGELOG.md)"
ARTICLE 9: BRANCHING STRATEGY STANDARDS
Section 9.1 - Statement of Requirement
All development must follow a consistent branching strategy.
Branching requirements:
- Feature branches from appropriate base
- Protected main branch
- Clean branch naming
- Regular synchronization
- Branch age limits
Section 9.2 - Branch Types
| Branch | Purpose | Naming | Lifetime |
|---|---|---|---|
| main | Production code | main | Permanent |
| develop | Integration | develop | Permanent |
| feature/* | New features | feature/JIRA-123-feature-name | Until merged |
| bugfix/* | Bug fixes | bugfix/JIRA-456-fix-login | Until merged |
| hotfix/* | Urgent fixes | hotfix/JIRA-789-security-patch | Until merged |
| release/* | Release prep | release/v1.2.0 | Until released |
Section 9.3 - Branch Naming Conventions
# Feature branches
feature/JIRA-123-add-user-authentication
feature/JIRA-456-implement-shopping-cart
feature/add-dark-mode
# Bug fix branches
bugfix/JIRA-789-fix-login-redirect
bugfix/JIRA-101-fix-payment-validation
bugfix/resolve-memory-leak
# Hotfix branches
hotfix/JIRA-202-security-patch-cve
hotfix/JIRA-203-critical-data-loss
# Release branches
release/v1.2.0
release/v2.0.0-rc.1
# Chore branches
chore/JIRA-204-update-dependencies
chore/JIRA-205-refactor-user-service
Section 9.4 - Git Flow Workflow
main ────────────────────────────────────────────►
↑ ↑ ↑
│ merge │ merge │ merge (hotfix)
│ │ │
release/v1.0.0 release/v1.1.0 hotfix/v1.0.1
│ │ │
│ merge │ merge │
↓ ↓ │
develop ──────────────────────────────────────►
↑ ↑
│ │
feature/* feature/*
feature/JIRA-123 feature/JIRA-456
ARTICLE 10: GIT COMMIT STANDARDS
Section 10.1 - Statement of Requirement
All commits must follow Conventional Commits specification.
Commit requirements:
- Meaningful commit messages
- Conventional commit format
- Atomic commits (one change per commit)
- Reference to issue tracker
- No meaningless commits
Section 10.2 - Conventional Commits Format
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Section 10.3 - Commit Types
| Type | Description | Example |
|---|---|---|
| feat | New feature | feat(auth): add OAuth2 login |
| fix | Bug fix | fix(cart): resolve quantity calculation |
| docs | Documentation | docs: update README |
| style | Formatting | style: format with Prettier |
| refactor | Code restructure | refactor(user): extract validation |
| perf | Performance | perf(api): optimize query |
| test | Tests | test(auth): add login tests |
| build | Build system | build: update webpack config |
| ci | CI/CD | ci: add GitHub Actions |
| chore | Maintenance | chore: update dependencies |
| revert | Revert commit | revert: revert "feat: add feature" |
Section 10.4 - Commit Message Examples
# Simple commit
git commit -m "fix(auth): resolve login redirect issue"
# Commit with scope
git commit -m "feat(checkout): add coupon code support"
# Commit with body
git commit -m "feat(payments): add Stripe webhook support
Implements webhook endpoint for handling payment events from Stripe.
Supports payment.succeeded and payment.failed events.
Closes JIRA-123"
# Commit with footer
git commit -m "fix(api): handle null response from external API
The external API sometimes returns null instead of an object.
Now gracefully handles this case by returning an empty array.
Closes JIRA-456
Refs JIRA-789"
# Commit with breaking change
git commit -m "feat(api)!: change user endpoint response format
BREAKING CHANGE: The /api/users endpoint now returns an object
with 'data' and 'meta' properties instead of a flat array.
Migration guide: https://docs.example.com/migration/v2"
Section 10.5 - Commit Rules
- First line limit: 72 characters maximum
- Use imperative mood: "Add feature" not "Added feature"
- No period at end: "Add feature" not "Add feature."
- Reference issues: Include JIRA ticket numbers
- One change per commit: Don't mix unrelated changes
- Atomic commits: Each commit should be self-contained
ARTICLE 11: PULL REQUEST STANDARDS
Section 11.1 - Statement of Requirement
All changes must go through pull request review.
Pull request requirements:
- Descriptive title and description
- Linked issues
- Passing CI/CD
- Code review approval
- Squash merge to main
Section 11.2 - Pull Request Template
## Description
<!-- Describe what this PR does and why -->
## Type of Change
- [ ] Bug fix (non-breaking change)
- [ ] New feature (non-breaking change)
- [ ] Breaking change (fix or feature)
- [ ] This change requires a documentation update
## Checklist
- [ ] My code follows the style guidelines
- [ ] I have performed a self-review
- [ ] I have commented my code where necessary
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix
- [ ] New and existing tests pass locally
- [ ] Any dependent changes have been merged
## Screenshots (if applicable)
<!-- Add screenshots for UI changes -->
## Related Issues
<!-- Link related issues: Closes #123, Related to #456 -->
## Notes for Reviewers
<!-- Any additional context for reviewers -->
Section 11.3 - Pull Request Checklist
PULL REQUEST CHECKLIST
======================
BEFORE SUBMITTING:
[ ] Code follows style guidelines
[ ] Self-review completed
[ ] Tests added/updated
[ ] Documentation updated
[ ] No console.log/debugger
[ ] No TODO comments
[ ] No placeholder values
[ ] No hardcoded secrets
DESCRIPTION:
[ ] Clear title
[ ] Detailed description
[ ] Screenshots (if UI)
[ ] Breaking changes noted
[ ] Migration guide (if needed)
TESTING:
[ ] Local testing complete
[ ] CI/CD passing
[ ] Manual testing (if needed)
[ ] Edge cases considered
REVIEW:
[ ] Reviewer assigned
[ ] All comments addressed
[ ] Approval received
[ ] No unresolved discussions
Section 11.4 - Code Review Standards
// Code review guidelines for reviewers
REVIEWER RESPONSIBILITIES:
1. Logic and correctness
- Does the code do what it claims?
- Are there edge cases not handled?
- Could this break existing functionality?
2. Security
- Any security vulnerabilities?
- Input properly validated?
- Secrets properly managed?
3. Performance
- Any obvious performance issues?
- N+1 query patterns?
- Unnecessary re-renders?
4. Maintainability
- Is the code readable?
- Is it consistent with existing code?
- Are there tests?
REVIEW FEEDBACK:
// DO:
// - Be specific about what needs to change
// - Explain why something is an issue
// - Suggest alternatives
// - Be respectful and constructive
// DON'T:
// - "LGTM" without explanation
// - Nitpick style issues (use linting)
// - Block for minor preferences
// - Be rude or dismissive
ARTICLE 12: CODE FREEZE STANDARDS
Section 12.1 - Statement of Requirement
Code freezes must be scheduled, communicated, and enforced.
Code freeze requirements:
- Advance notice of freeze dates
- Exception process defined
- Emergency exception procedure
- Freeze duration limits
- Clear scope of restrictions
Section 12.2 - Code Freeze Types
| Type | Duration | Allowed Changes |
|---|---|---|
| Minor Release | 1-2 weeks | Bug fixes only |
| Major Release | 2-4 weeks | Critical bug fixes only |
| Security | Immediate | Security patches only |
| Extended | As needed | Exceptions required |
Section 12.3 - Code Freeze Procedure
CODE FREEZE PROCEDURE
=====================
INITIATION:
1. Announce code freeze 1 week in advance
2. Include: start date, end date, scope, exceptions
DURING FREEZE:
1. No new features merged
2. No non-critical changes merged
3. Bug fixes require bug report linked
4. All tests must pass
5. Two approvals required
EXCEPTIONS:
1. Critical bugs blocking release
2. Security vulnerabilities
3. Legal/compliance issues
4. Request via: exception-form.md
EMERGENCY HOTFIX:
1. Notify release manager
2. Create hotfix branch from release tag
3. Fast-track review (1 approver)
4. Direct merge to release branch
5. Document in incident report
Section 12.4 - Code Freeze Communication
# Code Freeze Announcement
**Subject:** CODE FREEZE for v1.2.0 Release - [DATE] to [DATE]
**Timeline:**
- Freeze starts: January 15, 2024 00:00 UTC
- Freeze ends: January 29, 2024 23:59 UTC
- Release target: January 30, 2024
**Scope:**
- Branch: release/v1.2.0
- Only bug fixes and documentation allowed
**Exceptions:**
- Critical bugs (P0/P1) only
- Submit exception request to #release-Exceptions channel
**Contact:**
- Release Manager: @release-manager
- Channel: #release-v1.2.0
ARTICLE 13: HOTFIX STANDARDS
Section 13.1 - Statement of Requirement
Hotfixes must be fast, focused, and follow emergency procedures.
Hotfix requirements:
- Critical only (data loss, security, service down)
- Minimal changes
- Fast-track review
- Immediate deployment
- Post-incident review
Section 13.2 - Hotfix Process
# HOTFIX PROCESS
# 1. Create hotfix branch from production tag
git checkout -b hotfix/v1.0.1 v1.0.0
git pull origin v1.0.0
# 2. Make minimal fix
# ... edit files ...
git add .
git commit -m "fix(critical): resolve data loss on edge case
Hotfix for JIRA-123
[Critical bug description and root cause]
Signed-off-by: Developer Name"
# 3. Fast-track review
# - One approval sufficient
# - Skip CI for trivial changes
# - Immediate review by on-call
# 4. Merge to production
git checkout main
git merge hotfix/v1.0.1
git tag v1.0.1
git push origin main --tags
# 5. Merge to develop
git checkout develop
git merge hotfix/v1.0.1
git push origin develop
# 6. Delete hotfix branch
git branch -d hotfix/v1.0.1
git push origin --delete hotfix/v1.0.1
# 7. Deploy immediately
# (trigger production deployment)
Section 13.3 - Hotfix Criteria
| Priority | Criteria | Examples |
|---|---|---|
| P0 | Complete service outage | Database down, auth broken |
| P1 | Major feature broken | Payments failing |
| P2 | Data loss risk | Corruption possible |
| P3 | Security vulnerability | SQL injection possible |
| P4 | Minor but quick fix | Typo, minor bug |
Section 13.4 - Hotfix Prevention
To minimize hotfixes:
- Thorough testing before release
- Feature flags for risky changes
- Canary deployments for gradual rollout
- Rollback plans ready
- Monitoring alerts configured
- Runbooks documented
ARTICLE 14: CHANGELOG STANDARDS
Section 14.1 - Statement of Requirement
All releases must have accurate, well-formatted changelogs.
Changelog requirements:
- Follow Keep a Changelog format
- Categorize changes appropriately
- Reference issues and PRs
- Maintain reverse chronological order
- Include migration notes
Section 14.2 - Changelog Format
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.0.0] - 2024-01-15
### Added
- `feature:user-authentication`
- OAuth2 login support for Google and GitHub
- Multi-factor authentication (TOTP)
- Password reset flow with email verification
- `feature:api-v2`
- New REST API version with improved performance
- GraphQL endpoint for complex queries
### Changed
- `breaking:user-endpoint`
- User endpoint now returns `{ data, meta }` structure
- See [Migration Guide v2](docs/migration-v2.md)
- `change:validation`
- Email validation now follows RFC 5322 standard
### Deprecated
- `deprecate:api-v1`
- `/api/v1/*` endpoints marked deprecated
- Will be removed in v3.0.0
- Migrate to `/api/v2/*`
### Removed
- `remove:legacy-auth`
- Removed deprecated MD5 password hashing
- Removed `remember_token` field
### Fixed
- `fix:payment-processing`
- Resolved race condition in payment webhook handler
- Closes #1234
- `fix:session-timeout`
- Sessions now correctly timeout after 30 minutes
- Closes #1235
### Security
- `security:cve-2024-1234`
- Patched SQL injection vulnerability in search endpoint
- Updated dependencies to patch known vulnerabilities
## [1.5.0] - 2023-10-01
### Added
- Dark mode support
- Export to CSV functionality
Section 14.3 - Changelog Categories
| Category | Description | Badge |
|---|---|---|
| Added | New features | 🆕 |
| Changed | Changes in existing functionality | 🔄 |
| Deprecated | Soon-to-be removed features | ⚠️ |
| Removed | Removed features | ❌ |
| Fixed | Bug fixes | 🐛 |
| Security | Security patches | 🔒 |
| Performance | Performance improvements | ⚡ |
| Breaking | Breaking changes (include migration) | 💥 |
Section 14.4 - Changelog Maintenance
# CHANGELOG MAINTENANCE
# 1. Update changelog with each PR
git log --oneline --decorate v1.0.0..HEAD | \
while read commit msg; do
# Parse conventional commit
# Add to CHANGELOG.md
done
# 2. Before release
# - Review all entries
# - Remove duplicate entries
# - Ensure consistent formatting
# - Add migration notes if needed
# 3. After release
# - Archive previous version
# - Reset for next version
# - Publish to release page
ARTICLE 15: DOCUMENTATION STANDARDS
Section 15.1 - Statement of Requirement
All projects must have comprehensive, up-to-date documentation.
Documentation requirements:
- README with getting started
- API documentation
- Architecture documentation
- Contribution guidelines
- Runbooks for operations
Section 15.2 - Required Documentation Files
| File | Purpose | Location |
|---|---|---|
| README.md | Project overview | Root |
| CONTRIBUTING.md | Contribution guidelines | Root |
| ARCHITECTURE.md | System architecture | docs/ |
| API.md | API documentation | docs/ |
| DEPLOYMENT.md | Deployment guide | docs/ |
| CHANGELOG.md | Version history | Root |
| LICENSE | License file | Root |
| CODE_OF_CONDUCT.md | Community guidelines | Root |
Section 15.3 - README Template
# Project Name
Brief description of what this project does.
## Features
- Feature 1
- Feature 2
- Feature 3
## Quick Start
### Prerequisites
- Node.js 18+
- PostgreSQL 14+
- Redis 6+
### Installation
\`\`\`bash
git clone <repository>
cd <project>
npm install
\`\`\`
### Configuration
\`\`\`bash
cp .env.example .env
# Edit .env with your configuration
\`\`\`
### Running
\`\`\`bash
# Development
npm run dev
# Production
npm run build
npm start
\`\`\`
## Testing
\`\`\`bash
npm test
npm run test:coverage
\`\`\`
## Documentation
For full documentation, see [docs/](docs/)
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
MIT License - see [LICENSE](LICENSE)
SCHEDULE: PROJECT STRUCTURE QUICK REFERENCE
Directory Structure
| Directory | Purpose | Required |
|---|---|---|
| src/ | Source code | Yes |
| tests/ | Test files | Yes |
| docs/ | Documentation | Yes |
| config/ | Configuration | Yes |
| scripts/ | Build scripts | Recommended |
| .github/ | GitHub config | Yes |
File Naming
| Type | Convention | Example |
|---|---|---|
| Source files | kebab-case | user-service.ts |
| Components | PascalCase | UserProfile.tsx |
| Config files | dot-prefix | .eslintrc.js |
| Test files | .test suffix | user.test.ts |
Version Control
| Item | Standard |
|---|---|
| Versioning | SemVer |
| Branch naming | type/JIRA-description |
| Commit format | conventionalcommits.org |
| PR requirements | Template + reviews |
Release Process
| Phase | Duration |
|---|---|
| Feature freeze | 1-2 weeks |
| Testing | 1 week |
| Code freeze | 1-2 weeks |
| Release | Scheduled |
GLOSSARY OF PROJECT STRUCTURE TERMS
Branch: A parallel line of development in Git.
Build: The process of compiling source code into deployable artifacts.
Changelog: A record of all notable changes made to a project.
Code Freeze: A period during which no new code is merged except critical fixes.
Commit: A snapshot of changes in Git.
Conventional Commits: A commit message format standard.
Dependency: An external package or library that a project uses.
Deploy: To release software to an environment.
Feature Branch: A branch created for developing a new feature.
Hotfix: An urgent fix deployed directly to production.
Main Branch: The primary branch containing production code.
Monorepo: A repository containing multiple projects.
Pull Request: A request to merge changes from one branch to another.
Release: A published version of software.
Rollback: To revert to a previous version.
Semantic Versioning: A versioning scheme using major.minor.patch.
SemVer: See Semantic Versioning.
Tag: A named reference to a specific commit.
Version: A specific release of software.
These project structure and organization standards are foundational. Deviation from these standards undermines project maintainability and team collaboration.