# New Development Workflows - Unified Template Architecture ## ๐ŸŽฏ Overview This document outlines the new development workflows enabled by the unified template architecture. The new system transforms how you develop, customize, and maintain Rustelo projects through: - **Layered override system** for safe customization - **Feature-aware tooling** that adapts to your project - **Framework integrity protection** for safe updates - **Unified CLI** for all project operations ## ๐Ÿš€ Core Workflows ### 1. Project Creation Workflow #### New Project from Scratch ```bash # Create new project with features cargo rustelo new my-saas \ --template webapp \ --features analytics,smart-build,debugging-tools \ --database postgres \ --styling tailwind # What happens automatically: # โœ… Project structure created with layered config # โœ… Features integrated with proper templates # โœ… Tooling configured (justfile, CSS, package.json) # โœ… Integrity protection enabled # โœ… CI/CD templates added ``` #### Start Development Immediately ```bash cd my-saas # One-command development setup just setup # Start full development environment just dev-full # Features automatically active: # - Analytics dashboard on http://localhost:3001 # - Smart build caching enabled # - Debugging tools with browser log capture # - Hot reload for all file types ``` ### 2. Feature Management Workflow #### Adding Features During Development ```bash # Add new feature to existing project cargo rustelo add auth # Interactive feature configuration โœ… Auth feature will be added to my-saas ๐Ÿ“‹ Select authentication methods: [x] JWT tokens [x] OAuth2 (Google, GitHub) [ ] 2FA/TOTP [ ] Magic links ๐Ÿ“‹ Database integration: [x] User model and migrations [x] Session management [x] Role-based access control ๐Ÿ”ง Installing auth feature... โœ… Added dependencies to Cargo.toml โœ… Created config/features/auth/ โœ… Updated justfile with auth commands โœ… Added auth components to src/components/features/auth/ โœ… Created database migrations โœ… Updated UnoCSS with auth styles ๐Ÿš€ Feature ready! Try: just auth-setup ``` #### Feature-Specific Development ```bash # Work on specific feature just auth-dev # Start auth development server just auth-test # Run auth-specific tests just auth-migrate # Run auth database migrations just auth-demo # Start feature demo/playground # Analytics for feature development just analytics-report # View auth feature metrics ``` ### 3. Customization Workflow #### Safe Template Customization ```bash # See what can be customized cargo rustelo list-overrides # Override a template safely cargo rustelo override template justfile # Template copied to config/local/justfile # Edit with your customizations - they'll take precedence # Framework updates won't overwrite your changes # Example local justfile addition: echo ' # Custom deployment command for my-saas deploy-staging: @echo "๐Ÿš€ Deploying to staging..." docker build -t my-saas:staging . kubectl apply -f k8s/staging/ ' >> config/local/justfile ``` #### Component Override System ```bash # Override framework component cargo rustelo override component NavBar # Creates src/components/local/NavBar.rs with current implementation # Customize without breaking updates: // src/components/local/NavBar.rs #[component] pub fn NavBar() -> impl IntoView { view! { } } ``` #### Configuration Layer System ```bash # Local configuration (highest precedence) echo 'brand_color = "#ff6b6b"' >> config/local/app.toml # Feature configuration echo '[dashboard] refresh_interval = 30' >> config/features/analytics/config.toml # Resolution order: Local > Feature > Template > Framework cargo rustelo trace config brand_color # Output: config/local/app.toml (value: "#ff6b6b") ``` ### 4. Quality Assurance Workflow #### Continuous Quality Checks ```bash # One command for comprehensive quality validation just quality # Runs in parallel: # โœ… Code formatting (rustfmt) # โœ… Linting (clippy with strict settings) # โœ… Tests (unit + integration) # โœ… Framework integrity validation # โœ… Security audit # โœ… Performance benchmarks (if enabled) # โœ… Documentation generation ``` #### Pre-commit Workflow (Automatic) ```bash # Commit triggers automatic validation git add . git commit -m "Add user authentication" # Pre-commit hook runs: # ๐Ÿ” Framework integrity check # ๐Ÿงช Quick test suite # ๐Ÿ“ Format check # ๐Ÿ”’ Security scan # Commit blocked if issues found: โŒ Framework integrity validation failed! ๐Ÿ’ก Run 'cargo rustelo integrity repair' to fix common issues ๐Ÿ’ก Run 'cargo rustelo integrity validate --detailed' for more info ``` ### 5. Team Collaboration Workflow #### Shared Team Configuration ```bash # Team lead sets up shared configuration cargo rustelo init --team-mode # Creates .rustelo/team-config.toml: [team] name = "my-saas-team" shared_features = ["analytics", "auth", "smart-build"] code_style = "strict" quality_gates = "required" [shared_overrides] justfile = "config/shared/justfile" theme = "config/shared/theme.toml" # Team members sync automatically cargo rustelo sync --team ``` #### Developer Onboarding ```bash # New team member setup (one command) git clone https://github.com/company/my-saas cd my-saas cargo rustelo setup --team # Automatically: # โœ… Installs correct Rust toolchain # โœ… Downloads team configuration # โœ… Sets up development environment # โœ… Runs initial build and tests # โœ… Validates integrity # โœ… Creates local config template # Ready to develop in ~2 minutes just dev ``` ### 6. Framework Update Workflow #### Safe Update Process ```bash # Check update safety first cargo rustelo integrity validate --target-version 0.3.0 # If safe (no violations): cargo rustelo update --version 0.3.0 --auto-migrate # If violations found: โŒ 3 integrity violations prevent safe update: - Hardcoded routes in src/routing.rs:45 - Direct core import in src/lib.rs:12 - Unsafe block in src/auth.rs:67 ๐Ÿ’ก Run auto-repair for common issues: cargo rustelo integrity repair --auto ๐Ÿ’ก For manual fixes, see detailed report: cargo rustelo integrity validate --detailed ``` #### Update with Migration ```bash # Major update requiring migration cargo rustelo update --version 1.0.0 --migrate # Interactive migration process: ๐Ÿ”„ Migrating to Rustelo v1.0.0... ๐Ÿ“‹ Detected changes requiring attention: - Auth trait signature updated (manual fix needed) - New configuration format for routing - Deprecated API: get_route() โ†’ resolve_route() ๐Ÿ› ๏ธ Automatic migrations: โœ… Updated Cargo.toml dependencies โœ… Migrated configuration files โœ… Updated deprecated API calls โš ๏ธ Manual actions required: 1. Update auth trait implementation in src/auth.rs - See migration guide: guides/v0.3-to-v1.0.md 2. Review new routing configuration format - Run: cargo rustelo template show routes.toml Continue with migration? [y/N]: y ``` ### 7. Debugging and Troubleshooting Workflow #### Comprehensive Debugging ```bash # Start debugging session for specific page just debug-full /dashboard # Launches parallel debugging: # ๐Ÿ–ฅ๏ธ Development server with debug logging # ๐ŸŒ Browser console capture for /dashboard # ๐Ÿ“Š Performance monitoring # ๐Ÿ” Network request analysis # ๐Ÿ“ Combined debug report generation # After 30 seconds, generates: # reports/debug-session-20231201-143022.html ``` #### Issue Diagnosis ```bash # Something broken? Run diagnosis cargo rustelo diagnose # Comprehensive system check: โœ… Framework integrity: PASSED โœ… Configuration validity: PASSED โŒ Database connection: FAILED - PostgreSQL not running on localhost:5432 - Fix: just db-start โœ… Asset compilation: PASSED โš ๏ธ Cache performance: DEGRADED - L1 cache hit rate: 45% (target: >80%) - Fix: just cache-optimize # Suggested actions prioritized by impact ``` ### 8. Performance Optimization Workflow #### Smart Build System ```bash # Enable smart caching (if not already enabled) cargo rustelo add smart-build # Immediate benefits: just build-smart # Intelligent incremental builds just cache-stats # Monitor cache performance just cache-optimize # Tune cache parameters # Performance benchmarking just benchmark-builds # Compare build times just benchmark-runtime # Application performance metrics # Results: Build Performance Improvements: - Clean build: 3m 45s โ†’ 1m 12s (68% faster) - Incremental: 45s โ†’ 8s (82% faster) - Cache hit rate: 89% ``` #### Runtime Performance ```bash # Add performance monitoring cargo rustelo add metrics # Monitor application performance just metrics-dashboard # Real-time performance dashboard just metrics-report # Generate performance report # Optimization workflow: 1. just dev # Start with monitoring 2. # Use application normally 3. just metrics-report # Identify bottlenecks 4. # Optimize hot paths 5. just benchmark-compare # Validate improvements ``` ### 9. Deployment Workflow #### Production Deployment ```bash # Pre-deployment validation just deploy-check # Comprehensive pre-deployment validation: โœ… Framework integrity validated โœ… All tests passing (unit + integration + e2e) โœ… Security audit clean โœ… Performance benchmarks acceptable โœ… Database migrations ready โœ… Assets optimized โœ… Configuration valid for production # Deploy to staging first just deploy-staging # Staging validation just validate-staging # Production deployment (if staging passes) just deploy-prod ``` #### Zero-Downtime Deployment ```bash # Blue-green deployment (if configured) just deploy-blue-green # Rolling deployment just deploy-rolling # Canary deployment just deploy-canary --percentage 10 # Automatic rollback on issues # (Configured through deployment templates) ``` ### 10. Monitoring and Maintenance Workflow #### Health Monitoring ```bash # Application health dashboard just monitoring-dashboard # Automated health checks just health-check-full # System status: ๐ŸŸข Application: Healthy (99.9% uptime) ๐ŸŸข Database: Healthy (avg response: 12ms) ๐ŸŸก Cache: Warning (hit rate: 75%) ๐ŸŸข External APIs: Healthy ๐Ÿ” Integrity: Validated (last check: 5m ago) ``` #### Maintenance Tasks ```bash # Weekly maintenance routine just maintenance-weekly # Runs automatically: # ๐Ÿงน Cache cleanup and optimization # ๐Ÿ“Š Performance report generation # ๐Ÿ”„ Dependency security updates # ๐Ÿ“‹ Health summary report # ๐Ÿ” Framework integrity check # ๐Ÿ’พ Automated backups ``` ## ๐ŸŽฏ Workflow Benefits ### For Individual Developers | Traditional Approach | New Unified Workflows | |---------------------|---------------------| | Manual template management | Automated with CLI | | Risky customizations | Safe layered overrides | | Complex feature integration | One-command feature addition | | Update anxiety | Integrity-protected updates | | Inconsistent tooling | Feature-aware automation | ### For Teams | Challenge | Solution | |-----------|----------| | Environment inconsistency | Standardized team configuration | | Onboarding complexity | One-command setup | | Knowledge silos | Shared templates and workflows | | Integration conflicts | Layered override system | | Update coordination | Validated update process | ### For Organizations | Need | Fulfillment | |------|-------------| | Quality assurance | Automated validation pipelines | | Security compliance | Built-in security scanning | | Performance standards | Integrated benchmarking | | Maintenance efficiency | Automated maintenance workflows | | Knowledge management | Documented, templated processes | ## ๐Ÿ“š Learning Resources ### Getting Started (Day 1) 1. **Quick Start**: Follow migration guide for existing project 2. **New Project**: Create new project with `cargo rustelo new` 3. **Basic Commands**: Learn `just --list` and `cargo rustelo --help` 4. **First Override**: Try `cargo rustelo override template justfile` ### Intermediate (Week 1) 1. **Feature Management**: Add your first feature with `cargo rustelo add` 2. **Layer Understanding**: Use `cargo rustelo trace` to understand resolution 3. **Quality Workflows**: Run `just quality` and understand each check 4. **Integrity System**: Learn `cargo rustelo integrity validate` ### Advanced (Month 1) 1. **Custom Features**: Create organization-specific features 2. **Team Configuration**: Set up shared team workflows 3. **Performance Optimization**: Master smart-build and caching 4. **Deployment Automation**: Configure production deployment workflows ### Expert (Month 3+) 1. **Framework Contribution**: Contribute templates and features back 2. **Architecture Design**: Design systems using layered principles 3. **Training Others**: Help teammates and community members 4. **Innovation**: Pioneer new workflow patterns --- **Next Steps**: Choose the workflow most relevant to your current needs and try it out. The system is designed to be discoverable - use `--help` on any command to learn more!