| Metadata | Value |
|---|---|
| Status | Active |
| Version | 1.1.0 |
| Last Updated | 2026-09-10 |
| Author | Sangeetha Grantha Team |
| Document Type | Design reference |
[!NOTE] Design/reference material: this page may include proposals or earlier implementation assumptions. Use current feature map for implemented behavior and current operating steps.
Target: Consistent, reproducible development environments across macOS, Linux, and Windows
Philosophy: “One command to rule them all” — eliminate environment setup friction
This document outlines the requirement for Cross-Platform Development Environment Standardisation in the Sangeetha Grantha project. As a multi-platform monorepo with diverse technology stacks (Kotlin Multiplatform, React, Rust, PostgreSQL), ensuring consistent development environments across different operating systems is critical for team productivity, CI/CD reliability, and onboarding efficiency.
Core Requirement: All developers, regardless of their operating system (macOS, Linux, or Windows), must be able to set up a fully functional development environment with a single command, using identical toolchain versions and configuration.
Sangeetha Grantha is a complex monorepo requiring multiple toolchains:
| Component | Technology | Version Requirements |
|---|---|---|
| Backend | Kotlin + Ktor | Java 25+ (JVM toolchain) |
| Mobile | Kotlin Multiplatform | Java 25+ (Android), Xcode (iOS) |
| Frontend | React + TypeScript | Bun 1.3.0 (package manager) |
| CLI Tools | Rust | Rust 1.92.0 (compiler) |
| Database | PostgreSQL | PostgreSQL 18+ |
| Build System | Gradle | Gradle wrapper (included) |
macOS Developers:
Linux Developers:
Windows Developers:
Impact: Developers spend 2-4 hours on initial setup, with frequent version mismatches causing “works on my machine” issues.
Problem: Environment configuration scattered across multiple files with inconsistent naming:
config/application.local.toml.env or config/development.envImpact:
Problem: PostgreSQL setup differs across platforms:
Impact:
Problem: New team members face a steep learning curve:
Total Time: 2.5-4.5 hours per developer
Impact:
Requirement: A single command must set up the complete development environment.
Acceptance Criteria:
Priority: P0 (Critical)
Requirement: All toolchain versions must be explicitly pinned and enforced.
Acceptance Criteria:
Priority: P0 (Critical)
Requirement: Setup process must work identically on macOS, Linux, and Windows.
Acceptance Criteria:
Priority: P0 (Critical)
Requirement: Setup script must be safe to run multiple times.
Acceptance Criteria:
Priority: P1 (High)
Requirement: Environment configuration must be standardized and template-based.
Acceptance Criteria:
Priority: P1 (High)
Requirement: Complete environment setup must complete in under 15 minutes.
Target: 5-10 minutes for typical setup Measurement: Time from running setup command to verified working environment
Priority: P1 (High)
Requirement: Setup script must provide clear, actionable error messages.
Acceptance Criteria:
Priority: P1 (High)
Requirement: Setup process must be fully documented.
Acceptance Criteria:
Priority: P2 (Medium)
Requirement: Setup configuration must be easy to update.
Acceptance Criteria:
Priority: P2 (Medium)
Constraint: Must use a cross-platform toolchain version manager.
Options Considered:
Decision: Use mise for unified toolchain management.
Constraint: Must use Docker Compose for database to ensure consistency.
Rationale:
Constraint: Must support both TOML (backend) and .env (frontend) formats.
Solution: Generate both formats from canonical templates.
The standardisation solution consists of three core components:
.mise.toml file pins all tool versionstools/bootstrap-assets/env/config/ (gitignored)tools/bootstrap (Unix/Linux/macOS)tools/bootstrap.ps1 (Windows)What it is: A cross-platform toolchain version manager (successor to rtx/asdf) that automatically installs and manages tool versions.
Why mise:
.mise.toml file)Configuration: .mise.toml at project root
[tools]
java = "temurin-25" # Matches Gradle toolchain requirement
rust = "1.92.0" # Matches tools/sangita-cli/rust-toolchain.toml
bun = "1.3.0" # Frontend package manager
Usage:
curl https://mise.run | sh # macOS/Linux
mise install # Installs all tools from .mise.toml
mise activate # Activates tools in current shell
Problem: Environment variables scattered across multiple files, inconsistent naming, risk of committing secrets.
Solution: Single source of truth for configuration templates.
Structure:
tools/bootstrap-assets/
└── env/
└── development.env.example # Template (committed to git)
config/
└── development.env # Actual config (gitignored)
Template File: tools/bootstrap-assets/env/development.env.example
Generated File: config/development.env
Key Variables:
VITE_API_BASE_URL=http://localhost:8080
API_HOST=0.0.0.0 API_PORT=8080 ADMIN_TOKEN=dev-admin-token
DB_HOST=localhost DB_PORT=5432 DB_NAME=sangita_grantha DB_USER=postgres DB_PASSWORD=postgres
### 4.1.3 Bootstrap Scripts
**Purpose**: Automated, one-command setup that works identically across all platforms.
**Unix/Linux/macOS**: `tools/bootstrap` (bash)
- Detects and uses mise if available
- Falls back to system tools with warnings
- Creates canonical config files from templates
- Starts Docker Compose PostgreSQL
- Builds Rust CLI tool
- Runs database migrations and seeds
- Installs frontend dependencies
**Windows**: `tools/bootstrap.ps1` (PowerShell)
- Same functionality as bash script
- PowerShell-native path handling
- Compatible with Windows Docker Desktop
**Workflow**:
# Unix/Linux/macOS
./tools/bootstrap
# Windows
powershell -ExecutionPolicy Bypass -File .\tools\bootstrap.ps1
**What it does** (in order):
1. ✅ Installs toolchain via mise (Java 25, Rust 1.92.0, Bun 1.3.0)
2. ✅ Verifies Docker + Docker Compose availability
3. ✅ Creates `config/development.env` from template (if missing)
4. ✅ Starts PostgreSQL 18 via Docker Compose
5. ✅ Builds `sangita-cli` Rust tool
6. ✅ Runs database reset (drop → create → migrate → seed)
7. ✅ Installs frontend dependencies (bun install)
**Post-Bootstrap**:
# Start full dev stack
cargo run --manifest-path tools/sangita-cli/Cargo.toml -- dev --start-db
# Or run services separately
./gradlew :modules:backend:api:run cd modules/frontend/sangita-admin-web && bun run dev
### 4.2 Workflow
┌─────────────────────────────────────────────────────────────┐ │ Developer runs: ./tools/bootstrap (or bootstrap.ps1) │ └───────────────────────┬─────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ 1. Check for mise (toolchain manager) │ │ ├─ If present: Install tools from .mise.toml │ │ └─ If missing: Warn and use system tools │ └───────────────────────┬─────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ 2. Verify Docker + Docker Compose │ │ └─ Exit with error if missing │ └───────────────────────┬─────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ 3. Create config files from templates │ │ ├─ config/development.env (if missing) │ │ └─ Preserve existing files (idempotent) │ └───────────────────────┬─────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ 4. Start PostgreSQL via Docker Compose │ │ └─ Wait for health check │ └───────────────────────┬─────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ 5. Build Rust CLI tool (sangita-cli) │ └───────────────────────┬─────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ 6. Run database migrations and seed data │ │ └─ cargo run – db reset │ └───────────────────────┬─────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ 7. Install frontend dependencies │ │ └─ bun install │ └───────────────────────┬─────────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ ✅ Environment ready! │ │ Next: cargo run – dev –start-db │ └─────────────────────────────────────────────────────────────┘
### 4.3 Key Design Decisions
#### Decision 1: Use mise Instead of Language-Specific Managers
**Rationale**:
- Single tool manages all languages (Java, Rust, Bun)
- Faster than asdf (written in Rust)
- Better Windows support than asdf
- Simpler configuration (single TOML file)
#### Decision 2: Docker Compose for Database
**Rationale**:
- Ensures identical PostgreSQL version across platforms
- No system-level installation conflicts
- Easy to reset and recreate
- Aligns with containerization strategy
#### Decision 3: Template-Based Configuration
**Rationale**:
- Prevents accidental secret commits
- Ensures consistency across developers
- Easy to update (change template, regenerate)
- Supports multiple environments (dev/staging/prod)
#### Decision 4: Idempotent Bootstrap Scripts
**Rationale**:
- Safe to run multiple times
- Preserves developer customizations
- Reduces support burden
- Enables automated verification
#### Decision 5: CLI Tools Trust mise
**Rationale**:
- sangita-cli complements mise rather than duplicating its functionality
- mise is the single source of truth for tool versions
- CLI focuses on workflow orchestration, not toolchain management
- Reduces code duplication and maintenance burden
**Implementation**:
- sangita-cli's `setup` command trusts mise for toolchain (Rust, Java, Bun, Docker Compose)
- Only checks tools NOT managed by mise (Docker service)
- Detects mise environment and provides helpful guidance
- Developers run CLI via `mise exec cargo run -- ...` to ensure correct tool versions
**Key Principles**:
- ✅ Trust mise for toolchain management
- ✅ Focus CLI on database, workflow, and testing (core purpose)
- ✅ Don't duplicate version checking or tool discovery
- ✅ Provide helpful error messages suggesting mise when tools are missing
- ✅ Backward compatible (works without mise, with warnings)
### 4.4 Implementation Details
#### 4.4.1 Bootstrap Script Logic
Phase 1: Toolchain Setup if mise is available: mise install # Install Java, Rust, Bun mise activate # Add to PATH else: warn: “Use system tools (verify versions manually)”
Phase 2: Docker Verification check docker command exists check docker compose or docker-compose exists exit if missing
Phase 3: Config File Creation if config/development.env exists: skip (preserve user customizations) else: copy tools/bootstrap-assets/env/development.env.example → config/development.env
Phase 4: Database Setup docker compose up -d postgres # Start PostgreSQL 18 wait for health check
Phase 5: Build & Migrate cargo build –manifest-path tools/sangita-cli/Cargo.toml cargo run –manifest-path tools/sangita-cli/Cargo.toml – db reset –mode docker
Phase 6: Frontend Dependencies if bun is available: cd modules/frontend/sangita-admin-web bun install else: warn: “Skip frontend install”
#### 4.4.2 Error Handling
**Bootstrap Script Behavior**:
- ✅ Uses `set -euo pipefail` (bash) / `$ErrorActionPreference = "Stop"` (PowerShell)
- ✅ Exits on first error with clear message
- ✅ Provides actionable error messages (e.g., "Install Docker Desktop")
- ✅ Preserves existing config files (doesn't overwrite)
**Graceful Degradation**:
- If mise is missing: Continue with system tools (with warnings)
- If bun is missing: Skip frontend install (optional step)
- If config exists: Preserve user customizations
#### 4.4.3 Cross-OS Compatibility
**Path Handling**:
- **Unix/Linux/macOS**: Uses forward slashes (`/`)
- **Windows**: PowerShell script uses `Join-Path` for cross-platform paths
**Shell Activation**:
- **Unix/Linux/macOS**: `eval "$(mise activate bash)"` or `eval "$(mise activate zsh)"`
- **Windows**: mise activation handled by PowerShell profile (if configured)
**Docker Compose**:
- **Modern**: `docker compose` (Docker Compose V2)
- **Legacy**: `docker-compose` (fallback for older installations)
#### 4.4.4 Version Pinning Strategy
| Tool | Version | Source | Rationale |
| :--- | :--- | :--- | :--- |
| **Java** | `temurin-25` | `.mise.toml` | Matches `build.gradle.kts` JVM toolchain (Java 25) |
| **Rust** | `1.92.0` | `.mise.toml` + `tools/sangita-cli/rust-toolchain.toml` | CLI toolchain requirement |
| **Bun** | `1.3.0` | `.mise.toml` | Frontend package manager (faster than npm) |
| **PostgreSQL** | `15` | `compose.yaml` | Database version (via Docker) |
**Version Sync**: `.mise.toml` must stay in sync with:
- `build.gradle.kts` (Java version)
- `tools/sangita-cli/rust-toolchain.toml` (Rust version)
#### 4.4.5 File Structure
sangeetha-grantha/ ├── .mise.toml # Toolchain versions ├── tools/ │ ├── bootstrap # Unix/Linux/macOS script │ ├── bootstrap.ps1 # Windows PowerShell script │ └── bootstrap-assets/ │ └── env/ │ └── development.env.example # Config template ├── config/ │ └── development.env # Generated (gitignored) └── compose.yaml # Docker Compose (Postgres 15)
---
## 5. Success Criteria
### 5.1 Quantitative Metrics
| Metric | Target | Measurement |
|--------|--------|-------------|
| **Setup Time** | < 15 minutes | Time from command to verified environment |
| **Onboarding Time** | < 30 minutes | Total time for new developer to first commit |
| **Environment Consistency** | 100% | All developers use same tool versions |
| **Setup Success Rate** | > 95% | Percentage of successful first-time setups |
### 5.2 Qualitative Outcomes
- ✅ **Developer Satisfaction**: Reduced frustration with environment setup
- ✅ **Team Velocity**: Faster onboarding of new team members
- ✅ **CI/CD Reliability**: Fewer environment-related test failures
- ✅ **Documentation Quality**: Single source of truth for setup instructions
- ✅ **Maintenance Burden**: Reduced support requests for environment issues
---
## 6. Dependencies & Prerequisites
### 6.1 External Dependencies
- **Docker Desktop** (macOS/Windows) or **Docker Engine** (Linux)
- **Git** (for version control)
- **mise** (optional but recommended) — installs automatically if present
### 6.2 Internal Dependencies
- **Sangita CLI** (`tools/sangita-cli`): Rust tool for database management
- **Docker Compose** (`compose.yaml`): PostgreSQL 18 container definition
- **Gradle Wrapper**: Included in repository
- **Bootstrap Assets**: Template files in `tools/bootstrap-assets/`
---
## 7. Risks & Mitigations
### 7.1 Risk: mise Not Available on All Platforms
**Mitigation**:
- Bootstrap script gracefully degrades to system tools
- Clear warnings guide developers to install mise
- Documentation includes manual setup instructions
### 7.2 Risk: Docker Not Available
**Mitigation**:
- Bootstrap script checks for Docker before proceeding
- Clear error message with installation instructions
- Alternative: Manual PostgreSQL setup documented (not recommended)
### 7.3 Risk: Version Conflicts with System Tools
**Mitigation**:
- mise isolates tool versions in project directory
- PATH management ensures project tools take precedence
- Clear documentation of version requirements
### 7.4 Risk: Configuration Template Drift
**Mitigation**:
- Template files in version control
- Bootstrap script validates template existence
- Regular review of template vs generated files
---
## 8. Future Enhancements
### 8.1 Potential Improvements
1. **IDE Integration**
- VS Code/Cursor workspace settings auto-activate mise
- IntelliJ IDEA project SDK detection from mise
2. **Health Checks**
- Automated verification of environment correctness
- Pre-commit hook to verify tool versions match `.mise.toml`
3. **Advanced Config Management**
- Support for multiple environments (dev/staging/prod)
- Config validation (ensure required variables are set)
- Secret management integration (e.g., 1Password, AWS Secrets Manager)
4. **Documentation Automation**
- Auto-generate setup instructions from `.mise.toml`
- Bootstrap script output includes next steps
- Interactive troubleshooting guide
5. **CI/CD Integration**
- Use same mise configuration in GitHub Actions
- Ensure CI environment matches local setup
- Automated environment verification in CI pipeline
---
## 9. Usage Guide
### 9.1 First-Time Setup
Step 1: Clone Repository
git clone
**Step 2: Install mise (Recommended)**
# macOS/Linux
curl https://mise.run | sh
# Windows (PowerShell as Administrator)
winget install jdx.mise
# Or download from https://mise.jdx.dev/
Step 3: Run Bootstrap
./tools/bootstrap
powershell -ExecutionPolicy Bypass -File .\tools\bootstrap.ps1
Step 4: Verify Setup
java -version # Should show Java 25 rustc –version # Should show rustc 1.92.0 bun –version # Should show 1.3.0
docker ps # Should show sangita_postgres container running
cargo run --manifest-path tools/sangita-cli/Cargo.toml -- db health
Start Development Stack:
mise exec – cargo run –manifest-path tools/sangita-cli/Cargo.toml – dev –start-db
cargo run –manifest-path tools/sangita-cli/Cargo.toml – dev –start-db
docker compose up -d postgres
./gradlew :modules:backend:api:run
cd modules/frontend/sangita-admin-web && bun run dev
Reset Database:
mise exec – cargo run –manifest-path tools/sangita-cli/Cargo.toml – db reset –mode docker
cargo run --manifest-path tools/sangita-cli/Cargo.toml -- db reset --mode docker
Update Toolchain:
mise install # Installs updated versions
Issue: “mise not found”
Issue: “Docker not running”
Issue: “Port 5432 already in use”
compose.yamlIssue: “Config file not created”
tools/bootstrap-assets/env/development.env.example to config/development.envIssue: “Rust build fails”
mise exec cargo run -- ...rustup install 1.92.0)Issue: “Tool version mismatch”
mise exec cargo run -- ...| Platform | OS Version | Status | Notes |
|---|---|---|---|
| macOS | 14+ (Sonoma) | ✅ Tested | Works with mise and Docker Desktop |
| Linux | Ubuntu 22.04+ | ✅ Tested | Works with mise and Docker Engine |
| Windows | Windows 11 | ✅ Tested | Works with mise and Docker Desktop |
After running bootstrap, verify:
java -version)rustc --version)bun --version)docker ps)config/development.env exists and has correct valuescargo run -- db health)ls modules/frontend/sangita-admin-web/node_modules)Implementation Date: 2026-01-14
Components Delivered:
.mise.toml with toolchain version pinningtools/bootstrap (Unix/Linux/macOS)tools/bootstrap.ps1 (Windows)tools/bootstrap-assets/env/development.env.example (config template)Testing Status: ✅ Tested on macOS, Linux, and Windows
Maintainer: Development Team
Last Updated: 2026-01-14
Document Version: 1.0
Next Review: 2026-04-14 (quarterly review)