> For the complete documentation index, see [llms.txt](https://grouple.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://grouple.gitbook.io/docs/backend-api/api-routes.md).

# API Routes

### Overview

The backend API (`server/index.ts`) serves routes defined in `server/routes/`. It acts as a middleware layer between the frontend and external services (Bedrock, Textract), and handles operations that require server-side credentials or processing that shouldn’t happen client-side.

### [​](https://grouple.mintlify.app/backend/routes#route-files)Route Files <a href="#route-files" id="route-files"></a>

[**​**](https://grouple.mintlify.app/backend/routes#server/routes/demo-ts)**`server/routes/demo.ts`**

Current route definitions. The API is intentionally lean — most data operations go directly through the Supabase client on the frontend (with RLS enforcing security).

### [​](https://grouple.mintlify.app/backend/routes#when-does-the-api-get-called)When Does the API Get Called? <a href="#when-does-the-api-get-called" id="when-does-the-api-get-called"></a>

The frontend uses the ECS API for operations that require:

1. **Server-side credentials** (Bedrock API keys, service role keys)
2. **Heavy processing** (triggering AI workers, PDF processing)
3. **Webhook handling**

For all standard CRUD (read venues, submit enquiries, manage proposals), the frontend calls **Supabase directly** using the JS client with JWT auth — the ECS API is bypassed entirely.

### [​](https://grouple.mintlify.app/backend/routes#request-flow)Request Flow <a href="#request-flow" id="request-flow"></a>

```
Frontend makes API request
        ↓
Authorization: Bearer <supabase_jwt>
        ↓
api.grouple.pro → ALB → ECS API Container
        ↓
Server validates JWT with Supabase
        ↓
Processes request (calls Bedrock / triggers worker / etc.)
        ↓
Returns response to frontend
```
