# Codeflash Internal Documentation

CodeFlash's AI-powered code optimization backend. The aiservice (Django-Ninja) receives optimization requests from cf-api, dispatches to language-specific handlers, calls LLMs, postprocesses results, and returns optimized candidates.

## Service Flow

```
VSC-Extension / CLI → cf-api (Express, :3001) → aiservice (Django-Ninja, :8000)
cf-webapp (:3000) reads from the same PostgreSQL DB via Prisma
```

## Documentation Pages

- [Domain Types](domain-types.md) — Core schemas and domain models
- [Optimization Pipeline](optimization-pipeline.md) — End-to-end optimization flow
- [Test Generation Pipeline](test-generation-pipeline.md) — Test generation flow
- [Context Extraction](context-extraction.md) — How code context is extracted for LLM prompts
- [AIService Endpoints](aiservice-endpoints.md) — All Django-Ninja endpoints
- [CF-API Endpoints](cf-api-endpoints.md) — All Express routes
- [Configuration & Thresholds](configuration-thresholds.md) — Model distribution, costs, constants
- [LLM Provider Abstraction](llm-provider-abstraction.md) — llm.py usage, client creation, cost tracking
