lovegpt / docs /setup.md
Crownelius's picture
Upload OpenDateBase Gradio Space
c536472 verified
|
Raw
History Blame Contribute Delete
2.58 kB
# 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
```