dreema 0.1.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 (61) hide show
  1. dreema-0.1.0/LICENSE +21 -0
  2. dreema-0.1.0/PKG-INFO +337 -0
  3. dreema-0.1.0/README.md +311 -0
  4. dreema-0.1.0/dreema/__init__.py +0 -0
  5. dreema-0.1.0/dreema/config.py +9 -0
  6. dreema-0.1.0/dreema/context.py +67 -0
  7. dreema-0.1.0/dreema/files/__init__.py +5 -0
  8. dreema-0.1.0/dreema/files/management.py +101 -0
  9. dreema-0.1.0/dreema/files/parser.py +111 -0
  10. dreema-0.1.0/dreema/helpers/__init__.py +5 -0
  11. dreema-0.1.0/dreema/helpers/cmd.py +288 -0
  12. dreema-0.1.0/dreema/helpers/configurations.py +106 -0
  13. dreema-0.1.0/dreema/helpers/serialization.py +35 -0
  14. dreema-0.1.0/dreema/index.py +73 -0
  15. dreema-0.1.0/dreema/logger/__init__.py +5 -0
  16. dreema-0.1.0/dreema/logger/loggers.py +42 -0
  17. dreema-0.1.0/dreema/logger/setup.py +33 -0
  18. dreema-0.1.0/dreema/middlewares/__init__.py +3 -0
  19. dreema-0.1.0/dreema/middlewares/dbware.py +62 -0
  20. dreema-0.1.0/dreema/orm/__init__.py +0 -0
  21. dreema-0.1.0/dreema/orm/database.py +155 -0
  22. dreema-0.1.0/dreema/orm/events.py +81 -0
  23. dreema-0.1.0/dreema/orm/mongo/connection.py +74 -0
  24. dreema-0.1.0/dreema/orm/mongo/queries.py +306 -0
  25. dreema-0.1.0/dreema/orm/mongo/querybuilder.py +234 -0
  26. dreema-0.1.0/dreema/orm/mysql/connection.py +63 -0
  27. dreema-0.1.0/dreema/orm/mysql/queries.py +202 -0
  28. dreema-0.1.0/dreema/orm/mysql/querybuilder.py +358 -0
  29. dreema-0.1.0/dreema/requests/__init__.py +6 -0
  30. dreema-0.1.0/dreema/requests/request.py +387 -0
  31. dreema-0.1.0/dreema/responses/__init__.py +13 -0
  32. dreema-0.1.0/dreema/responses/clientresponse.py +57 -0
  33. dreema-0.1.0/dreema/responses/codes.py +265 -0
  34. dreema-0.1.0/dreema/responses/response.py +139 -0
  35. dreema-0.1.0/dreema/routing/__init__.py +5 -0
  36. dreema-0.1.0/dreema/routing/clients.py +75 -0
  37. dreema-0.1.0/dreema/routing/cors.py +101 -0
  38. dreema-0.1.0/dreema/routing/processing.py +161 -0
  39. dreema-0.1.0/dreema/scheduler/__init__.py +15 -0
  40. dreema-0.1.0/dreema/scheduler/jobs.py +43 -0
  41. dreema-0.1.0/dreema/scheduler/setup.py +48 -0
  42. dreema-0.1.0/dreema/security/__init__.py +6 -0
  43. dreema-0.1.0/dreema/security/authentication.py +57 -0
  44. dreema-0.1.0/dreema/security/encrypt.py +57 -0
  45. dreema-0.1.0/dreema/start.py +74 -0
  46. dreema-0.1.0/dreema/template/core/endpoints.py +27 -0
  47. dreema-0.1.0/dreema/template/full/controllers/usersController.py +48 -0
  48. dreema-0.1.0/dreema/template/full/endpoints.py +34 -0
  49. dreema-0.1.0/dreema/template/full/models/_modelsList.py +9 -0
  50. dreema-0.1.0/dreema/template/full/models/usersModel.py +10 -0
  51. dreema-0.1.0/dreema/template/full/plug.template.py +22 -0
  52. dreema-0.1.0/dreema/template/full/settings.template.py +34 -0
  53. dreema-0.1.0/dreema/terminal.py +90 -0
  54. dreema-0.1.0/dreema.egg-info/PKG-INFO +337 -0
  55. dreema-0.1.0/dreema.egg-info/SOURCES.txt +59 -0
  56. dreema-0.1.0/dreema.egg-info/dependency_links.txt +1 -0
  57. dreema-0.1.0/dreema.egg-info/entry_points.txt +2 -0
  58. dreema-0.1.0/dreema.egg-info/requires.txt +8 -0
  59. dreema-0.1.0/dreema.egg-info/top_level.txt +1 -0
  60. dreema-0.1.0/pyproject.toml +37 -0
  61. dreema-0.1.0/setup.cfg +4 -0
