zerodb-local 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. zerodb_local-0.2.0/.gitignore +79 -0
  2. zerodb_local-0.2.0/LICENSE +21 -0
  3. zerodb_local-0.2.0/PKG-INFO +562 -0
  4. zerodb_local-0.2.0/README.md +517 -0
  5. zerodb_local-0.2.0/api/Dockerfile +63 -0
  6. zerodb_local-0.2.0/api/STORY_442_SUMMARY.md +241 -0
  7. zerodb_local-0.2.0/api/STORY_442_TEST_EXECUTION_REPORT.md +602 -0
  8. zerodb_local-0.2.0/api/TEST_INFRASTRUCTURE_STATUS.md +266 -0
  9. zerodb_local-0.2.0/api/auth.py +156 -0
  10. zerodb_local-0.2.0/api/database.py +43 -0
  11. zerodb_local-0.2.0/api/db/__init__.py +1 -0
  12. zerodb_local-0.2.0/api/db/init.sh +39 -0
  13. zerodb_local-0.2.0/api/db/migrations/001_initial_schema.sql +362 -0
  14. zerodb_local-0.2.0/api/db/migrations/002_sync_state.sql +52 -0
  15. zerodb_local-0.2.0/api/db/migrations/003_change_detection.sql +105 -0
  16. zerodb_local-0.2.0/api/db/migrations/004_conflict_log.sql +53 -0
  17. zerodb_local-0.2.0/api/db/migrations/004_sync_history.sql +122 -0
  18. zerodb_local-0.2.0/api/db/schema.sql +331 -0
  19. zerodb_local-0.2.0/api/db/session.py +7 -0
  20. zerodb_local-0.2.0/api/errors.py +241 -0
  21. zerodb_local-0.2.0/api/health.py +317 -0
  22. zerodb_local-0.2.0/api/main.py +246 -0
  23. zerodb_local-0.2.0/api/middleware/__init__.py +10 -0
  24. zerodb_local-0.2.0/api/middleware/error_handler.py +295 -0
  25. zerodb_local-0.2.0/api/migrations/add_schema_comparison_and_sync_plan_tables.sql +108 -0
  26. zerodb_local-0.2.0/api/models/change_log.py +61 -0
  27. zerodb_local-0.2.0/api/models/conflict_log.py +68 -0
  28. zerodb_local-0.2.0/api/models/schema_comparison.py +79 -0
  29. zerodb_local-0.2.0/api/models/sync_history.py +142 -0
  30. zerodb_local-0.2.0/api/models/sync_plan.py +128 -0
  31. zerodb_local-0.2.0/api/models/sync_state.py +90 -0
  32. zerodb_local-0.2.0/api/pytest.ini +53 -0
  33. zerodb_local-0.2.0/api/requirements.txt +50 -0
  34. zerodb_local-0.2.0/api/routers/__init__.py +27 -0
  35. zerodb_local-0.2.0/api/routers/change_detection.py +240 -0
  36. zerodb_local-0.2.0/api/routers/cloud_sync.py +444 -0
  37. zerodb_local-0.2.0/api/routers/conflict_resolution.py +269 -0
  38. zerodb_local-0.2.0/api/routers/events.py +287 -0
  39. zerodb_local-0.2.0/api/routers/export.py +200 -0
  40. zerodb_local-0.2.0/api/routers/files.py +377 -0
  41. zerodb_local-0.2.0/api/routers/logs.py +272 -0
  42. zerodb_local-0.2.0/api/routers/memory.py +321 -0
  43. zerodb_local-0.2.0/api/routers/projects.py +330 -0
  44. zerodb_local-0.2.0/api/routers/pull_sync.py +252 -0
  45. zerodb_local-0.2.0/api/routers/schema_diff.py +424 -0
  46. zerodb_local-0.2.0/api/routers/sync_history.py +212 -0
  47. zerodb_local-0.2.0/api/routers/sync_orchestrator.py +415 -0
  48. zerodb_local-0.2.0/api/routers/sync_state.py +230 -0
  49. zerodb_local-0.2.0/api/routers/tables.py +458 -0
  50. zerodb_local-0.2.0/api/routers/vectors.py +390 -0
  51. zerodb_local-0.2.0/api/run_schema_diff_tests.py +156 -0
  52. zerodb_local-0.2.0/api/run_tests.py +37 -0
  53. zerodb_local-0.2.0/api/schemas/__init__.py +12 -0
  54. zerodb_local-0.2.0/api/schemas/change_log.py +99 -0
  55. zerodb_local-0.2.0/api/schemas/cloud_sync.py +373 -0
  56. zerodb_local-0.2.0/api/schemas/conflict_resolution.py +244 -0
  57. zerodb_local-0.2.0/api/schemas/export.py +233 -0
  58. zerodb_local-0.2.0/api/schemas/project.py +86 -0
  59. zerodb_local-0.2.0/api/schemas/pull_sync.py +298 -0
  60. zerodb_local-0.2.0/api/schemas/schema_diff.py +385 -0
  61. zerodb_local-0.2.0/api/schemas/sync.py +174 -0
  62. zerodb_local-0.2.0/api/schemas/sync_history.py +165 -0
  63. zerodb_local-0.2.0/api/schemas/sync_orchestrator.py +394 -0
  64. zerodb_local-0.2.0/api/schemas/sync_state.py +159 -0
  65. zerodb_local-0.2.0/api/services/__init__.py +82 -0
  66. zerodb_local-0.2.0/api/services/cdc_service.py +419 -0
  67. zerodb_local-0.2.0/api/services/cloud_client.py +460 -0
  68. zerodb_local-0.2.0/api/services/conflict_resolver.py +432 -0
  69. zerodb_local-0.2.0/api/services/database_service.py +93 -0
  70. zerodb_local-0.2.0/api/services/embeddings_service.py +81 -0
  71. zerodb_local-0.2.0/api/services/events_service.py +347 -0
  72. zerodb_local-0.2.0/api/services/export_service.py +703 -0
  73. zerodb_local-0.2.0/api/services/files_service.py +382 -0
  74. zerodb_local-0.2.0/api/services/import_service.py +589 -0
  75. zerodb_local-0.2.0/api/services/memory_service.py +410 -0
  76. zerodb_local-0.2.0/api/services/minio_service.py +369 -0
  77. zerodb_local-0.2.0/api/services/pull_sync_service.py +639 -0
  78. zerodb_local-0.2.0/api/services/qdrant_service.py +386 -0
  79. zerodb_local-0.2.0/api/services/redpanda_service.py +385 -0
  80. zerodb_local-0.2.0/api/services/schema_comparison_service.py +235 -0
  81. zerodb_local-0.2.0/api/services/schema_diff_service.py +828 -0
  82. zerodb_local-0.2.0/api/services/schema_migrator.py +338 -0
  83. zerodb_local-0.2.0/api/services/sync_history_service.py +482 -0
  84. zerodb_local-0.2.0/api/services/sync_orchestrator.py +917 -0
  85. zerodb_local-0.2.0/api/services/sync_plan_service.py +379 -0
  86. zerodb_local-0.2.0/api/services/sync_state_service.py +254 -0
  87. zerodb_local-0.2.0/api/services/tables_service.py +486 -0
  88. zerodb_local-0.2.0/api/services/vector_service.py +426 -0
  89. zerodb_local-0.2.0/api/test_cloud_client_standalone.py +520 -0
  90. zerodb_local-0.2.0/api/test_conflict_resolver_standalone.py +254 -0
  91. zerodb_local-0.2.0/api/test_export_standalone.py +305 -0
  92. zerodb_local-0.2.0/api/test_schema_diff_standalone.py +362 -0
  93. zerodb_local-0.2.0/api/tests/README.md +252 -0
  94. zerodb_local-0.2.0/api/tests/__init__.py +4 -0
  95. zerodb_local-0.2.0/api/tests/conftest.py +290 -0
  96. zerodb_local-0.2.0/api/tests/services/test_redpanda_health.py +60 -0
  97. zerodb_local-0.2.0/api/tests/test_authentication.py +376 -0
  98. zerodb_local-0.2.0/api/tests/test_docker_build.py +500 -0
  99. zerodb_local-0.2.0/api/tests/test_docker_build_conftest.py +19 -0
  100. zerodb_local-0.2.0/api/tests/test_events.py +329 -0
  101. zerodb_local-0.2.0/api/tests/test_files.py +262 -0
  102. zerodb_local-0.2.0/api/tests/test_issue_1249_implementation.py +356 -0
  103. zerodb_local-0.2.0/api/tests/test_logs.py +271 -0
  104. zerodb_local-0.2.0/api/tests/test_memory.py +239 -0
  105. zerodb_local-0.2.0/api/tests/test_projects.py +230 -0
  106. zerodb_local-0.2.0/api/tests/test_qdrant_startup.py +69 -0
  107. zerodb_local-0.2.0/api/tests/test_schema_diff_caching.py +472 -0
  108. zerodb_local-0.2.0/api/tests/test_sync_plan_persistence.py +518 -0
  109. zerodb_local-0.2.0/api/tests/test_tables.py +377 -0
  110. zerodb_local-0.2.0/api/tests/test_vectors.py +299 -0
  111. zerodb_local-0.2.0/api/utils/__init__.py +10 -0
  112. zerodb_local-0.2.0/api/utils/retry.py +133 -0
  113. zerodb_local-0.2.0/api/verify_export_implementation.py +237 -0
  114. zerodb_local-0.2.0/cli/.gitignore +73 -0
  115. zerodb_local-0.2.0/cli/CHANGELOG.md +67 -0
  116. zerodb_local-0.2.0/cli/INIT_WIZARD_IMPLEMENTATION.md +358 -0
  117. zerodb_local-0.2.0/cli/INTEGRATION_VERIFICATION.md +170 -0
  118. zerodb_local-0.2.0/cli/LICENSE +21 -0
  119. zerodb_local-0.2.0/cli/README.md +171 -0
  120. zerodb_local-0.2.0/cli/README_GITHUB.md +900 -0
  121. zerodb_local-0.2.0/cli/SYNC_EXECUTOR_INTEGRATION_SUMMARY.md +298 -0
  122. zerodb_local-0.2.0/cli/USER_INSTALLATION_ISSUES_FOUND.md +281 -0
  123. zerodb_local-0.2.0/cli/__init__.py +2 -0
  124. zerodb_local-0.2.0/cli/commands/__init__.py +1 -0
  125. zerodb_local-0.2.0/cli/commands/cloud.py +164 -0
  126. zerodb_local-0.2.0/cli/commands/env.py +96 -0
  127. zerodb_local-0.2.0/cli/commands/inspect.py +589 -0
  128. zerodb_local-0.2.0/cli/commands/local.py +325 -0
  129. zerodb_local-0.2.0/cli/commands/schema.py +357 -0
  130. zerodb_local-0.2.0/cli/commands/serve.py +170 -0
  131. zerodb_local-0.2.0/cli/commands/sync.py +598 -0
  132. zerodb_local-0.2.0/cli/commands/sync_apply_enhanced.py +294 -0
  133. zerodb_local-0.2.0/cli/commands/sync_enhanced.py +264 -0
  134. zerodb_local-0.2.0/cli/config.py +104 -0
  135. zerodb_local-0.2.0/cli/conflict_resolver.py +329 -0
  136. zerodb_local-0.2.0/cli/main.py +41 -0
  137. zerodb_local-0.2.0/cli/pytest.ini +54 -0
  138. zerodb_local-0.2.0/cli/requirements.txt +6 -0
  139. zerodb_local-0.2.0/cli/setup.py +49 -0
  140. zerodb_local-0.2.0/cli/sync_executor.py +424 -0
  141. zerodb_local-0.2.0/cli/sync_planner.py +296 -0
  142. zerodb_local-0.2.0/cli/test_inspect_commands.py +442 -0
  143. zerodb_local-0.2.0/cli/test_status_polling.py +109 -0
  144. zerodb_local-0.2.0/cli/test_sync_commands.py +165 -0
  145. zerodb_local-0.2.0/cli/test_sync_executor_integration.py +84 -0
  146. zerodb_local-0.2.0/cli/test_sync_planner_integration.py +70 -0
  147. zerodb_local-0.2.0/cli/validate_structure.py +116 -0
  148. zerodb_local-0.2.0/cli/zerodb/__init__.py +4 -0
  149. zerodb_local-0.2.0/cli/zerodb/commands/__init__.py +3 -0
  150. zerodb_local-0.2.0/cli/zerodb/commands/dashboard.py +117 -0
  151. zerodb_local-0.2.0/cli/zerodb/commands/init.py +410 -0
  152. zerodb_local-0.2.0/cli/zerodb/commands/logs.py +82 -0
  153. zerodb_local-0.2.0/cli/zerodb/commands/status.py +308 -0
  154. zerodb_local-0.2.0/cli/zerodb/utils/__init__.py +3 -0
  155. zerodb_local-0.2.0/cli/zerodb/utils/branding.py +94 -0
  156. zerodb_local-0.2.0/cli/zerodb/utils/prerequisites.py +219 -0
  157. zerodb_local-0.2.0/cli/zerodb_main.py +71 -0
  158. zerodb_local-0.2.0/lite/__init__.py +6 -0
  159. zerodb_local-0.2.0/lite/config.py +75 -0
  160. zerodb_local-0.2.0/lite/db/__init__.py +3 -0
  161. zerodb_local-0.2.0/lite/db/schema_lite.sql +226 -0
  162. zerodb_local-0.2.0/lite/services/__init__.py +0 -0
  163. zerodb_local-0.2.0/lite/services/cdc_service.py +239 -0
  164. zerodb_local-0.2.0/lite/services/database_service_lite.py +718 -0
  165. zerodb_local-0.2.0/lite/services/embeddings_service_local.py +105 -0
  166. zerodb_local-0.2.0/lite/services/faiss_service.py +420 -0
  167. zerodb_local-0.2.0/lite/services/filesystem_service.py +421 -0
  168. zerodb_local-0.2.0/lite/services/sqlite_events_service.py +303 -0
  169. zerodb_local-0.2.0/lite/services/vector_service_lite.py +141 -0
  170. zerodb_local-0.2.0/pyproject.toml +102 -0
  171. zerodb_local-0.2.0/zerodb_local/__init__.py +10 -0
  172. zerodb_local-0.2.0/zerodb_local/cli.py +81 -0
  173. zerodb_local-0.2.0/zerodb_local/server.py +56 -0
