CODEX_ADK/BACKEND
Svrnty a7cbcc331b docs: Add v1.1.0 performance update to changelog
Document performance optimizations for frontend team:
- Database indexes added
- SendMessage context optimization
- Package compatibility fix
- No breaking changes to API contract

Frontend migration time: ~15 minutes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 23:34:55 -04:00
..
.claude/skills/backend-devops-expert Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
.claude-docs Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
.config Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
Codex.Api Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
Codex.CQRS perf: Add database indexes and optimize queries for MVP 2025-10-26 23:30:53 -04:00
Codex.Dal perf: Add database indexes and optimize queries for MVP 2025-10-26 23:30:53 -04:00
docs docs: Add v1.1.0 performance update to changelog 2025-10-26 23:34:55 -04:00
scripts Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
.gitignore Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
CLAUDE.md Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
code-review-local.sh Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
code-review-standalone.sh Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
code-review.sh Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
Codex.sln Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
DEPLOYMENT_STATUS.md Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
docker-compose.yml Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
export-openapi.sh Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
MVP-COMPLETION-SUMMARY.md Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
README.md Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00
test-endpoints.sh Initial commit: CODEX_ADK monorepo 2025-10-26 23:12:32 -04:00

Codex Backend API

CQRS-based ASP.NET Core 8.0 Web API using OpenHarbor.CQRS framework with PostgreSQL.

Quick Start

# Build the solution
dotnet build

# Run the API
dotnet run --project Codex.Api/Codex.Api.csproj

# API will be available at:
# - HTTP: http://localhost:5246
# - Swagger UI: http://localhost:5246/swagger (Development only)

Documentation

For Backend Developers

For Frontend Developers (Flutter)

For Claude Code

Project Structure

Codex/
├── Codex.Api/          # API layer, controllers (auto-generated), Program.cs
├── Codex.CQRS/         # Commands and Queries (business logic)
├── Codex.Dal/          # Data Access Layer, DbContext, entities
├── docs/               # API documentation and OpenAPI spec
└── .claude-docs/       # Development guidelines and Claude context

Technology Stack

  • .NET 8.0 LTS - Framework
  • ASP.NET Core 8.0 - Web API
  • OpenHarbor.CQRS 8.1.0 - CQRS framework (auto-generates REST endpoints)
  • PostgreSQL - Database
  • Entity Framework Core 8.0 - ORM
  • FluentValidation - Input validation
  • Swagger/OpenAPI - API documentation

CQRS Pattern

This API uses Command Query Responsibility Segregation (CQRS). Endpoints are auto-generated from C# classes:

  • Commands (Write): POST /api/command/{CommandName}
  • Queries (Read): POST /api/query/{QueryName} or GET /api/query/{QueryName}
  • Dynamic Queries (Paginated): POST /api/dynamicquery/{ItemType}

Example:

// Define a query
public record HealthQuery { }

// Automatically creates endpoint: POST /api/query/health

API Documentation Workflow

When Adding/Modifying APIs:

  1. Add XML documentation to Commands/Queries:
/// <summary>Creates a new user account</summary>
/// <param name="username">Unique username</param>
/// <response code="200">User created successfully</response>
/// <response code="400">Validation failed</response>
public record CreateUserCommand
{
    public string Username { get; init; } = string.Empty;
    public string Email { get; init; } = string.Empty;
}
  1. Build and export OpenAPI spec:
dotnet build
./export-openapi.sh
  1. Update CHANGELOG.md if breaking changes

  2. Commit and notify frontend team:

git add .
git commit -m "Add CreateUser command with documentation"
git push

Database Migrations

# Add a new migration
dotnet ef migrations add <MigrationName> --project Codex.Dal

# Update database
dotnet ef database update --project Codex.Dal

Testing

# Run tests (when test projects are added)
dotnet test

Environment Configuration

API configuration is managed through appsettings.json and appsettings.Development.json:

  • CORS: Configure allowed origins in Cors:AllowedOrigins
  • Database: Connection string in ConnectionStrings:DefaultConnection
  • Logging: Console logging enabled in Development

Key Features

  • Auto-generated REST endpoints from CQRS classes
  • Type-safe API contracts via OpenAPI
  • Automatic input validation with FluentValidation
  • XML documentation integrated with Swagger
  • PostgreSQL with EF Core migrations
  • CORS configuration via appsettings
  • Bearer token authentication support (documented, not yet implemented)

Contributing

  1. Follow patterns in CLAUDE.md
  2. Add XML documentation to all Commands/Queries
  3. Use .AsNoTracking() for all read queries
  4. Regenerate OpenAPI spec after changes
  5. Update CHANGELOG.md for breaking changes

Support


Version: 1.0 API Version: v1 OpenAPI: 3.0.1 Last Updated: 2025-01-26