> 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/backend-api-overview.md).

# Backend API Overview

### Overview

The Grouple backend API is a Node.js/TypeScript server running in Docker containers on AWS ECS, behind an Application Load Balancer.

### &#x20;Infrastructure

```
Route 53 (api.grouple.pro)
        ↓
Application Load Balancer (grouple-api-lb)
  ├── HTTP → redirects to HTTPS
  └── HTTPS → SSL terminated via ACM Certificate
        ↓
ECS Cluster (grouple-api-cluster)
  └── Auto Scaling Group (EC2 instances)
      └── ECS Tasks (API Containers)
          └── Docker image pulled from ECR (grouple-api)
```

### [​](https://grouple.mintlify.app/backend/overview#server-entry-point)Server Entry Point <a href="#server-entry-point" id="server-entry-point"></a>

**`server/index.ts`** — main Express server **`server/node-build.ts`** — build script **`server/routes/demo.ts`** — route definitions

### [​](https://grouple.mintlify.app/backend/overview#authentication)Authentication <a href="#authentication" id="authentication"></a>

All API requests require a valid Supabase JWT passed as:

```
Authorization: Bearer <supabase_jwt>
```

The API validates JWT against Supabase Auth before processing requests.

### [​](https://grouple.mintlify.app/backend/overview#environment-&-secrets)Environment & Secrets <a href="#environment-and-secrets" id="environment-and-secrets"></a>

* Environment variables injected at runtime by **AWS Secrets Manager**
* Supabase URL and service role key
* Amazon Bedrock credentials
* Other third-party service keys

### [​](https://grouple.mintlify.app/backend/overview#deployment)Deployment <a href="#deployment" id="deployment"></a>

```
GitHub push to main
        ↓
GitHub Actions (github-actions-user IAM)
        ↓
Build Docker image → push to ECR (grouple-api)
        ↓
ECS rolling deployment → new task definitions
        ↓
ALB routes traffic to new containers
```

### [​](https://grouple.mintlify.app/backend/overview#observability)Observability <a href="#observability" id="observability"></a>

<table><thead><tr><th width="231.90802001953125">Tool</th><th>Purpose</th></tr></thead><tbody><tr><td>CloudWatch Logs</td><td>ECS task logs (<code>/ecs/grouple-api-task</code>)</td></tr><tr><td>AWS X-Ray</td><td>Distributed tracing</td></tr><tr><td>ECS Console</td><td>Container health, task status</td></tr></tbody></table>


---

# 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/backend-api-overview.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.
