Skip to main content

Git workflow

DualMind Lab uses a simple branch-based workflow across all three repositories.

Branch strategy

BranchPurpose
mainProduction-ready code, deployed automatically
feature/*New features (branch from main)
fix/*Bug fixes
devIntegration branch (optional)

Commit conventions

Use descriptive commit messages:
feat: add streaming support for dual chat
fix: resolve FK violation on thread creation
refactor: extract model selection into service
docs: update API reference for voting endpoint

Testing

Backend tests

Located at tests/DualMind.API.Tests/:
cd DualMind_Back
dotnet test
Test files:
  • SmokeTests.cs — basic endpoint connectivity
  • UnitTest1.cs — unit tests

Frontend linting

cd DualMind_UI
npm run lint        # Check for issues
npm run lint:fix    # Auto-fix

Manual API testing

Use the Swagger UI at /swagger or curl:
# Health check (no auth)
curl http://localhost:5079/health

# Single chat (requires JWT)
curl -X POST http://localhost:5079/api/arena/chat \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Hello, world!"}'

# Dual chat
curl -X POST http://localhost:5079/api/arena/dualchat \
  -H "Authorization: Bearer YOUR_JWT" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Explain AI", "selectionMode": "random"}'

Deployment process

Backend (Azure)

The backend deploys to Azure App Service via GitHub Actions:
# Triggers on push to main
# Builds .NET 8 app
# Deploys to Azure App Service

Frontend (Cloudflare Workers)

cd DualMind_UI
npx wrangler deploy

Admin panel (Cloudflare Workers)

cd DualMind_Admin-UI
npm run deploy       # staging
npm run deploy:prod  # production

Adding a new API endpoint

  1. Create or update a controller in Controllers/
  2. Add route attribute: [Route("api/your-route")]
  3. Add HTTP method attribute: [HttpGet], [HttpPost], etc.
  4. Add [Authorize] if auth required, [AllowAnonymous] if public
  5. Inject required services via constructor
  6. Add request/response models in Core/Models/ if needed
  7. Register any new services in Program.cs
  8. Test via Swagger or curl
  9. Update OpenAPI spec in docs/openapi.yaml

Adding a new AI provider

  1. Create a new service class implementing IChatProvider in AI/Providers/
  2. Implement ChatAsync() and StreamAsync() methods
  3. Register the typed HttpClient in Program.cs
  4. Add the provider case in ChatProviderFactory.GetProvider()
  5. Add provider record to providers table in Supabase
  6. Add API keys to provider_api_keys table
  7. Add models using this provider to ai_models table