# {{projectName}} - Project Constitution

> **Immutable Configuration** — This file defines the technical foundation. Changes require explicit team approval.

---

## Tech Stack

{{#if techStack.backend}}
### Backend
- **Language:** {{techStack.backend.language}}
- **Framework:** {{techStack.backend.framework}}
- **Runtime:** {{techStack.backend.runtime}}
{{/if}}

{{#if techStack.frontend}}
### Frontend
- **Language:** {{techStack.frontend.language}}
- **Framework:** {{techStack.frontend.framework}}
- **Build:** {{techStack.frontend.build}}
{{/if}}

{{#if techStack.database}}
### Database
- **Primary:** {{techStack.database.primary}}
{{#if techStack.database.cache}}
- **Cache:** {{techStack.database.cache}}
{{/if}}
{{/if}}

{{#if techStack.infrastructure}}
### Infrastructure
- **Hosting:** {{techStack.infrastructure.hosting}}
- **CI/CD:** {{techStack.infrastructure.cicd}}
{{/if}}

---

## Core Patterns

{{#each patterns}}
### {{this.name}}
{{this.description}}

{{#if this.example}}
**Example:**
```{{this.lang}}
{{this.example}}
```
{{/if}}
{{/each}}

---

## Hard Rules

{{#each rules}}
### {{this.category}}
{{#each this.items}}
- **{{this.title}}:** {{this.description}}
{{/each}}
{{/each}}

---

## Code Conventions

### File Organization
{{#if codeStructure}}
{{codeStructure}}
{{/if}}

### Naming Conventions
{{#if namingConventions}}
{{namingConventions}}
{{/if}}

---

## Import Aliases

{{#if importAliases}}
| Alias | Path |
|-------|------|
{{#each importAliases}}
| `@/{{this.from}}` | `{{this.to}}` |
{{/each}}
{{/if}}

---

## Environment Variables

{{#if envVars}}
| Variable | Required | Description |
|----------|----------|-------------|
{{#each envVars}}
| `{{this.name}}` | {{this.required}} | {{this.description}} |
{{/each}}
{{/if}}

---

## Testing Standards

{{#if testing}}
### Test Organization
{{testing.structure}}

### Coverage Requirements
{{testing.coverage}}

### Test Command
```bash
{{testing.command}}
```
{{/if}}

---

## Git Conventions

### Commit Format
```
{{#if commitFormat}}
{{commitFormat}}
{{else}}
<type>(<scope>): <description>

[optional body]

[optional footer]
{{/if}}
```

### Commit Types
{{#if commitTypes}}
{{#each commitTypes}}
- **{{this.type}}:** {{this.description}}
{{/each}}
{{/if}}

---

## Deployment

{{#if deployment}}
### Strategy
{{deployment.strategy}}

### Environment Promotion
{{#each deployment.environments}}
1. **{{this.name}}:** {{this.description}}
{{/each}}
{{/if}}

---

> **Token Budget:** ~2000 tokens max
> **Last Updated:** {{timestamp}}
> **Version:** {{version}}
