mdb-engine 0.6.0__tar.gz → 0.7.1__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 (107) hide show
  1. {mdb_engine-0.6.0/mdb_engine.egg-info → mdb_engine-0.7.1}/PKG-INFO +128 -4
  2. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/README.md +126 -3
  3. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/__init__.py +7 -13
  4. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/__init__.py +9 -0
  5. mdb_engine-0.7.1/mdb_engine/auth/csrf.py +1118 -0
  6. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/provider.py +10 -0
  7. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/shared_users.py +41 -0
  8. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/users.py +2 -1
  9. mdb_engine-0.7.1/mdb_engine/auth/websocket_tickets.py +307 -0
  10. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/cli/main.py +1 -1
  11. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/app_registration.py +10 -0
  12. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/engine.py +687 -38
  13. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/manifest.py +14 -0
  14. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/ray_integration.py +4 -4
  15. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/service_initialization.py +63 -7
  16. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/types.py +1 -0
  17. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/database/connection.py +6 -3
  18. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/database/scoped_wrapper.py +3 -3
  19. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/indexes/manager.py +3 -3
  20. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/observability/health.py +7 -7
  21. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/routing/README.md +9 -2
  22. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/routing/websockets.py +453 -74
  23. {mdb_engine-0.6.0 → mdb_engine-0.7.1/mdb_engine.egg-info}/PKG-INFO +128 -4
  24. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine.egg-info/SOURCES.txt +1 -0
  25. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine.egg-info/requires.txt +1 -0
  26. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/pyproject.toml +3 -1
  27. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/setup.py +1 -1
  28. mdb_engine-0.6.0/mdb_engine/auth/csrf.py +0 -769
  29. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/LICENSE +0 -0
  30. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/MANIFEST.in +0 -0
  31. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/README.md +0 -0
  32. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/ARCHITECTURE.md +0 -0
  33. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/README.md +0 -0
  34. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/audit.py +0 -0
  35. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/base.py +0 -0
  36. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/casbin_factory.py +0 -0
  37. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/casbin_models.py +0 -0
  38. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/config_defaults.py +0 -0
  39. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/config_helpers.py +0 -0
  40. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/cookie_utils.py +0 -0
  41. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/decorators.py +0 -0
  42. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/dependencies.py +0 -0
  43. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/helpers.py +0 -0
  44. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/integration.py +0 -0
  45. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/jwt.py +0 -0
  46. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/middleware.py +0 -0
  47. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/oso_factory.py +0 -0
  48. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/rate_limiter.py +0 -0
  49. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/restrictions.py +0 -0
  50. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/session_manager.py +0 -0
  51. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/shared_middleware.py +0 -0
  52. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/token_lifecycle.py +0 -0
  53. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/token_store.py +0 -0
  54. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/utils.py +0 -0
  55. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/auth/websocket_sessions.py +0 -0
  56. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/cli/__init__.py +0 -0
  57. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/cli/commands/__init__.py +0 -0
  58. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/cli/commands/generate.py +0 -0
  59. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/cli/commands/migrate.py +0 -0
  60. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/cli/commands/show.py +0 -0
  61. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/cli/commands/validate.py +0 -0
  62. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/cli/utils.py +0 -0
  63. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/config.py +0 -0
  64. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/constants.py +0 -0
  65. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/README.md +0 -0
  66. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/__init__.py +0 -0
  67. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/app_secrets.py +0 -0
  68. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/connection.py +0 -0
  69. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/encryption.py +0 -0
  70. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/index_management.py +0 -0
  71. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/core/seeding.py +0 -0
  72. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/database/README.md +0 -0
  73. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/database/__init__.py +0 -0
  74. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/database/abstraction.py +0 -0
  75. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/database/query_validator.py +0 -0
  76. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/database/resource_limiter.py +0 -0
  77. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/dependencies.py +0 -0
  78. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/di/__init__.py +0 -0
  79. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/di/container.py +0 -0
  80. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/di/providers.py +0 -0
  81. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/di/scopes.py +0 -0
  82. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/embeddings/README.md +0 -0
  83. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/embeddings/__init__.py +0 -0
  84. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/embeddings/dependencies.py +0 -0
  85. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/embeddings/service.py +0 -0
  86. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/exceptions.py +0 -0
  87. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/indexes/README.md +0 -0
  88. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/indexes/__init__.py +0 -0
  89. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/indexes/helpers.py +0 -0
  90. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/memory/README.md +0 -0
  91. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/memory/__init__.py +0 -0
  92. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/memory/service.py +0 -0
  93. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/observability/README.md +0 -0
  94. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/observability/__init__.py +0 -0
  95. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/observability/logging.py +0 -0
  96. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/observability/metrics.py +0 -0
  97. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/repositories/__init__.py +0 -0
  98. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/repositories/base.py +0 -0
  99. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/repositories/mongo.py +0 -0
  100. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/repositories/unit_of_work.py +0 -0
  101. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/routing/__init__.py +0 -0
  102. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/utils/__init__.py +0 -0
  103. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine/utils/mongo.py +0 -0
  104. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine.egg-info/dependency_links.txt +0 -0
  105. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine.egg-info/entry_points.txt +0 -0
  106. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/mdb_engine.egg-info/top_level.txt +0 -0
  107. {mdb_engine-0.6.0 → mdb_engine-0.7.1}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdb-engine
