Development Workflow
This guide explains the development workflow for contributing to Plus261. Follow these steps to ensure quality code and smooth collaboration.
What You’ll Learn
Section intitulée « What You’ll Learn »By the end of this guide, you’ll understand:
- ✅ The complete development workflow
- ✅ How to create feature branches
- ✅ How to write and test code
- ✅ How to commit and submit changes
- ✅ Best practices for code quality
- ✅ Common development tasks
Overview
Section intitulée « Overview »The development workflow follows these steps:
- Setup - Configure your environment
- Planning - Understand requirements
- Development - Write code following conventions
- Testing - Write and run tests
- Review - Submit for code review
- Deploy - Merge and deploy
Development Workflow
Section intitulée « Development Workflow »Step 1: Setup Your Environment
Section intitulée « Step 1: Setup Your Environment »See Quick Start for initial setup.
Quick Checklist:
-
bun installat repo root -
bun --bun run k8s:upsucceeded (default:K8S_PROFILE=core) -
/etc/hostsincludes at leastapi.plus261.local(more hosts forcore/full) -
kubectl -n plus261-app get podsshows Ready (postgres,redis,api,worker) -
https://api.plus261.local/live and https://api.plus261.local/ready return 200
-
✅ Repository cloned
-
✅ Dependencies installed (
bun install) -
✅ Cluster running (
bun --bun run k8s:up/kubectl -n plus261-app get pods) -
✅
/etc/hostsconfigured for enabled*.localhosts -
✅ Migrations applied when needed — see Migrations Drizzle
Step 2: Create a Feature Branch
Section intitulée « Step 2: Create a Feature Branch »# Update main branchgit checkout maingit pull origin main
# Create feature branchgit checkout -b feat/your-feature-name
# Or for bug fixesgit checkout -b fix/your-bug-descriptionBranch prefixes mirror Conventional Commits types (feat/, fix/, docs/, …).
Step 3: Develop Your Feature
Section intitulée « Step 3: Develop Your Feature »Understand the Requirements
Section intitulée « Understand the Requirements »Before coding:
- ✅ Read the issue or specification carefully
- ✅ Understand the business logic
- ✅ Check existing similar features for patterns
- ✅ Ask questions if unclear
Write Code
Section intitulée « Write Code »Follow these principles:
- Start Small - Make incremental changes
- Follow Conventions - See Code Style
- Use Existing Patterns - Look at similar modules
- Write Tests - See Testing Guide
Example: Adding a New Module
Section intitulée « Example: Adding a New Module »# 1. Create module structuremkdir -p apps/api/src/new-module/dto
# 2. Create DTOs (see Code Structure guide)# 3. Create module configuration# 4. Register in create-schema.ts# 5. Write testsDetailed Guide: Code Structure - Creating a New Module
Web frontend with SSO
Section intitulée « Web frontend with SSO »bun --bun run k8s:upbun --bun run k8s:hotreload -- web soacaille # http://127.0.0.1:3003Guide : Getting started.
Step 4: Test Your Changes
Section intitulée « Step 4: Test Your Changes »# Run testsbun test
# Code quality (monorepo root)bun --bun run check:code
# Svelte type-check (web, auth)cd apps/web && bun --bun run checkStep 5: Commit Your Changes
Section intitulée « Step 5: Commit Your Changes »Commit messages must follow Conventional Commits. Lefthook runs format + lint:fix before each commit and commitlint validates the message.
Full reference: Code Style — Commit messages (types, feat! breaking changes, hooks).
Step 6: Push and Create Merge Request
Section intitulée « Step 6: Push and Create Merge Request »# Push your branchgit push origin feat/your-feature-nameThen create a Merge Request on GitLab with:
- ✅ Clear title and description (Conventional Commits style recommended)
- ✅ Link to related issue
- ✅ Screenshots (if UI changes)
- ✅ Test results
- ✅ Checklist of changes
Step 7: Code Review
Section intitulée « Step 7: Code Review »During code review:
- ✅ Address review comments promptly
- ✅ Make requested changes
- ✅ Keep discussions constructive
- ✅ Ask questions if unclear
Development Tools
Section intitulée « Development Tools »VS Code Extensions (Recommended)
Section intitulée « VS Code Extensions (Recommended) »| Extension | Purpose |
|---|---|
| oxlint (CLI) | Lint JS/TS (bun --bun run lint) |
| oxfmt (CLI) | Format (bun --bun run format) |
| TypeScript | Type checking |
| GraphQL | GraphQL syntax highlighting |
| Svelte | Svelte support |
Useful Commands
Section intitulée « Useful Commands »# Developmentbun dev # Start development serverbun --bun run build # Build for productionbun --bun run check:code # lint:fix + format + lint (root)cd apps/web && bun --bun run check # Svelte/TS check
# Databasebunx drizzle-kit generate # Generate migrations (from apps/api/)bunx drizzle-kit migrate # Run migrations — see /infrastructure/local-dev#migrations-drizzle-apibunx drizzle-kit studio # Open Drizzle Studio
# Testingbun test # Run testsbun test:watch # Watch modeBest Practices
Section intitulée « Best Practices »Code Quality
Section intitulée « Code Quality »-
Write Clean Code
- Follow Code Style
- Keep functions small and focused
- Use meaningful names
- Add comments for complex logic
-
Handle Errors Properly
- Use specific error types
- Log errors appropriately
- Provide helpful error messages
- Don’t swallow errors silently
-
Document Complex Logic
- Add JSDoc comments
- Explain “why”, not “what”
- Update documentation when code changes
-
Write Tests
- Unit tests for business logic
- Integration tests for API endpoints
- Test edge cases
- Test error scenarios
-
Test Coverage
- Aim for good coverage
- Focus on critical paths
- Don’t test implementation details
Learn more: Testing Guide
Performance
Section intitulée « Performance »-
Optimize Queries
- Use DataLoaders for N+1 problems
- Add database indexes
- Use pagination
- Cache frequently accessed data
-
Monitor Performance
- Check query performance
- Use observability tools
- Profile slow operations
Learn more: Performance Guide
Common Development Tasks
Section intitulée « Common Development Tasks »Adding a New GraphQL Type
Section intitulée « Adding a New GraphQL Type »- Create DTO in
dto/type-name.type.ts - Add decorators (
@ObjectType,@EnhancedField) - Create module configuration
- Register in
create-schema.ts
Guide: Code Structure - Creating a New Module
Adding a New Query
Section intitulée « Adding a New Query »- Use Type GraphQL Query auto-generated queries (recommended)
- Or create custom resolver if needed
- Add authorization if required
- Write tests
Guide: Type GraphQL Query - Queries
Adding a New Mutation
Section intitulée « Adding a New Mutation »- Create input type in
dto/type-name.input.ts - Configure in module
- Add authorization
- Test the mutation
Guide: Type GraphQL Query - Mutations
Modifying Database Schema
Section intitulée « Modifying Database Schema »- Update schema in
libs/db/src/schema/ - Generate migration:
bunx drizzle-kit generate - Review migration file
- Run migration:
bunx drizzle-kit migrate
Data Loss
Always review migration files before running them. Some migrations may cause data loss.
Troubleshooting
Section intitulée « Troubleshooting »Type Errors
Section intitulée « Type Errors »# Clear caches and re-checkrm -rf node_modules/.cachebun --bun run check:codecd apps/web && bun --bun run checkBuild Errors
Section intitulée « Build Errors »# Clean and rebuildbun --bun run cleanbun installbun --bun run buildDatabase Issues
Section intitulée « Database Issues »# Reset database (⚠️ deletes all data)kubectl -n plus261-app delete pvc --allbun --bun run k8s:deploy -- k3dbunx drizzle-kit migratePort Already in Use
Section intitulée « Port Already in Use »# Find process using portlsof -i :4000
# Kill processkill -9 <PID>Quick Reference
Section intitulée « Quick Reference »| Task | Documentation |
|---|---|
| Create a module | Code Structure |
| Add a query | Type GraphQL Query - Queries |
| Add a mutation | Type GraphQL Query - Mutations |
| Write tests | Testing Guide |
| Debug issues | Debugging Guide |
Next Steps
Section intitulée « Next Steps »Continue your learning:
- 📚 Code Structure - Understand code organization
- 🧪 Testing - Testing guidelines
- 🐛 Debugging - Debugging techniques
- 🤝 Contributing Guidelines - Contribution process
Related Topics
Section intitulée « Related Topics »- Quick Start - Fast setup guide
- Code Structure - Codebase organization
- Code Style - Coding conventions
- Testing Guide - How to write tests