@@ -0,0 +1,79 @@
1
+ # Environment variables
2
+ .env.local
3
+ .env.staging
4
+ .env.production
5
+ .env
6
+
7
+ # Data directories (persistent volumes)
8
+ data/
9
+ backups/
10
+
11
+ # Logs
12
+ *.log
13
+ logs/
14
+ !dashboard/app/logs/
15
+ !dashboard/tests/app/logs/
16
+
17
+ # Python
18
+ __pycache__/
19
+ *.py[cod]
20
+ *$py.class
21
+ *.so
22
+ .Python
23
+ build/
24
+ develop-eggs/
25
+ dist/
26
+ downloads/
27
+ eggs/
28
+ .eggs/
29
+ lib/
30
+ !dashboard/lib/
31
+ !dashboard/tests/lib/
32
+ lib64/
33
+ parts/
34
+ sdist/
35
+ var/
36
+ wheels/
37
+ *.egg-info/
38
+ .installed.cfg
39
+ *.egg
40
+
41
+ # Virtual environments
42
+ venv/
43
+ ENV/
44
+ env/
45
+ .venv
46
+
47
+ # Node.js
48
+ node_modules/
49
+ npm-debug.log*
50
+ yarn-debug.log*
51
+ yarn-error.log*
52
+ .pnpm-debug.log*
53
+
54
+ # Build artifacts
55
+ dist/
56
+ .next/
57
+ out/
58
+
59
+ # IDE
60
+ .vscode/
61
+ .idea/
62
+ *.swp
63
+ *.swo
64
+ *~
65
+
66
+ # OS
67
+ .DS_Store
68
+ Thumbs.db
69
+
70
+ # Testing
71
+ .coverage
72
+ htmlcov/
73
+ .pytest_cache/
74
+ .tox/
75
+
76
+ # Temporary files
77
+ *.tmp
78
+ *.temp
79
+ .cache/
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AINative Studio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,562 @@
1
+ Metadata-Version: 2.4
2
+ Name: zerodb-local
3
+ Version: 0.2.0
4
+ Summary: ZeroDB Local — run ZeroDB locally without Docker
5
+ Project-URL: Homepage, https://zerodb.ai
6
+ Project-URL: Documentation, https://docs.zerodb.ai
7
+ Project-URL: Repository, https://github.com/AINative-Studio/core
8
+ Project-URL: Issues, https://github.com/AINative-Studio/core/issues
9
+ Author: AINative Studio
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: ai,database,embeddings,local,vector,zerodb
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Database
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: fastapi>=0.100.0
25
+ Requires-Dist: httpx>=0.24.0
26
+ Requires-Dist: pydantic>=2.0.0
27
+ Requires-Dist: python-multipart>=0.0.6
28
+ Requires-Dist: sqlalchemy>=2.0.0
29
+ Requires-Dist: typer[all]>=0.9.0
30
+ Requires-Dist: uvicorn[standard]>=0.20.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
34
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
35
+ Provides-Extra: full
36
+ Requires-Dist: asyncpg>=0.29.0; extra == 'full'
37
+ Requires-Dist: kafka-python>=2.0.0; extra == 'full'
38
+ Requires-Dist: minio>=7.0.0; extra == 'full'
39
+ Requires-Dist: psycopg2-binary>=2.9.0; extra == 'full'
40
+ Requires-Dist: qdrant-client>=1.7.0; extra == 'full'
41
+ Provides-Extra: lite
42
+ Requires-Dist: faiss-cpu>=1.7.0; extra == 'lite'
43
+ Requires-Dist: sentence-transformers>=2.2.0; extra == 'lite'
44
+ Description-Content-Type: text/markdown
45
+
46
+ # ZeroDB Local
47
+
48
+ Run ZeroDB on your local machine. Two modes available:
49
+ - **Lite mode** (recommended) — pip install, no Docker required
50
+ - **Full mode** — Docker Compose with PostgreSQL, Qdrant, MinIO, RedPanda
51
+
52
+ ## Quick Start — Lite Mode (No Docker)
53
+
54
+ ```bash
55
+ pip install zerodb-local[lite]
56
+ zerodb serve
57
+ ```
58
+
59
+ That's it. Server starts at `http://localhost:8000` with:
60
+ - SQLite database
61
+ - FAISS vector search
62
+ - In-process embeddings (BAAI/bge-small-en-v1.5, 384 dims)
63
+ - Local filesystem storage
64
+ - SQLite event queue
65
+
66
+ ### Verify it works
67
+
68
+ ```bash
69
+ # Health check
70
+ curl http://localhost:8000/health
71
+
72
+ # Create a project
73
+ curl -X POST http://localhost:8000/v1/projects \
74
+ -H "Content-Type: application/json" \
75
+ -d '{"name": "my-project", "description": "Testing ZeroDB Local"}'
76
+ ```
77
+
78
+ ### CLI Options
79
+
80
+ ```bash
81
+ zerodb serve # Start on port 8000
82
+ zerodb serve --port 9000 # Custom port
83
+ zerodb serve --data-dir /my/data # Custom data directory
84
+ zerodb serve --cloud-key sk_... # Enable cloud sync
85
+ ```
86
+
87
+ Data is stored at `~/.zerodb/data/` by default.
88
+
89
+ ## Features
90
+
91
+ - **Two backends**: Lite (SQLite + FAISS) or Full (PostgreSQL + Qdrant + Docker)
92
+ - **Local API Server**: Mirrors all 128 ZeroDB Cloud endpoints
93
+ - **Web Dashboard**: Manage projects, vectors, tables, files, and events via UI
94
+ - **CLI Tool**: `zerodb` command for local control and cloud sync
95
+ - **Offline-First**: Work without internet, sync when ready
96
+ - **No API Costs**: Local embeddings using BAAI BGE models (free)
97
+ - **Cloud Sync**: Bidirectional sync with ZeroDB Cloud
98
+ - **Production-Ready**: Same code paths as cloud for consistency
99
+
100
+ ---
101
+
102
+ ## Full Mode (Docker)
103
+
104
+ For production-like environments with PostgreSQL, Qdrant, MinIO, and RedPanda.
105
+
106
+ ### Prerequisites
107
+
108
+ - **Docker** 20.10+ and **Docker Compose** 2.0+
109
+ - **Python** 3.11+ (for CLI tool)
110
+ - At least 4GB RAM available for Docker
111
+
112
+ ### Installation
113
+
114
+ 1. **Clone the repository**:
115
+ ```bash
116
+ cd zerodb-local
117
+ ```
118
+
119
+ 2. **Copy environment template**:
120
+ ```bash
121
+ cp .env.local.example .env.local
122
+ ```
123
+
124
+ 3. **Edit `.env.local`** (optional):
125
+ - Update `POSTGRES_PASSWORD` for production use
126
+ - Set `CLOUD_API_KEY` if you want cloud sync
127
+ - Adjust `EMBEDDINGS_MODEL` based on your needs
128
+
129
+ 4. **Start all services**:
130
+ ```bash
131
+ docker-compose up -d
132
+ ```
133
+
134
+ 5. **Verify services are running**:
135
+ ```bash
136
+ docker-compose ps
137
+ ```
138
+
139
+ You should see 7 services running:
140
+ - `zerodb-postgres` (PostgreSQL + pgvector)
141
+ - `zerodb-qdrant` (Vector search)
142
+ - `zerodb-minio` (Object storage)
143
+ - `zerodb-redpanda` (Event streaming)
144
+ - `zerodb-embeddings` (Local embeddings)
145
+ - `zerodb-api` (API server)
146
+ - `zerodb-dashboard` (Web UI)
147
+
148
+ 6. **Access the dashboard**:
149
+ - Open http://localhost:3000 in your browser
150
+
151
+ 7. **Check API health**:
152
+ ```bash
153
+ curl http://localhost:8000/health
154
+ ```
155
+
156
+ ## Architecture
157
+
158
+ ```
159
+ ┌─────────────────────────────────────────────────────────────┐
160
+ │ ZeroDB Local Stack │
161
+ ├─────────────────────────────────────────────────────────────┤
162
+ │ │
163
+ │ ┌─────────────┐ ┌──────────────┐ │
164
+ │ │ Dashboard │◄────────┤ API Server │ │
165
+ │ │ (React UI) │ REST │ (FastAPI) │ │
166
+ │ └─────────────┘ └───────┬──────┘ │
167
+ │ localhost:3000 │ │
168
+ │ │ │
169
+ │ ┌───────────────────────┼───────────────────┐ │
170
+ │ │ │ │ │
171
+ │ ▼ ▼ ▼ │
172
+ │ ┌──────────────┐ ┌─────────────┐ ┌─────────────┐ │
173
+ │ │ PostgreSQL │ │ Qdrant │ │ MinIO │ │
174
+ │ │ + pgvector │ │ (Vectors) │ │ (Files) │ │
175
+ │ └──────────────┘ └─────────────┘ └─────────────┘ │
176
+ │ localhost:5432 localhost:6333 localhost:9000 │
177
+ │ │
178
+ │ ┌───────────────────────┬──────────────────┐ │
179
+ │ │ │ │ │
180
+ │ ▼ ▼ ▼ │
181
+ │ ┌──────────────┐ ┌─────────────┐ ┌─────────────┐ │
182
+ │ │ RedPanda │ │ Embeddings │ │ CLI │ │
183
+ │ │ (Events) │ │ (BAAI) │ │ (Typer) │ │
184
+ │ └──────────────┘ └─────────────┘ └─────────────┘ │
185
+ │ localhost:9092 localhost:8001 zerodb command │
186
+ │ │
187
+ └─────────────────────────────────────────────────────────────┘
188
+
189
+ │ Sync (optional)
190
+
191
+ ┌─────────────────────┐
192
+ │ ZeroDB Cloud API │
193
+ │ api.ainative.studio │
194
+ └─────────────────────┘
195
+ ```
196
+
197
+ ## Services
198
+
199
+ ### PostgreSQL + pgvector (Port 5432)
200
+ - **Purpose**: Relational data storage with vector support
201
+ - **Storage**: `./data/postgres`
202
+ - **Console**: Access via `psql` or any PostgreSQL client
203
+ - **Usage**: Tables, metadata, change logs
204
+
205
+ ### Qdrant (Port 6333)
206
+ - **Purpose**: High-performance vector similarity search
207
+ - **Storage**: `./data/qdrant`
208
+ - **Web UI**: http://localhost:6333/dashboard
209
+ - **Usage**: Fast semantic search for vectors and memory
210
+
211
+ ### MinIO (Port 9000/9001)
212
+ - **Purpose**: S3-compatible object storage
213
+ - **Storage**: `./data/minio`
214
+ - **Console**: http://localhost:9001 (minioadmin/minioadmin)
215
+ - **Usage**: File uploads, large blobs
216
+
217
+ ### RedPanda (Port 9092)
218
+ - **Purpose**: Kafka-compatible event streaming
219
+ - **Storage**: `./data/redpanda`
220
+ - **Console**: http://localhost:9644
221
+ - **Usage**: Event sourcing, CDC, real-time notifications
222
+
223
+ ### Embeddings Service (Port 8001)
224
+ - **Purpose**: Local text embedding generation
225
+ - **Model**: BAAI/bge-small-en-v1.5 (384 dimensions)
226
+ - **Storage**: `./data/embeddings/models`
227
+ - **Usage**: Generate embeddings without API costs
228
+
229
+ ### API Server (Port 8000)
230
+ - **Purpose**: FastAPI server mirroring ZeroDB Cloud
231
+ - **Endpoints**: 128 endpoints matching cloud API
232
+ - **Docs**: http://localhost:8000/docs
233
+ - **Health**: http://localhost:8000/health
234
+
235
+ ### Dashboard (Port 3000)
236
+ - **Purpose**: Web UI for local management
237
+ - **Framework**: React 18 + TypeScript + Vite
238
+ - **Features**: Projects, vectors, tables, files, events, sync
239
+
240
+ ## Usage Examples
241
+
242
+ ### Create a Project
243
+ ```bash
244
+ curl -X POST http://localhost:8000/v1/projects \
245
+ -H "Content-Type: application/json" \
246
+ -d '{
247
+ "name": "my-first-project",
248
+ "description": "Testing ZeroDB Local"
249
+ }'
250
+ ```
251
+
252
+ ### Upsert a Vector
253
+ ```bash
254
+ curl -X POST http://localhost:8000/v1/projects/{project_id}/database/vectors/upsert \
255
+ -H "Content-Type: application/json" \
256
+ -d '{
257
+ "vector_embedding": [0.1, 0.2, 0.3, ...],
258
+ "document": "This is my document",
259
+ "metadata": {"source": "local-test"}
260
+ }'
261
+ ```
262
+
263
+ ### Search Vectors
264
+ ```bash
265
+ curl -X POST http://localhost:8000/v1/projects/{project_id}/database/vectors/search \
266
+ -H "Content-Type: application/json" \
267
+ -d '{
268
+ "query_vector": [0.1, 0.2, 0.3, ...],
269
+ "limit": 10,
270
+ "threshold": 0.7
271
+ }'
272
+ ```
273
+
274
+ ## CLI Tool
275
+
276
+ ### Installation
277
+ ```bash
278
+ cd cli
279
+ pip install -e .
280
+ ```
281
+
282
+ ### Commands
283
+ ```bash
284
+ # Start local environment
285
+ zerodb local up
286
+
287
+ # Stop local environment
288
+ zerodb local down
289
+
290
+ # Check service status
291
+ zerodb local status
292
+
293
+ # Login to cloud
294
+ zerodb cloud login
295
+
296
+ # Link local project to cloud
297
+ zerodb cloud link <project_id>
298
+
299
+ # Sync to cloud (push)
300
+ zerodb sync apply
301
+
302
+ # Pull from cloud
303
+ zerodb cloud pull
304
+ ```
305
+
306
+ ## Data Management
307
+
308
+ ### Backup Local Data
309
+ ```bash
310
+ ./scripts/backup-local.sh
311
+ ```
312
+
313
+ Creates backup in `./backups/zerodb-backup-YYYY-MM-DD.tar.gz`
314
+
315
+ ### Restore from Backup
316
+ ```bash
317
+ ./scripts/restore-local.sh ./backups/zerodb-backup-YYYY-MM-DD.tar.gz
318
+ ```
319
+
320
+ ### Reset Everything
321
+ ```bash
322
+ docker-compose down -v
323
+ rm -rf ./data
324
+ docker-compose up -d
325
+ ```
326
+
327
+ ## Development
328
+
329
+ ### Hot Reload API
330
+ ```bash
331
+ cd api
332
+ uvicorn main:app --reload --host 0.0.0.0 --port 8000
333
+ ```
334
+
335
+ ### Hot Reload Dashboard
336
+ ```bash
337
+ cd dashboard
338
+ npm run dev
339
+ ```
340
+
341
+ ### Run Tests
342
+ ```bash
343
+ cd api
344
+ pytest tests/ -v --cov
345
+ ```
346
+
347
+ ## Troubleshooting
348
+
349
+ ### Services won't start
350
+ ```bash
351
+ # Check logs
352
+ docker-compose logs
353
+
354
+ # Restart specific service
355
+ docker-compose restart zerodb-api
356
+
357
+ # Full reset
358
+ docker-compose down -v && docker-compose up -d
359
+ ```
360
+
361
+ ### Port conflicts
362
+ ```bash
363
+ # Check what's using the ports
364
+ lsof -i :5432 # PostgreSQL
365
+ lsof -i :6333 # Qdrant
366
+ lsof -i :9000 # MinIO
367
+ lsof -i :9092 # RedPanda
368
+ lsof -i :8000 # API
369
+ lsof -i :3000 # Dashboard
370
+
371
+ # Update ports in docker-compose.yml if needed
372
+ ```
373
+
374
+ ### Slow embeddings
375
+ ```bash
376
+ # Use GPU if available (NVIDIA)
377
+ # Update .env.local:
378
+ EMBEDDINGS_DEVICE=cuda
379
+
380
+ # Or use larger model (slower but more accurate)
381
+ EMBEDDINGS_MODEL=BAAI/bge-base-en-v1.5 # 768 dims
382
+ EMBEDDINGS_MODEL=BAAI/bge-large-en-v1.5 # 1024 dims
383
+ ```
384
+
385
+ ### Database connection issues
386
+ ```bash
387
+ # Check Postgres is healthy
388
+ docker-compose exec postgres pg_isready
389
+
390
+ # Inspect logs
391
+ docker-compose logs postgres
392
+
393
+ # Connect manually
394
+ docker-compose exec postgres psql -U zerodb -d zerodb_local
395
+ ```
396
+
397
+ ## Cloud Sync
398
+
399
+ ### Setup
400
+ 1. Get your API key from https://www.ainative.studio/dashboard/api-keys
401
+ 2. Add to `.env.local`:
402
+ ```
403
+ CLOUD_API_KEY=your-api-key-here
404
+ ```
405
+ 3. Login via CLI:
406
+ ```bash
407
+ zerodb cloud login
408
+ ```
409
+
410
+ ### Sync Workflow
411
+ ```bash
412
+ # 1. Make changes locally (add vectors, tables, etc.)
413
+
414
+ # 2. See what will be synced
415
+ zerodb sync plan
416
+
417
+ # 3. Push to cloud
418
+ zerodb sync apply
419
+
420
+ # 4. Pull changes from cloud
421
+ zerodb cloud pull
422
+ ```
423
+
424
+ ### Conflict Resolution
425
+ Configure in `.env.local`:
426
+ ```
427
+ CONFLICT_RESOLUTION=newest-wins # local-wins, cloud-wins, newest-wins, manual
428
+ ```
429
+
430
+ ## Environment Variables Reference
431
+
432
+ See `.env.local.example` for complete list. Key variables:
433
+
434
+ - `POSTGRES_PASSWORD` - Database password (change in production!)
435
+ - `CLOUD_API_KEY` - Your ZeroDB Cloud API key for sync
436
+ - `EMBEDDINGS_MODEL` - Model to use (small/base/large)
437
+ - `LOG_LEVEL` - Logging verbosity (debug/info/warning/error)
438
+ - `DEBUG` - Enable debug mode (true/false)
439
+
440
+ ## System Requirements
441
+
442
+ ### Minimum
443
+ - 4GB RAM
444
+ - 10GB disk space
445
+ - 2 CPU cores
446
+ - Docker 20.10+
447
+
448
+ ### Recommended
449
+ - 8GB RAM
450
+ - 50GB disk space (for embeddings models + data)
451
+ - 4 CPU cores
452
+ - SSD storage
453
+ - Docker 24.0+
454
+
455
+ ## Performance
456
+
457
+ ### Expected Latency
458
+ - Vector upsert: <10ms
459
+ - Semantic search (10k vectors): <50ms
460
+ - Embeddings generation: <100ms per text
461
+ - Sync (1k vectors): <30s
462
+
463
+ ### Scaling Limits (Local)
464
+ - Vectors: Up to 1M (limited by RAM)
465
+ - Tables: Unlimited (limited by disk)
466
+ - Files: Unlimited (limited by disk)
467
+ - Events: 10k/sec (limited by RedPanda)
468
+
469
+ ## Security
470
+
471
+ ### Default Credentials
472
+ **⚠️ CHANGE THESE IN PRODUCTION!**
473
+ - PostgreSQL: `zerodb` / `localpass`
474
+ - MinIO: `minioadmin` / `minioadmin`
475
+ - API JWT Secret: (generated automatically)
476
+
477
+ ### Best Practices
478
+ 1. Use strong passwords in `.env.local`
479
+ 2. Never commit `.env.local` to git
480
+ 3. Use API keys for cloud sync (not passwords)
481
+ 4. Enable HTTPS for remote access
482
+ 5. Restrict CORS origins in production
483
+
484
+ ## Documentation
485
+
486
+ - **Quick Start**: [docs/QUICK_START.md](./docs/QUICK_START.md) - Step-by-step setup guide
487
+ - **Environment Setup**: [docs/ENVIRONMENT_SETUP.md](./docs/ENVIRONMENT_SETUP.md) - Configuration for local/staging/production
488
+ - **Data Management**: [docs/DATA_MANAGEMENT.md](./docs/DATA_MANAGEMENT.md) - Backups, restores, and data lifecycle
489
+ - **Troubleshooting**: [docs/TROUBLESHOOTING.md](./docs/TROUBLESHOOTING.md) - Common issues and solutions
490
+ - **Sync Strategy**: [docs/SYNC_STRATEGY.md](./docs/SYNC_STRATEGY.md) - Cloud sync configuration
491
+ - **API Reference**: http://localhost:8000/docs - Interactive API documentation
492
+
493
+ ## Port Configuration
494
+
495
+ All external port mappings in `docker-compose.yml` are configurable via environment variables. Each defaults to the standard port if unset.
496
+
497
+ | Service | Default Port | Environment Variable |
498
+ |---------|-------------|---------------------|
499
+ | PostgreSQL | 5432 | `ZERODB_POSTGRES_PORT` |
500
+ | Qdrant REST | 6333 | `ZERODB_QDRANT_REST_PORT` |
501
+ | Qdrant gRPC | 6334 | `ZERODB_QDRANT_GRPC_PORT` |
502
+ | MinIO API | 9000 | `ZERODB_MINIO_API_PORT` |
503
+ | MinIO Console | 9001 | `ZERODB_MINIO_CONSOLE_PORT` |
504
+ | RedPanda Kafka | 9092 | `ZERODB_REDPANDA_KAFKA_PORT` |
505
+ | RedPanda HTTP Proxy | 8082 | `ZERODB_REDPANDA_PROXY_PORT` |
506
+ | RedPanda Admin | 9644 | `ZERODB_REDPANDA_ADMIN_PORT` |
507
+ | Embeddings | 8001 | `ZERODB_EMBEDDINGS_PORT` |
508
+ | API Server | 8000 | `ZERODB_API_PORT` |
509
+ | Dashboard | 3000 | `ZERODB_DASHBOARD_PORT` |
510
+
511
+ ### Remapping Ports
512
+
513
+ Set variables in your `.env.local` file or pass them directly:
514
+
515
+ ```bash
516
+ # Via .env.local
517
+ ZERODB_API_PORT=8080
518
+ ZERODB_DASHBOARD_PORT=3001
519
+ ZERODB_POSTGRES_PORT=5433
520
+
521
+ # Or inline
522
+ ZERODB_API_PORT=8080 docker-compose up -d
523
+ ```
524
+
525
+ ### Using docker-compose.override.yml
526
+
527
+ For persistent local overrides without modifying tracked files, create a `docker-compose.override.yml`:
528
+
529
+ ```yaml
530
+ version: '3.8'
531
+ services:
532
+ zerodb-api:
533
+ ports:
534
+ - "8080:8000"
535
+ dashboard:
536
+ ports:
537
+ - "3001:3000"
538
+ postgres:
539
+ ports:
540
+ - "5433:5432"
541
+ ```
542
+
543
+ Docker Compose automatically merges this file with `docker-compose.yml` on every `docker-compose up`.
544
+
545
+ ### Port Conflict Detection
546
+
547
+ The `port-config.json` file in this directory describes all service ports and their env vars. It can be consumed by the port-management skill or any automation tool to detect conflicts before starting the stack.
548
+
549
+ ## Support
550
+
551
+ - **GitHub Issues**: https://github.com/AINative-Studio/core/issues
552
+ - **Documentation**: https://www.ainative.studio/docs
553
+ - **Community**: https://www.ainative.studio/community
554
+ - **Email**: hello@ainative.studio
555
+
556
+ ## License
557
+
558
+ MIT License. See [LICENSE](./LICENSE) for details.
559
+
560
+ ---
561
+
562
+ **Built with ❤️ by the AINative Studio team**