Skip to content

Commit debb16a

Browse files
committed
docs: add SUPABASE_SERVICE_KEY to API deployment instructions
1 parent 853e46f commit debb16a

File tree

6 files changed

+57
-8
lines changed

6 files changed

+57
-8
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to BluePLM will be documented in this file.
44

5+
## [2.16.1] - 2025-12-30
6+
7+
### Fixed
8+
- **User invite**: Added REST API deployment step to main README and API docs (SUPABASE_SERVICE_KEY required for invite emails)
9+
10+
---
11+
512
## [2.16.0] - 2025-12-29
613

714
### Added

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,35 @@ This creates the standard release workflow: **WIP → In Review → Released →
327327
</details>
328328

329329
<details>
330-
<summary><strong>9. Customize Email Templates (Optional)</strong></summary>
330+
<summary><strong>9. Deploy REST API (Required for User Invites)</strong></summary>
331+
332+
The REST API is needed for sending invite emails and ERP integrations.
333+
334+
**One-Click Deploy to Railway:**
335+
1. Go to [railway.app/new](https://railway.app/new)
336+
2. Select **"Deploy from Docker Image"**
337+
3. Enter: `ghcr.io/bluerobotics/blueplm-api:latest`
338+
4. Add these environment variables (from Supabase Dashboard → Settings → API):
339+
| Variable | Value |
340+
|----------|-------|
341+
| `SUPABASE_URL` | Your Project URL |
342+
| `SUPABASE_KEY` | anon/public key |
343+
| `SUPABASE_SERVICE_KEY` | service_role key ⚠️ |
344+
5. Deploy and copy your API URL (e.g., `https://your-app.railway.app`)
345+
346+
**Configure in BluePLM:**
347+
1. Go to **Settings → Organization → REST API**
348+
2. Enable **"Use External API"**
349+
3. Enter your Railway API URL
350+
4. Click **Test Connection** to verify
351+
352+
> ⚠️ **Keep `SUPABASE_SERVICE_KEY` secret!** It bypasses Row Level Security. Only use in server-side code.
353+
354+
See [API README](api/README.md) for alternative deployment options (Render, Fly.io, Docker).
355+
</details>
356+
357+
<details>
358+
<summary><strong>10. Customize Email Templates (Optional)</strong></summary>
331359

332360
BluePLM includes branded email templates in [`supabase/email-templates/`](supabase/email-templates/).
333361

api/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Integration API for external systems (ERP, CI/CD, automation) built with [Fastif
1616
┌─────────────────────────────────────────────────────────────┐
1717
│ Step 1: Deploy API (5 min) │
1818
│ Click "Deploy to Railway" button below │
19-
│ Set your Supabase URL and Key
19+
│ Set: SUPABASE_URL, SUPABASE_KEY, SUPABASE_SERVICE_KEY
2020
├─────────────────────────────────────────────────────────────┤
2121
│ Step 2: Get API URL │
2222
│ Railway gives you: https://your-app.railway.app │
@@ -94,6 +94,7 @@ The server will start on `http://127.0.0.1:3001` by default.
9494
|----------|---------|-------------|
9595
| `SUPABASE_URL` | - | Supabase project URL (required) |
9696
| `SUPABASE_KEY` | - | Supabase anon key (required) |
97+
| `SUPABASE_SERVICE_KEY` | - | Service role key (required for user invites) |
9798
| `API_PORT` | `3001` | Port to listen on |
9899
| `API_HOST` | `0.0.0.0` | Host to bind to |
99100
| `RATE_LIMIT_MAX` | `100` | Max requests per window |
@@ -114,20 +115,20 @@ The easiest way - no repo access needed:
114115
1. Go to [railway.app/new](https://railway.app/new)
115116
2. Select **"Deploy from Docker Image"**
116117
3. Enter: `ghcr.io/bluerobotics/blueplm-api:latest`
117-
4. Add variables: `SUPABASE_URL`, `SUPABASE_KEY`
118+
4. Add variables: `SUPABASE_URL`, `SUPABASE_KEY`, `SUPABASE_SERVICE_KEY`
118119
5. Deploy!
119120

120121
**Render:**
121122
1. Go to [render.com](https://render.com) → New → Web Service
122123
2. Select **"Deploy an existing image from a registry"**
123124
3. Enter: `ghcr.io/bluerobotics/blueplm-api:latest`
124-
4. Add environment variables
125+
4. Add environment variables: `SUPABASE_URL`, `SUPABASE_KEY`, `SUPABASE_SERVICE_KEY`
125126
5. Deploy!
126127

127128
**Fly.io:**
128129
```bash
129130
fly launch --image ghcr.io/bluerobotics/blueplm-api:latest
130-
fly secrets set SUPABASE_URL=https://xxx.supabase.co SUPABASE_KEY=your-key
131+
fly secrets set SUPABASE_URL=https://xxx.supabase.co SUPABASE_KEY=your-anon-key SUPABASE_SERVICE_KEY=your-service-key
131132
fly deploy
132133
```
133134

@@ -136,6 +137,7 @@ fly deploy
136137
docker run -d -p 3001:3001 \
137138
-e SUPABASE_URL=https://xxx.supabase.co \
138139
-e SUPABASE_KEY=your-anon-key \
140+
-e SUPABASE_SERVICE_KEY=your-service-key \
139141
ghcr.io/bluerobotics/blueplm-api:latest
140142
```
141143

@@ -152,6 +154,7 @@ railway init
152154
# Set environment variables (get these from your Supabase project settings)
153155
railway variables set SUPABASE_URL=https://xxx.supabase.co
154156
railway variables set SUPABASE_KEY=your-anon-key
157+
railway variables set SUPABASE_SERVICE_KEY=your-service-key
155158
railway variables set CORS_ORIGINS=https://your-erp.com,https://odoo.yourcompany.com
156159

157160
# Deploy
@@ -168,6 +171,9 @@ Your API will be live at `https://your-app.railway.app`
168171
4. Copy:
169172
- **Project URL**`SUPABASE_URL`
170173
- **anon public** key → `SUPABASE_KEY`
174+
- **service_role** key → `SUPABASE_SERVICE_KEY` (required for user invites)
175+
176+
> ⚠️ **Keep your service_role key secret!** It bypasses Row Level Security. Never expose it in client-side code.
171177
172178
### Render
173179

@@ -188,6 +194,7 @@ docker build -f api/Dockerfile -t blueplm-api .
188194
docker run -p 3001:3001 \
189195
-e SUPABASE_URL=https://xxx.supabase.co \
190196
-e SUPABASE_KEY=your-anon-key \
197+
-e SUPABASE_SERVICE_KEY=your-service-key \
191198
blueplm-api
192199
```
193200

@@ -203,6 +210,7 @@ fly launch
203210
# Set secrets
204211
fly secrets set SUPABASE_URL=https://xxx.supabase.co
205212
fly secrets set SUPABASE_KEY=your-anon-key
213+
fly secrets set SUPABASE_SERVICE_KEY=your-service-key
206214

207215
# Deploy
208216
fly deploy
@@ -1251,6 +1259,10 @@ For JSON output (production), remove the `pino-pretty` transport in `server.js`.
12511259
**"Supabase not configured" error**
12521260
- Set the `SUPABASE_URL` and `SUPABASE_KEY` environment variables
12531261

1262+
**"Service key not configured" error**
1263+
- Set the `SUPABASE_SERVICE_KEY` environment variable (required for `/auth/invite` endpoint)
1264+
- Get the service_role key from Supabase Dashboard → Settings → API
1265+
12541266
**"Invalid token" error**
12551267
- Token may have expired - use `/auth/refresh` to get a new one
12561268
- Ensure you're using the full token (access tokens are long JWT strings)

api/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env npx ts-node
22
/**
33
* BluePLM REST API Server (Fastify + TypeScript)
4-
* Build: 2025-12-14T06:26-v2.1.3-pino
4+
* Build: 2025-12-30T00:00-v2.1.4
55
*
66
* Integration API for external systems (ERP, CI/CD, Slack, etc.)
77
*

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "blue-plm",
3-
"version": "2.16.0",
3+
"version": "2.16.1",
44
"description": "Product Lifecycle Management for everyone who builds",
55
"main": "dist-electron/main.js",
66
"scripts": {

render.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ services:
1212
- key: SUPABASE_URL
1313
sync: false # User must set this
1414
- key: SUPABASE_KEY
15-
sync: false # User must set this
15+
sync: false # User must set this (anon key)
16+
- key: SUPABASE_SERVICE_KEY
17+
sync: false # User must set this (service role key - required for invites)
1618
- key: CORS_ORIGINS
1719
value: "*"
1820
- key: RATE_LIMIT_MAX

0 commit comments

Comments
 (0)