> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scriptonia.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Backend Dev

> BackendDev produces backend specs, API contracts, DB schema, auth, and services.

## Purpose and Responsibilities

* Generate **backend** specs (e.g. `node_express.md`, `services.md`, `auth.md`), **API** specs (`openapi.md`), and **db** specs (`schema.md`, `migrations.md`, `orm_models.md`, `local_storage.md`, `firebase_schema.md`, `supabase.md` when enabled).
* Align with **FrontendDev** (API contracts) and **ProductManager** (requirements).
* Coordinate with **AIEngineer** and **ToolManager** where relevant.

***

## Input/Output

### Input (from `generateFileContentWithAgent`)

* `file`, `requirements`, `config`, `filePath`, `workflowContext`, `existingDeliverables` — Same pattern as Product Manager.

### Output

* **Markdown** (or other `file.type`) string: OpenAPI fragments, schema descriptions, migration notes, auth flows, service architecture.

***

## Prompt Engineering

* **Agent system:**\
  `"You are a Backend Developer agent. You create APIs, database schemas, and server logic. Coordinate with FrontendDev for API contracts and ProductManager for requirements."`
* **Supabase:** For `supabase.md` when `workflowContext.supabaseIntegration` is true, a dedicated long Supabase prompt is used (setup, DB, Auth, Realtime, Storage, client/server examples, deployment). Model: `callOpenRouter(..., 'GROK', { temperature: 0.7 })`.
* **Default:** Same `generateFileContentWithAgent` template and `callOpenRouter(..., 'GROK', { temperature: 0.8 })`.

***

## File Assignment

`getAgentForFile` assigns to **BackendDev** when the path contains:

* `backend`, `api`, or `database`

For `db/` and `backend/apis/`, the path usually matches `backend` or `api`. `supabase.md` is explicitly assigned via `getAgentForFile('db/supabase.md', config)` → BackendDev.

***

## Examples

* **backend/node\_express.md**, **backend/services.md**, **backend/auth.md**
* **backend/apis/openapi.md**
* **db/schema.md**, **db/migrations.md**, **db/orm\_models.md**
* **db/supabase.md** (when Supabase integration is on)
* **db/local\_storage.md** (iOS), **db/firebase\_schema.md** (Android)
* **backend/api\_contracts.md**, **backend/push\_notifications.md**, **backend/node\_firebase.md** (Android/iOS)

***

## Customization Options

* **Agent system:** Edit the BackendDev entry in `agentSystemPrompts` in `lib/platform-templates.ts`.
* **Assignment:** Map new paths (e.g. `queue/`, `workers/`) to BackendDev in `getAgentForFile`.
* **Supabase prompt:** Change the Supabase block in `generateFileContentWithAgent` to add/remove sections or examples.

***
