> 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
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://grouple.gitbook.io/docs/backend-api/api-routes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
