# Backend Service (Supabase Integration)

#### Overview

EitherWay integrates Supabase for instant backend provisioning. One click gives your application:

* Managed PostgreSQL database
* Authentication (email, OAuth, magic links)
* Storage buckets for files
* Real-time subscriptions
* Auto-generated REST and GraphQL APIs
* Row-level security

***

#### **Enabling Backend Service**

1. Click “Enable Backend” in the chat interface
2. Eitherway provisions a Supabase project
3. Credentials are securely stored and injected
4. Database schema is auto-generated from your requirements

***

#### **API Endpoints**

| Endpoint                                  | Purpose                   |
| ----------------------------------------- | ------------------------- |
| `GET /api/backend-service/status`         | Check provisioning status |
| `POST /api/backend-service/enable`        | Enable for an app         |
| `POST /api/backend-service/provision`     | Provision resources       |
| `POST /api/backend-service/schema/apply`  | Apply database schema     |
| `GET /api/backend-service/schemas/:appId` | Get current schema        |

***

#### **Database Tools**

The AI agent can:

* Create tables and relationships
* Set up row-level security policies
* Generate TypeScript types
* Create API endpoints automatically
* Set up real-time subscriptions

***

#### Storage Buckets

```
POST /api/backend-service/storage/bucket
{
"appId": "your-app-id",
"name": "user-uploads", "public": false
}
```


---

# Agent Instructions: 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:

```
GET https://docs.eitherway.ai/documentation/engineering/backend-service-supabase-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