3
- Version: 0.6.0
3
+ Version: 0.7.1
4
4
  Summary: MongoDB Engine
5
5
  Home-page: https://github.com/ranfysvalle02/mdb-engine
6
6
  Author: Fabian Valle
@@ -51,6 +51,7 @@ Requires-Dist: pytest-mock>=3.11.0; extra == "test"
51
51
  Requires-Dist: pytest-timeout>=2.1.0; extra == "test"
52
52
  Requires-Dist: pytest-xdist>=3.3.0; extra == "test"
53
53
  Requires-Dist: testcontainers>=3.7.0; extra == "test"
54
+ Requires-Dist: nest-asyncio>=1.5.0; extra == "test"
54
55
  Provides-Extra: dev
55
56
  Requires-Dist: ruff<0.6.0,>=0.4.0; extra == "dev"
56
57
  Requires-Dist: semgrep>=1.50.0; extra == "dev"
@@ -71,6 +72,18 @@ Dynamic: requires-python
71
72
  [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
72
73
  [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](https://opensource.org/licenses/AGPL-3.0)
73
74
 
75
+ ## 🎉 What's New in v0.7.0
76
+
77
+ **FastAPI Native WebSocket Support**: MDB-Engine now uses FastAPI's `APIRouter` approach for WebSocket registration in both single-app and multi-app modes. This provides:
78
+
79
+ - ✅ **Full FastAPI Feature Support**: Dependency injection, OpenAPI documentation, request/response models
80
+ - ✅ **Consistency**: Same registration pattern across single-app and multi-app modes
81
+ - ✅ **Best Practices**: Follows FastAPI's recommended WebSocket registration patterns
82
+ - ✅ **Better Maintainability**: Uses FastAPI abstractions instead of low-level Starlette APIs
83
+ - ✅ **Route Priority**: WebSocket routes registered before mounted apps ensure proper routing
84
+
85
+ **Value**: This change ensures WebSocket endpoints benefit from all FastAPI features, making your code more maintainable and consistent with FastAPI best practices.
86
+
74
87
  ---
75
88
 
76
89
  ## 🎯 manifest.json: The Key to Everything
@@ -106,10 +119,100 @@ pip install mdb-engine
106
119
 
107
120
  ---
108
121
 
122
+ ## ⚠️ Prerequisites: MongoDB Must Be Running
123
+
124
+ **IMPORTANT**: MDB-Engine requires a running MongoDB instance. Make sure MongoDB is running before starting your application.
125
+
126
+ ### Quick MongoDB Setup Options
127
+
128
+ #### Option 1: Docker Compose (Recommended for Development)
129
+
130
+ Create a `docker-compose.yml` file:
131
+
132
+ ```yaml
133
+ services:
134
+ mongodb:
135
+ image: mongo:7.0
136
+ container_name: mdb_mongodb
137
+ ports:
138
+ - "27017:27017"
139
+ volumes:
140
+ - mongodb_data:/data/db
141
+ healthcheck:
142
+ test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
143
+ interval: 10s
144
+ timeout: 5s
145
+ retries: 5
146
+
147
+ volumes:
148
+ mongodb_data:
149
+ ```
150
+
151
+ Start MongoDB:
152
+ ```bash
153
+ docker-compose up -d mongodb
154
+ ```
155
+
156
+ #### Option 2: Docker Run (Quick Start)
157
+
158
+ ```bash
159
+ docker run -d \
160
+ --name mdb_mongodb \
161
+ -p 27017:27017 \
162
+ -v mongodb_data:/data/db \
163
+ mongo:7.0
164
+ ```
165
+
166
+ #### Option 3: Local MongoDB Installation
167
+
168
+ **macOS (Homebrew):**
169
+ ```bash
170
+ brew tap mongodb/brew
171
+ brew install mongodb-community
172
+ brew services start mongodb-community
173
+ ```
174
+
175
+ **Linux (Ubuntu/Debian):**
176
+ ```bash
177
+ sudo apt-get install -y mongodb
178
+ sudo systemctl start mongodb
179
+ ```
180
+
181
+ **Windows:**
182
+ Download and install from [MongoDB Download Center](https://www.mongodb.com/try/download/community)
183
+
184
+ #### Option 4: MongoDB Atlas (Cloud)
185
+
186
+ 1. Sign up at [MongoDB Atlas](https://www.mongodb.com/cloud/atlas)
187
+ 2. Create a free cluster
188
+ 3. Get your connection string: `mongodb+srv://user:password@cluster.mongodb.net/`
189
+
190
+ ### Verify MongoDB is Running
191
+
192
+ ```bash
193
+ # Check if MongoDB is accessible
194
+ mongosh "mongodb://localhost:27017" --eval "db.adminCommand('ping')"
195
+
196
+ # Or using curl (if mongosh not available)
197
+ curl http://localhost:27017
198
+ ```
199
+
200
+ **Expected output:** `{ "ok": 1 }` or connection successful
201
+
202
+ ### Common Connection Strings
203
+
204
+ - **Local MongoDB (default)**: `mongodb://localhost:27017`
205
+ - **Docker MongoDB**: `mongodb://localhost:27017` (if port mapped)
206
+ - **MongoDB Atlas**: `mongodb+srv://user:password@cluster.mongodb.net/dbname`
207
+
208
+ ---
209
+
109
210
  ## 30-Second Quick Start: Build a Todo List API
110
211
 
111
212
  Let's build a complete CRUD todo list app in 3 steps!
112
213
 
214
+ > **⚠️ Before you start**: Make sure MongoDB is running! See [Prerequisites](#-prerequisites-mongodb-must-be-running) section above.
215
+
113
216
  ### Step 1: Create `manifest.json`
114
217
 
115
218
  ```json
@@ -144,8 +247,9 @@ from mdb_engine import MongoDBEngine
144
247
  from mdb_engine.dependencies import get_scoped_db
145
248
 
146
249
  # Initialize engine
250
+ # ⚠️ Make sure MongoDB is running at mongodb://localhost:27017
147
251
  engine = MongoDBEngine(
148
- mongo_uri="mongodb://localhost:27017",
252
+ mongo_uri="mongodb://localhost:27017", # Change if using Docker/Atlas
149
253
  db_name="my_database"
150
254
  )
151
255
 
@@ -226,8 +330,8 @@ async def delete_todo(todo_id: str, db=Depends(get_scoped_db)):
226
330
  ### Step 3: Run It!
227
331
 
228
332
  ```bash
229
- # Start MongoDB (if not running)
230
- mongod
333
+ # ⚠️ IMPORTANT: Make sure MongoDB is running first!
334
+ # See "Prerequisites: MongoDB Must Be Running" section above
231
335
 
232
336
  # Install dependencies
233
337
  pip install mdb-engine fastapi uvicorn
@@ -236,6 +340,20 @@ pip install mdb-engine fastapi uvicorn
236
340
  uvicorn app:app --reload
237
341
  ```
238
342
 
343
+ **If MongoDB is not running**, you'll see connection errors. Make sure MongoDB is started before running your app!
344
+
345
+ **Quick MongoDB check:**
346
+ ```bash
347
+ # Option 1: Docker Compose
348
+ docker-compose up -d mongodb
349
+
350
+ # Option 2: Docker Run
351
+ docker run -d --name mdb_mongodb -p 27017:27017 mongo:7.0
352
+
353
+ # Option 3: Local MongoDB
354
+ mongod # or brew services start mongodb-community (macOS)
355
+ ```
356
+
239
357
  **Test your API:**
240
358
  ```bash
241
359
  # Create a todo
@@ -405,9 +523,14 @@ Clone and run:
405
523
  ```bash
406
524
  git clone https://github.com/ranfysvalle02/mdb-engine.git
407
525
  cd mdb-engine/examples/basic/chit_chat
526
+
527
+ # Examples include docker-compose.yml with MongoDB
528
+ # This will start both MongoDB and your app
408
529
  docker-compose up --build
409
530
  ```
410
531
 
532
+ **Note**: All examples include `docker-compose.yml` files that start MongoDB automatically. If running examples without Docker, make sure MongoDB is running first!
533
+
411
534
  ### Basic Examples
412
535
 
413
536
  | Example | Description |
@@ -437,6 +560,7 @@ from pathlib import Path
437
560
  from fastapi import FastAPI
438
561
  from mdb_engine import MongoDBEngine
439
562
 
563
+ # ⚠️ Make sure MongoDB is running before initializing the engine
440
564
  app = FastAPI()
441
565
  engine = MongoDBEngine(mongo_uri="mongodb://localhost:27017", db_name="my_database")
442
566
 
@@ -6,6 +6,18 @@
6
6
  [![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
7
7
  [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL--3.0-blue.svg)](https://opensource.org/licenses/AGPL-3.0)
8
8
 
9
+ ## 🎉 What's New in v0.7.0
10
+
11
+ **FastAPI Native WebSocket Support**: MDB-Engine now uses FastAPI's `APIRouter` approach for WebSocket registration in both single-app and multi-app modes. This provides:
12
+
13
+ - ✅ **Full FastAPI Feature Support**: Dependency injection, OpenAPI documentation, request/response models
14
+ - ✅ **Consistency**: Same registration pattern across single-app and multi-app modes
15
+ - ✅ **Best Practices**: Follows FastAPI's recommended WebSocket registration patterns
16
+ - ✅ **Better Maintainability**: Uses FastAPI abstractions instead of low-level Starlette APIs
17
+ - ✅ **Route Priority**: WebSocket routes registered before mounted apps ensure proper routing
18
+
19
+ **Value**: This change ensures WebSocket endpoints benefit from all FastAPI features, making your code more maintainable and consistent with FastAPI best practices.
20
+
9
21
  ---
10
22
 
11
23
  ## 🎯 manifest.json: The Key to Everything
@@ -41,10 +53,100 @@ pip install mdb-engine
41
53
 
42
54
  ---
43
55
 
56
+ ## ⚠️ Prerequisites: MongoDB Must Be Running
57
+
58
+ **IMPORTANT**: MDB-Engine requires a running MongoDB instance. Make sure MongoDB is running before starting your application.
59
+
60
+ ### Quick MongoDB Setup Options
61
+
62
+ #### Option 1: Docker Compose (Recommended for Development)
63
+
64
+ Create a `docker-compose.yml` file:
65
+
66
+ ```yaml
67
+ services:
68
+ mongodb:
69
+ image: mongo:7.0
70
+ container_name: mdb_mongodb
71
+ ports:
72
+ - "27017:27017"
73
+ volumes:
74
+ - mongodb_data:/data/db
75
+ healthcheck:
76
+ test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
77
+ interval: 10s
78
+ timeout: 5s
79
+ retries: 5
80
+
81
+ volumes:
82
+ mongodb_data:
83
+ ```
84
+
85
+ Start MongoDB:
86
+ ```bash
87
+ docker-compose up -d mongodb
88
+ ```
89
+
90
+ #### Option 2: Docker Run (Quick Start)
91
+
92
+ ```bash
93
+ docker run -d \
94
+ --name mdb_mongodb \
95
+ -p 27017:27017 \
96
+ -v mongodb_data:/data/db \
97
+ mongo:7.0
98
+ ```
99
+
100
+ #### Option 3: Local MongoDB Installation
101
+
102
+ **macOS (Homebrew):**
103
+ ```bash
104
+ brew tap mongodb/brew
105
+ brew install mongodb-community
106
+ brew services start mongodb-community
107
+ ```
108
+
109
+ **Linux (Ubuntu/Debian):**
110
+ ```bash
111
+ sudo apt-get install -y mongodb
112
+ sudo systemctl start mongodb
113
+ ```
114
+
115
+ **Windows:**
116
+ Download and install from [MongoDB Download Center](https://www.mongodb.com/try/download/community)
117
+
118
+ #### Option 4: MongoDB Atlas (Cloud)
119
+
120
+ 1. Sign up at [MongoDB Atlas](https://www.mongodb.com/cloud/atlas)
121
+ 2. Create a free cluster
122
+ 3. Get your connection string: `mongodb+srv://user:password@cluster.mongodb.net/`
123
+
124
+ ### Verify MongoDB is Running
125
+
126
+ ```bash
127
+ # Check if MongoDB is accessible
128
+ mongosh "mongodb://localhost:27017" --eval "db.adminCommand('ping')"
129
+
130
+ # Or using curl (if mongosh not available)
131
+ curl http://localhost:27017
132
+ ```
133
+
134
+ **Expected output:** `{ "ok": 1 }` or connection successful
135
+
136
+ ### Common Connection Strings
137
+
138
+ - **Local MongoDB (default)**: `mongodb://localhost:27017`
139
+ - **Docker MongoDB**: `mongodb://localhost:27017` (if port mapped)
140
+ - **MongoDB Atlas**: `mongodb+srv://user:password@cluster.mongodb.net/dbname`
141
+
142
+ ---
143
+
44
144
  ## 30-Second Quick Start: Build a Todo List API
45
145
 
46
146
  Let's build a complete CRUD todo list app in 3 steps!
47
147
 
148
+ > **⚠️ Before you start**: Make sure MongoDB is running! See [Prerequisites](#-prerequisites-mongodb-must-be-running) section above.
149
+
48
150
  ### Step 1: Create `manifest.json`
49
151
 
50
152
  ```json
@@ -79,8 +181,9 @@ from mdb_engine import MongoDBEngine
79
181
  from mdb_engine.dependencies import get_scoped_db
80
182
 
81
183
  # Initialize engine
184
+ # ⚠️ Make sure MongoDB is running at mongodb://localhost:27017
82
185
  engine = MongoDBEngine(
83
- mongo_uri="mongodb://localhost:27017",
186
+ mongo_uri="mongodb://localhost:27017", # Change if using Docker/Atlas
84
187
  db_name="my_database"
85
188
  )
86
189
 
@@ -161,8 +264,8 @@ async def delete_todo(todo_id: str, db=Depends(get_scoped_db)):
161
264
  ### Step 3: Run It!
162
265
 
163
266
  ```bash
164
- # Start MongoDB (if not running)
165
- mongod
267
+ # ⚠️ IMPORTANT: Make sure MongoDB is running first!
268
+ # See "Prerequisites: MongoDB Must Be Running" section above
166
269
 
167
270
  # Install dependencies
168
271
  pip install mdb-engine fastapi uvicorn
@@ -171,6 +274,20 @@ pip install mdb-engine fastapi uvicorn
171
274
  uvicorn app:app --reload
172
275
  ```
173
276
 
277
+ **If MongoDB is not running**, you'll see connection errors. Make sure MongoDB is started before running your app!
278
+
279
+ **Quick MongoDB check:**
280
+ ```bash
281
+ # Option 1: Docker Compose
282
+ docker-compose up -d mongodb
283
+
284
+ # Option 2: Docker Run
285
+ docker run -d --name mdb_mongodb -p 27017:27017 mongo:7.0
286
+
287
+ # Option 3: Local MongoDB
288
+ mongod # or brew services start mongodb-community (macOS)
289
+ ```
290
+
174
291
  **Test your API:**
175
292
  ```bash
176
293
  # Create a todo
@@ -340,9 +457,14 @@ Clone and run:
340
457
  ```bash
341
458
  git clone https://github.com/ranfysvalle02/mdb-engine.git
342
459
  cd mdb-engine/examples/basic/chit_chat
460
+
461
+ # Examples include docker-compose.yml with MongoDB
462
+ # This will start both MongoDB and your app
343
463
  docker-compose up --build
344
464
  ```
345
465
 
466
+ **Note**: All examples include `docker-compose.yml` files that start MongoDB automatically. If running examples without Docker, make sure MongoDB is running first!
467
+
346
468
  ### Basic Examples
347
469
 
348
470
  | Example | Description |
@@ -372,6 +494,7 @@ from pathlib import Path
372
494
  from fastapi import FastAPI
373
495
  from mdb_engine import MongoDBEngine
374
496
 
497
+ # ⚠️ Make sure MongoDB is running before initializing the engine
375
498
  app = FastAPI()
376
499
  engine = MongoDBEngine(mongo_uri="mongodb://localhost:27017", db_name="my_database")
377
500
 
@@ -82,19 +82,13 @@ from .repositories import Entity, MongoRepository, Repository, UnitOfWork
82
82
  from .utils import clean_mongo_doc, clean_mongo_docs
83
83
 
84
84
  __version__ = (
85
- "0.6.0" # Secure-by-default WebSocket authentication with encrypted session keys
86
- # - NEW: WebSocket session key generation and management
87
- # - NEW: Envelope encryption for WebSocket session keys
88
- # - NEW: Secure-by-default CSRF protection (csrf_required: true)
89
- # - NEW: WebSocketSessionManager with private collection storage
90
- # - NEW: Session key endpoint (/auth/websocket-session)
91
- # - NEW: Session key integration in login flow
92
- # - ENHANCED: WebSocket authentication with session key support
93
- # - ENHANCED: CSRF middleware session key validation
94
- # - ENHANCED: Multi-app WebSocket routing with session keys
95
- # - BACKWARD COMPATIBLE: Cookie-based authentication fallback
96
- # - UPDATED: All documentation for secure-by-default approach
97
- # - COMPREHENSIVE: Unit and integration tests for session keys
85
+ "0.7.1" # Memory service initialization fix for multi-app setups
86
+ # - FIXED: Memory service initialization in create_multi_app context
87
+ # - FIXED: get_memory_service() now returns service when memory_config.enabled: true
88
+ # - ENHANCED: Explicit memory service initialization in create_multi_app lifespan
89
+ # - ENHANCED: Better error handling and logging for memory service initialization
90
+ # - ADDED: Comprehensive integration tests for memory service in multi-app context
91
+ # - ADDED: Unit tests for memory service initialization edge cases
98
92
  )
99
93
 
100
94
  __all__ = [
@@ -131,6 +131,12 @@ from .websocket_sessions import (
131
131
  create_websocket_session_endpoint,
132
132
  )
133
133
 
134
+ # WebSocket tickets
135
+ from .websocket_tickets import (
136
+ WebSocketTicketStore,
137
+ create_websocket_ticket_endpoint,
138
+ )
139
+
134
140
  __all__ = [
135
141
  # Base classes
136
142
  "BaseAuthorizationProvider",
@@ -241,4 +247,7 @@ __all__ = [
241
247
  # WebSocket sessions
242
248
  "WebSocketSessionManager",
243
249
  "create_websocket_session_endpoint",
250
+ # WebSocket tickets
251
+ "WebSocketTicketStore",
252
+ "create_websocket_ticket_endpoint",
244
253
  ]