dreema-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Raphael Djangmah Osro-Agbo
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.
dreema-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,337 @@
1
+ Metadata-Version: 2.4
2
+ Name: dreema
3
+ Version: 0.1.0
4
+ Summary: A high-speed, production-proven Python backend framework with built-in ORM, security, and native AI integration support.
5
+ Author-email: Raphael Djangmah <ordjangmah@gmail.com>
6
+ License: MIT
7
+ Keywords: async,web,framework,ai,orm,backend
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Framework :: AsyncIO
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
14
+ Requires-Python: >=3.11.0
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: uvicorn<1.0,>=0.32
18
+ Requires-Dist: aiomysql<1.0,>=0.3
19
+ Requires-Dist: motor<4.0,>=3.6
20
+ Requires-Dist: pymongo<5.0,>=4.9
21
+ Requires-Dist: python-multipart<1.0,>=0.0.22
22
+ Requires-Dist: bcrypt<5.0,>=4.3
23
+ Requires-Dist: celery<6.0,>=5.5
24
+ Requires-Dist: requests<3.0,>=2.33
25
+ Dynamic: license-file
26
+
27
+ <div align="center">
28
+
29
+ <img src="https://img.shields.io/badge/Dreema-Python%20Backend-5B3DF5?style=for-the-badge&logo=python" alt="Dreema Python Backend" />
30
+
31
+ <p style="margin:6px 0 10px 0;">
32
+ <img src="https://img.shields.io/badge/Python-3.10+-3776AB?style=flat-square&logo=python&logoColor=white" />
33
+ <img src="https://img.shields.io/badge/License-MIT-22c55e?style=flat-square" />
34
+ <img src="https://img.shields.io/badge/Status-Beta-f59e0b?style=flat-square" />
35
+ <img src="https://img.shields.io/badge/AI--First-Architecture-5B3DF5?style=flat-square" />
36
+ </p>
37
+
38
+ <h1 style="margin: 6px 0 0 0; font-size: 2.5rem; color:#563d7c;">
39
+ Build Backend Systems That Scale
40
+ </h1>
41
+
42
+ <p style="margin:6px 0 14px 0; font-size:1.15rem; font-weight:400; color:#563d7c;">
43
+ • Structure • Consistency • AI-ready systems
44
+ </p>
45
+
46
+ <div align="left" style="max-width:720px; margin:0 auto; font-size:1.1rem; line-height:1.7;">
47
+ <p>
48
+ <b>The current bottleneck in AI development isn't the AI—it’s the architecture.</b>
49
+ </p>
50
+ <p>
51
+ While Large Language Models are exceptional at generating code, the systems they produce are often fragile, inconsistent, and difficult to maintain. Traditional frameworks were built for human-centric workflows, relying on deep tribal knowledge, complex boilerplate, and hidden side effects that confuse AI agents.
52
+ </p>
53
+ <p>
54
+ When frameworks prioritize "magic" over predictability, AI agents struggle to generate code that is production-ready.
55
+ </p>
56
+
57
+ </div>
58
+ </div>
59
+
60
+ ---
61
+
62
+ <h1 style="margin-top: 10px; font-weight:600; font-size: 1.2rem; color:#563d7c;">
63
+ Why Dreema?
64
+ </h1>
65
+
66
+ <p>
67
+ <b>Dreema is a paradigm shift:</b> A Python framework architected specifically to be <i>AI-native</i>. By enforcing strict, predictable design patterns and standardized interfaces, Dreema ensures that AI-generated code is robust, modular, and natively compatible with automated workflows.
68
+ </p>
69
+ <p>
70
+ <b>Stop fighting your framework. Start building with a foundation designed for the future of development using:
71
+ </b>
72
+ </p>
73
+
74
+ - **Dreem's batteries-included** ecosystem featuring ORMs, Middlewares, Plugs, etc.
75
+ - **Enforced Architecture:** Replaces flexible chaos with a deterministic MVC structure.
76
+ - **Universal Error Contract:** Delivers standardized responses that AI agents can reliably parse, debug, and self-heal.
77
+ - **Native AI tools:** Provides developers with AI tools for better developer experience.
78
+ - **Predictable Roadmap:** Provides the structural clarity AI needs to build, maintain, and scale systems with confidence.
79
+
80
+ ---
81
+
82
+ <h1 style="margin-top: 10px; font-weight:600; font-size: 1.2rem; color:#563d7c;">
83
+ Our Vision
84
+ </h1>
85
+ Dreema aims to redefine backend development by prioritizing both human intuition and AI efficiency. We provide the tools and structured architecture needed to build, maintain, and scale reliable backends that work seamlessly for both developers and AI agents.
86
+
87
+ <h1 style="margin-top: 10px; font-weight:600; font-size: 1.2rem; color:#563d7c;">
88
+ Our Core Architecture
89
+ </h1>
90
+
91
+ <div style=" font-size:0.8rem; line-height:1.7;">
92
+
93
+ <h3 style="color:#563d7c;">1. Enforced MVC Architecture</h3>
94
+ FastAPI is excellent for prototypes, but it lacks structural enforcement — leading to spaghetti code at scale. Dreema mandates a clean <b>Model-View-Controller</b> structure from day one leading to
95
+ <b>Zero Guesswork and AI Efficient </b> as developers and AI agents know where to look.
96
+
97
+ </div >
98
+ </p>
99
+
100
+ ---
101
+
102
+ <h3 style="color:#563d7c;">2 . The Universal Response Contract</h3>
103
+
104
+ System fragility is the enemy of automation. Dreema implements a strict, fixed response schema for every request — internal or external. This provides a predictable contract that AI agents can rely on to diagnose, debug, and self-heal.
105
+
106
+ <table>
107
+ <tr>
108
+ <td width="50%" valign="top">
109
+
110
+ #Success
111
+
112
+ ```json
113
+ {
114
+ "data": { "id": 1, "name": "Jane Doe" },
115
+ "message": "User created successfully",
116
+ "status": 21
117
+ }
118
+ ```
119
+
120
+ </td>
121
+ <td width="50%" valign="top">
122
+
123
+ **Failure**
124
+
125
+ ```json
126
+ {
127
+ "data": null,
128
+ "message": "Validation failed: email required",
129
+ "status": 21
130
+ }
131
+ ```
132
+
133
+ </td>
134
+ </tr>
135
+ </table>
136
+
137
+ No controller-specific error formats. No guessing what shape a failure takes. Every response is machine-readable by design.
138
+
139
+ ---
140
+
141
+ <h3 style="color:#563d7c;">3 . Unified ORM</h3>
142
+
143
+ Stop scaffolding database connections by hand. Dreema includes a powerful, database-agnostic ORM that lets you switch between storage engines.
144
+
145
+ **Write Once, Deploy Anywhere** &nbsp;—&nbsp; Business logic stays decoupled from the storage engine.
146
+
147
+ **Abstraction Done Right** &nbsp;—&nbsp; Dreema manages connections and dialect differences so you focus on your application.
148
+
149
+ ---
150
+
151
+ <h1 style="margin-top: 10px; font-weight:600; font-size: 1.5rem; color:#563d7c;">
152
+ Demo: Perform CRUD in 60seconds
153
+ </h1>
154
+
155
+ **Setup and Installation**
156
+
157
+ ```bash
158
+ # setup and activate virtual environment
159
+ python -m venv venv
160
+ source venv/bin/activate
161
+
162
+ #install dreema
163
+ pip install dreema
164
+
165
+ ```
166
+
167
+ ### Choose Your Style
168
+
169
+ <div>Building high-performance endpoints with Dreema is designed to be intuitive. Choose the approach that fits your project needs.</div>
170
+
171
+ ## Style A - Core Mode (Minimalistic)
172
+
173
+ Best for microservices or simple API routes. This setup provides a single entry point for all your logic.
174
+
175
+ ⚠️ Warning: Not recommended for production; lacks the modularity needed for maintainable, scalable systems.
176
+
177
+ **Create a project**
178
+
179
+ ```bash create dreema project: set --mode to core or full
180
+ dreema create project_name --mode core
181
+ cd project_name
182
+ ```
183
+
184
+ **Create and define routes inside endpoint.py**
185
+
186
+ ```python
187
+
188
+ from dreema.routing import route
189
+ from controllers.usersController import UsersController
190
+
191
+ # routes can also be defined this way
192
+ async def create():
193
+ return {
194
+ 'data': {
195
+ 'name': 'Kweku Dreem'
196
+ },
197
+ "message": "Message sent",
198
+ "status": 20
199
+ }
200
+
201
+ async def welcome():
202
+ return "Welcome to Dreema"
203
+
204
+ # register created route
205
+ routes = [
206
+ # creating single routes
207
+ route.get('/welcome', welcome),
208
+ route.post('/create', create),
209
+ ]
210
+
211
+ ```
212
+
213
+ **Start the server**
214
+
215
+ ```bash
216
+ dreema run .
217
+ ```
218
+
219
+ ## Style B - Installing with full mode (Recommended)
220
+
221
+ **Step 1 &mdash; Create your model**
222
+
223
+ ```bash
224
+ dreema create-model userModel
225
+ ```
226
+
227
+ ```python
228
+ # app/models/user.py
229
+ from dreema.orm import database
230
+
231
+ class UserModel(database.Database):
232
+ # change tablename here
233
+ tablename = 'users'
234
+ ```
235
+
236
+ **Step 2 &mdash; Create your controller**
237
+
238
+ ```bash
239
+ dreema create-controller usersController
240
+ ```
241
+
242
+ ```python
243
+ # app/controllers/users.py
244
+ from dreema import Request
245
+ from app.models.user import UsersModel
246
+
247
+ class UsersController:
248
+
249
+ @staticmethod
250
+ async def createUser(request: Request):
251
+ # Validate the incoming body
252
+ body = await request.apply_rules({
253
+ "name": "string,required",
254
+ "email": "email,required"
255
+ })
256
+
257
+ # Short-circuit on validation failure
258
+ if body.status < 0:
259
+ return body
260
+
261
+ # Create the record
262
+ model = UsersModel()
263
+ user = await User.create({
264
+ "name": body.data.name,
265
+ "email": body.data.email,
266
+ })
267
+
268
+ return user
269
+ ```
270
+
271
+ **Step 2 &mdash; Register endpoint**
272
+
273
+ ```python
274
+ # app/view/endpoint.py
275
+ from dreema.routing import route, routegroup
276
+ import controllers.users as UsersController
277
+
278
+ """
279
+ author: Raphael Djangmah
280
+ Use:
281
+ This file is the main view entry.
282
+ """
283
+ routes = [
284
+ # creating single routes
285
+ route.post('/create-user', UsersController.createUser),
286
+ ]
287
+ ```
288
+
289
+ **Step 5 &mdash; Start the server**
290
+
291
+ ```bash
292
+ dreema run .
293
+ ```
294
+
295
+ **Step 6 &mdash; Call the endpoint**
296
+
297
+ ```bash
298
+ curl -X POST http://localhost:8000/create-user \
299
+ -H "Content-Type: application/json" \
300
+ -d '{"name": "Jane Doe", "email": "jane@example.com"}'
301
+ ```
302
+
303
+ <b>Response — always this shape, always.</b>
304
+
305
+ - If validation failed
306
+
307
+ ```json
308
+ {
309
+ "data": Null,
310
+ "message": "Attribute is missing",
311
+ "status": -30
312
+ }
313
+ ```
314
+
315
+ - If validation succeeded
316
+
317
+ ```json
318
+ {
319
+ "data": { "id": 1, "name": "Jane Doe", "email": "jane@example.com" },
320
+ "message": "Create operation successful",
321
+ "status": 22
322
+ }
323
+ ```
324
+
325
+ Routing, validation, ORM, and response formatting — all handled, all consistent.
326
+
327
+ <div align="center">
328
+
329
+ <img src="https://img.shields.io/badge/Dreema-Convention%20Over%20Configuration-563d7c?style=for-the-badge" alt="Convention Over Configuration" />
330
+
331
+ <!-- <p style="margin-top:1rem;">
332
+ <a href="https://dreem-projects.github.io/dq-docs/v1/" style="color:#563d7c; font-weight:bold;">View Full Documentation</a>
333
+ &nbsp;·&nbsp;
334
+ <a href="v1/" style="color:#563d7c; font-weight:bold;">Current Version (v1)</a>
335
+ </p> -->
336
+
337
+ </div>
dreema-0.1.0/README.md ADDED
@@ -0,0 +1,311 @@
1
+ <div align="center">
2
+
3
+ <img src="https://img.shields.io/badge/Dreema-Python%20Backend-5B3DF5?style=for-the-badge&logo=python" alt="Dreema Python Backend" />
4
+
5
+ <p style="margin:6px 0 10px 0;">
6
+ <img src="https://img.shields.io/badge/Python-3.10+-3776AB?style=flat-square&logo=python&logoColor=white" />
7
+ <img src="https://img.shields.io/badge/License-MIT-22c55e?style=flat-square" />
8
+ <img src="https://img.shields.io/badge/Status-Beta-f59e0b?style=flat-square" />
9
+ <img src="https://img.shields.io/badge/AI--First-Architecture-5B3DF5?style=flat-square" />
10
+ </p>
11
+
12
+ <h1 style="margin: 6px 0 0 0; font-size: 2.5rem; color:#563d7c;">
13
+ Build Backend Systems That Scale
14
+ </h1>
15
+
16
+ <p style="margin:6px 0 14px 0; font-size:1.15rem; font-weight:400; color:#563d7c;">
17
+ • Structure • Consistency • AI-ready systems
18
+ </p>
19
+
20
+ <div align="left" style="max-width:720px; margin:0 auto; font-size:1.1rem; line-height:1.7;">
21
+ <p>
22
+ <b>The current bottleneck in AI development isn't the AI—it’s the architecture.</b>
23
+ </p>
24
+ <p>
25
+ While Large Language Models are exceptional at generating code, the systems they produce are often fragile, inconsistent, and difficult to maintain. Traditional frameworks were built for human-centric workflows, relying on deep tribal knowledge, complex boilerplate, and hidden side effects that confuse AI agents.
26
+ </p>
27
+ <p>
28
+ When frameworks prioritize "magic" over predictability, AI agents struggle to generate code that is production-ready.
29
+ </p>
30
+
31
+ </div>
32
+ </div>
33
+
34
+ ---
35
+
36
+ <h1 style="margin-top: 10px; font-weight:600; font-size: 1.2rem; color:#563d7c;">
37
+ Why Dreema?
38
+ </h1>
39
+
40
+ <p>
41
+ <b>Dreema is a paradigm shift:</b> A Python framework architected specifically to be <i>AI-native</i>. By enforcing strict, predictable design patterns and standardized interfaces, Dreema ensures that AI-generated code is robust, modular, and natively compatible with automated workflows.
42
+ </p>
43
+ <p>
44
+ <b>Stop fighting your framework. Start building with a foundation designed for the future of development using:
45
+ </b>
46
+ </p>
47
+
48
+ - **Dreem's batteries-included** ecosystem featuring ORMs, Middlewares, Plugs, etc.
49
+ - **Enforced Architecture:** Replaces flexible chaos with a deterministic MVC structure.
50
+ - **Universal Error Contract:** Delivers standardized responses that AI agents can reliably parse, debug, and self-heal.
51
+ - **Native AI tools:** Provides developers with AI tools for better developer experience.
52
+ - **Predictable Roadmap:** Provides the structural clarity AI needs to build, maintain, and scale systems with confidence.
53
+
54
+ ---
55
+
56
+ <h1 style="margin-top: 10px; font-weight:600; font-size: 1.2rem; color:#563d7c;">
57
+ Our Vision
58
+ </h1>
59
+ Dreema aims to redefine backend development by prioritizing both human intuition and AI efficiency. We provide the tools and structured architecture needed to build, maintain, and scale reliable backends that work seamlessly for both developers and AI agents.
60
+
61
+ <h1 style="margin-top: 10px; font-weight:600; font-size: 1.2rem; color:#563d7c;">
62
+ Our Core Architecture
63
+ </h1>
64
+
65
+ <div style=" font-size:0.8rem; line-height:1.7;">
66
+
67
+ <h3 style="color:#563d7c;">1. Enforced MVC Architecture</h3>
68
+ FastAPI is excellent for prototypes, but it lacks structural enforcement — leading to spaghetti code at scale. Dreema mandates a clean <b>Model-View-Controller</b> structure from day one leading to
69
+ <b>Zero Guesswork and AI Efficient </b> as developers and AI agents know where to look.
70
+
71
+ </div >
72
+ </p>
73
+
74
+ ---
75
+
76
+ <h3 style="color:#563d7c;">2 . The Universal Response Contract</h3>
77
+
78
+ System fragility is the enemy of automation. Dreema implements a strict, fixed response schema for every request — internal or external. This provides a predictable contract that AI agents can rely on to diagnose, debug, and self-heal.
79
+
80
+ <table>
81
+ <tr>
82
+ <td width="50%" valign="top">
83
+
84
+ #Success
85
+
86
+ ```json
87
+ {
88
+ "data": { "id": 1, "name": "Jane Doe" },
89
+ "message": "User created successfully",
90
+ "status": 21
91
+ }
92
+ ```
93
+
94
+ </td>
95
+ <td width="50%" valign="top">
96
+
97
+ **Failure**
98
+
99
+ ```json
100
+ {
101
+ "data": null,
102
+ "message": "Validation failed: email required",
103
+ "status": 21
104
+ }
105
+ ```
106
+
107
+ </td>
108
+ </tr>
109
+ </table>
110
+
111
+ No controller-specific error formats. No guessing what shape a failure takes. Every response is machine-readable by design.
112
+
113
+ ---
114
+
115
+ <h3 style="color:#563d7c;">3 . Unified ORM</h3>
116
+
117
+ Stop scaffolding database connections by hand. Dreema includes a powerful, database-agnostic ORM that lets you switch between storage engines.
118
+
119
+ **Write Once, Deploy Anywhere** &nbsp;—&nbsp; Business logic stays decoupled from the storage engine.
120
+
121
+ **Abstraction Done Right** &nbsp;—&nbsp; Dreema manages connections and dialect differences so you focus on your application.
122
+
123
+ ---
124
+
125
+ <h1 style="margin-top: 10px; font-weight:600; font-size: 1.5rem; color:#563d7c;">
126
+ Demo: Perform CRUD in 60seconds
127
+ </h1>
128
+
129
+ **Setup and Installation**
130
+
131
+ ```bash
132
+ # setup and activate virtual environment
133
+ python -m venv venv
134
+ source venv/bin/activate
135
+
136
+ #install dreema
137
+ pip install dreema
138
+
139
+ ```
140
+
141
+ ### Choose Your Style
142
+
143
+ <div>Building high-performance endpoints with Dreema is designed to be intuitive. Choose the approach that fits your project needs.</div>
144
+
145
+ ## Style A - Core Mode (Minimalistic)
146
+
147
+ Best for microservices or simple API routes. This setup provides a single entry point for all your logic.
148
+
149
+ ⚠️ Warning: Not recommended for production; lacks the modularity needed for maintainable, scalable systems.
150
+
151
+ **Create a project**
152
+
153
+ ```bash create dreema project: set --mode to core or full
154
+ dreema create project_name --mode core
155
+ cd project_name
156
+ ```
157
+
158
+ **Create and define routes inside endpoint.py**
159
+
160
+ ```python
161
+
162
+ from dreema.routing import route
163
+ from controllers.usersController import UsersController
164
+
165
+ # routes can also be defined this way
166
+ async def create():
167
+ return {
168
+ 'data': {
169
+ 'name': 'Kweku Dreem'
170
+ },
171
+ "message": "Message sent",
172
+ "status": 20
173
+ }
174
+
175
+ async def welcome():
176
+ return "Welcome to Dreema"
177
+
178
+ # register created route
179
+ routes = [
180
+ # creating single routes
181
+ route.get('/welcome', welcome),
182
+ route.post('/create', create),
183
+ ]
184
+
185
+ ```
186
+
187
+ **Start the server**
188
+
189
+ ```bash
190
+ dreema run .
191
+ ```
192
+
193
+ ## Style B - Installing with full mode (Recommended)
194
+
195
+ **Step 1 &mdash; Create your model**
196
+
197
+ ```bash
198
+ dreema create-model userModel
199
+ ```
200
+
201
+ ```python
202
+ # app/models/user.py
203
+ from dreema.orm import database
204
+
205
+ class UserModel(database.Database):
206
+ # change tablename here
207
+ tablename = 'users'
208
+ ```
209
+
210
+ **Step 2 &mdash; Create your controller**
211
+
212
+ ```bash
213
+ dreema create-controller usersController
214
+ ```
215
+
216
+ ```python
217
+ # app/controllers/users.py
218
+ from dreema import Request
219
+ from app.models.user import UsersModel
220
+
221
+ class UsersController:
222
+
223
+ @staticmethod
224
+ async def createUser(request: Request):
225
+ # Validate the incoming body
226
+ body = await request.apply_rules({
227
+ "name": "string,required",
228
+ "email": "email,required"
229
+ })
230
+
231
+ # Short-circuit on validation failure
232
+ if body.status < 0:
233
+ return body
234
+
235
+ # Create the record
236
+ model = UsersModel()
237
+ user = await User.create({
238
+ "name": body.data.name,
239
+ "email": body.data.email,
240
+ })
241
+
242
+ return user
243
+ ```
244
+
245
+ **Step 2 &mdash; Register endpoint**
246
+
247
+ ```python
248
+ # app/view/endpoint.py
249
+ from dreema.routing import route, routegroup
250
+ import controllers.users as UsersController
251
+
252
+ """
253
+ author: Raphael Djangmah
254
+ Use:
255
+ This file is the main view entry.
256
+ """
257
+ routes = [
258
+ # creating single routes
259
+ route.post('/create-user', UsersController.createUser),
260
+ ]
261
+ ```
262
+
263
+ **Step 5 &mdash; Start the server**
264
+
265
+ ```bash
266
+ dreema run .
267
+ ```
268
+
269
+ **Step 6 &mdash; Call the endpoint**
270
+
271
+ ```bash
272
+ curl -X POST http://localhost:8000/create-user \
273
+ -H "Content-Type: application/json" \
274
+ -d '{"name": "Jane Doe", "email": "jane@example.com"}'
275
+ ```
276
+
277
+ <b>Response — always this shape, always.</b>
278
+
279
+ - If validation failed
280
+
281
+ ```json
282
+ {
283
+ "data": Null,
284
+ "message": "Attribute is missing",
285
+ "status": -30
286
+ }
287
+ ```
288
+
289
+ - If validation succeeded
290
+
291
+ ```json
292
+ {
293
+ "data": { "id": 1, "name": "Jane Doe", "email": "jane@example.com" },
294
+ "message": "Create operation successful",
295
+ "status": 22
296
+ }
297
+ ```
298
+
299
+ Routing, validation, ORM, and response formatting — all handled, all consistent.
300
+
301
+ <div align="center">
302
+
303
+ <img src="https://img.shields.io/badge/Dreema-Convention%20Over%20Configuration-563d7c?style=for-the-badge" alt="Convention Over Configuration" />
304
+
305
+ <!-- <p style="margin-top:1rem;">
306
+ <a href="https://dreem-projects.github.io/dq-docs/v1/" style="color:#563d7c; font-weight:bold;">View Full Documentation</a>
307
+ &nbsp;·&nbsp;
308
+ <a href="v1/" style="color:#563d7c; font-weight:bold;">Current Version (v1)</a>
309
+ </p> -->
310
+
311
+ </div>
File without changes
@@ -0,0 +1,9 @@
1
+ APP = {
2
+ "name": "dreema",
3
+ "version": "0.1.0",
4
+ "description": "Dreema is a powerful and flexible framework for building web applications with ease. It provides a robust set of tools and features to help developers create scalable and maintainable applications quickly.",
5
+ "author": "Raphal Djangmah",
6
+ "license": "MIT",
7
+ "requires-python": ">=3.11.0",
8
+ "templateBreakTrace": [False]
9
+ }