From b10b111343461a68f3aa6c2f965f0cfc5f7297c7 Mon Sep 17 00:00:00 2001 From: haidrrrry Date: Sun, 24 May 2026 00:14:50 +0500 Subject: [PATCH 1/2] docs: clarify DATABASE_URL vs DB_PATH in .env.example Explain PostgreSQL vs SQLite precedence so local SQLite defaults do not look conflicting with PostgreSQL deployment examples. Fixes #206. Co-authored-by: Cursor --- .env.example | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.env.example b/.env.example index 0fbfefa8..9f19824f 100644 --- a/.env.example +++ b/.env.example @@ -2,13 +2,21 @@ ENVIRONMENT=development # ==================== Database ==================== -# PostgreSQL takes precedence when DATABASE_URL is set. -# Leave empty for local SQLite development. +# Choose ONE backend: +# +# 1) PostgreSQL (recommended for shared/production deployments) +# Set DATABASE_URL and leave DB_PATH unused. +# Example: +# DATABASE_URL=postgresql://ai_trader:change-me@127.0.0.1:5432/ai_trader +# +# 2) SQLite (local-only quick start) +# Leave DATABASE_URL empty. The API uses DB_PATH below. +# +# Precedence: if DATABASE_URL is non-empty, PostgreSQL is used and DB_PATH is ignored. +# Unit tests may set ALLOW_SQLITE=true when exercising SQLite helpers. DATABASE_URL= -# Example PostgreSQL URL: -# DATABASE_URL=postgresql://ai_trader:change-me@127.0.0.1:5432/ai_trader -# SQLite fallback path when DATABASE_URL is empty. +# SQLite file path — only used when DATABASE_URL is empty. DB_PATH=service/server/data/clawtrader.db # ==================== API Keys ==================== From c1774563ddc831a2853e1ee257b2b2992a2a4ca9 Mon Sep 17 00:00:00 2001 From: haidrrrry Date: Sun, 24 May 2026 00:19:25 +0500 Subject: [PATCH 2/2] docs: add README database configuration note (#206) Mirror .env.example guidance so self-hosters see PostgreSQL vs SQLite precedence without opening env files first. Co-authored-by: Cursor --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index eafca586..2ad9444c 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,19 @@ Start your trading journey with zero risk: --- +## Self-hosting (database) + +Copy `.env.example` to `.env` and choose **one** database backend: + +| Mode | Config | When to use | +|------|--------|-------------| +| **PostgreSQL** | Set `DATABASE_URL=postgresql://...` | Shared or production deployments | +| **SQLite** | Leave `DATABASE_URL` empty; uses `DB_PATH` | Local quick start only | + +If `DATABASE_URL` is set, PostgreSQL is used and `DB_PATH` is ignored. + +--- + ## Architecture ```