File size: 2,581 Bytes
c536472
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Local Setup

## 1. Supabase

Create a Supabase project, then run `backend/supabase/migrations/001_initial_schema.sql` in the SQL editor or through the Supabase CLI.

Required Supabase features:

- Auth enabled.
- Realtime enabled for `messages`, `conversations`, and `matches` when you want live updates.
- `vector` extension enabled by the migration.
- Service role key available only to the backend.

## 2. Stripe

Create either:

- A one-time Price and set `STRIPE_PRICE_ID`.
- Or leave `STRIPE_PRICE_ID` empty and let the backend create dynamic Checkout line items using `ENTRY_FEE_CENTS`.

Create a webhook endpoint:

```text
POST https://your-backend-domain.com/api/payments/webhook
```

Subscribe it to:

```text
checkout.session.completed
```

Set `STRIPE_WEBHOOK_SECRET` from the webhook signing secret.

## 3. AI

OpenClaw defaults to a local Phi model served through an OpenAI-compatible endpoint.
Recommended local target:

```text
microsoft/Phi-4-mini-instruct
```

For llama.cpp GGUF inference, start a local server on port `8081`:

```powershell
llama-server `
  -hf ysn-rfd/Phi-4-mini-instruct-GGUF:Q4_0 `
  --alias microsoft/Phi-4-mini-instruct `
  --jinja `
  --host 127.0.0.1 `
  --port 8081 `
  -c 32768
```

Then configure the backend:

```text
AI_PROVIDER=local
AI_MODEL=microsoft/Phi-4-mini-instruct
LOCAL_AI_BASE_URL=http://127.0.0.1:8081/v1
LOCAL_AI_API_KEY=
```

The local provider also works with vLLM or SGLang if they expose `/v1/chat/completions`.

Cloud fallbacks are still supported:

Set one provider:

```text
AI_PROVIDER=anthropic
AI_MODEL=claude-sonnet-4-20250514
ANTHROPIC_API_KEY=...
```

or:

```text
AI_PROVIDER=grok
AI_MODEL=grok-3-latest
GROK_API_KEY=...
GROK_BASE_URL=https://api.x.ai/v1
```

Embeddings use an OpenAI-compatible embeddings endpoint:

```text
EMBEDDING_BASE_URL=https://api.openai.com/v1
EMBEDDING_API_KEY=...
EMBEDDING_MODEL=text-embedding-3-small
EMBEDDING_DIMENSIONS=1536
```

The database migration uses `vector(1536)`, so update the migration if you use a different embedding dimension.

## 4. Backend

```powershell
cd backend
Copy-Item .env.example .env
npm install
npm run typecheck
npm run build
npm run dev
```

Health check:

```powershell
Invoke-RestMethod http://localhost:8080/health
```

## 5. Flutter

Install Flutter, then from `frontend/`:

```powershell
flutter create --platforms=web,android,ios .
flutter pub get
flutter run `
  --dart-define=SUPABASE_URL=https://your-project.supabase.co `
  --dart-define=SUPABASE_ANON_KEY=your-anon-key `
  --dart-define=BACKEND_URL=http://localhost:8080/api
```