nexus-framework 0.2.2__tar.gz → 0.2.3__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 (291) hide show
  1. nexus_framework-0.2.3/PKG-INFO +1165 -0
  2. nexus_framework-0.2.3/README.md +1117 -0
  3. nexus_framework-0.2.3/pyproject.toml +95 -0
  4. nexus_framework-0.2.3/setup.cfg +4 -0
  5. nexus_framework-0.2.3/src/nexus/__init__.py +3 -0
  6. nexus_framework-0.2.3/src/nexus/application.py +5 -0
  7. nexus_framework-0.2.3/src/nexus/auth/__init__.py +35 -0
  8. nexus_framework-0.2.3/src/nexus/auth/access/gate.py +119 -0
  9. nexus_framework-0.2.3/src/nexus/auth/auth_service_provider.py +22 -0
  10. nexus_framework-0.2.3/src/nexus/auth/authenticatable.py +30 -0
  11. nexus_framework-0.2.3/src/nexus/auth/guard.py +214 -0
  12. nexus_framework-0.2.3/src/nexus/auth/hashing.py +143 -0
  13. nexus_framework-0.2.3/src/nexus/auth/manager.py +134 -0
  14. nexus_framework-0.2.3/src/nexus/auth/middleware.py +68 -0
  15. nexus_framework-0.2.3/src/nexus/auth/sanctum/__init__.py +25 -0
  16. nexus_framework-0.2.3/src/nexus/auth/sanctum/guard.py +123 -0
  17. nexus_framework-0.2.3/src/nexus/auth/sanctum/has_api_tokens.py +85 -0
  18. nexus_framework-0.2.3/src/nexus/auth/sanctum/middleware.py +93 -0
  19. nexus_framework-0.2.3/src/nexus/auth/sanctum/migration.py +47 -0
  20. nexus_framework-0.2.3/src/nexus/auth/sanctum/new_access_token.py +22 -0
  21. nexus_framework-0.2.3/src/nexus/auth/sanctum/personal_access_token.py +124 -0
  22. nexus_framework-0.2.3/src/nexus/auth/user_provider.py +67 -0
  23. nexus_framework-0.2.3/src/nexus/cache/__init__.py +16 -0
  24. nexus_framework-0.2.3/src/nexus/cache/cache_service_provider.py +18 -0
  25. nexus_framework-0.2.3/src/nexus/cache/driver.py +274 -0
  26. nexus_framework-0.2.3/src/nexus/cache/manager.py +111 -0
  27. nexus_framework-0.2.3/src/nexus/cache/store.py +176 -0
  28. nexus_framework-0.2.3/src/nexus/config/__init__.py +5 -0
  29. nexus_framework-0.2.3/src/nexus/config/repository.py +106 -0
  30. nexus_framework-0.2.3/src/nexus/console/__init__.py +11 -0
  31. nexus_framework-0.2.3/src/nexus/console/cli.py +26 -0
  32. nexus_framework-0.2.3/src/nexus/console/command.py +67 -0
  33. nexus_framework-0.2.3/src/nexus/console/commands/__init__.py +31 -0
  34. nexus_framework-0.2.3/src/nexus/console/commands/clear.py +57 -0
  35. nexus_framework-0.2.3/src/nexus/console/commands/config.py +287 -0
  36. nexus_framework-0.2.3/src/nexus/console/commands/database.py +167 -0
  37. nexus_framework-0.2.3/src/nexus/console/commands/key_generate.py +71 -0
  38. nexus_framework-0.2.3/src/nexus/console/commands/make.py +199 -0
  39. nexus_framework-0.2.3/src/nexus/console/commands/new_command.py +104 -0
  40. nexus_framework-0.2.3/src/nexus/console/commands/queue.py +107 -0
  41. nexus_framework-0.2.3/src/nexus/console/commands/route_list.py +64 -0
  42. nexus_framework-0.2.3/src/nexus/console/commands/schedule.py +81 -0
  43. nexus_framework-0.2.3/src/nexus/console/commands/serve.py +50 -0
  44. nexus_framework-0.2.3/src/nexus/console/commands/starter.py +60 -0
  45. nexus_framework-0.2.3/src/nexus/console/commands/tinker.py +58 -0
  46. nexus_framework-0.2.3/src/nexus/console/console_service_provider.py +19 -0
  47. nexus_framework-0.2.3/src/nexus/console/generators/__init__.py +43 -0
  48. nexus_framework-0.2.3/src/nexus/console/generators/stubs.py +772 -0
  49. nexus_framework-0.2.3/src/nexus/console/kernel.py +144 -0
  50. nexus_framework-0.2.3/src/nexus/container/__init__.py +6 -0
  51. nexus_framework-0.2.3/src/nexus/container/container.py +227 -0
  52. nexus_framework-0.2.3/src/nexus/container/exceptions.py +9 -0
  53. nexus_framework-0.2.3/src/nexus/database/__init__.py +44 -0
  54. nexus_framework-0.2.3/src/nexus/database/connection.py +115 -0
  55. nexus_framework-0.2.3/src/nexus/database/database_service_provider.py +28 -0
  56. nexus_framework-0.2.3/src/nexus/database/factory.py +143 -0
  57. nexus_framework-0.2.3/src/nexus/database/migrations/__init__.py +9 -0
  58. nexus_framework-0.2.3/src/nexus/database/migrations/migration.py +13 -0
  59. nexus_framework-0.2.3/src/nexus/database/migrations/migrator.py +145 -0
  60. nexus_framework-0.2.3/src/nexus/database/models/__init__.py +25 -0
  61. nexus_framework-0.2.3/src/nexus/database/models/exceptions.py +19 -0
  62. nexus_framework-0.2.3/src/nexus/database/models/model.py +921 -0
  63. nexus_framework-0.2.3/src/nexus/database/models/relations/__init__.py +15 -0
  64. nexus_framework-0.2.3/src/nexus/database/models/relations/base.py +36 -0
  65. nexus_framework-0.2.3/src/nexus/database/models/relations/belongs_to.py +50 -0
  66. nexus_framework-0.2.3/src/nexus/database/models/relations/belongs_to_many.py +93 -0
  67. nexus_framework-0.2.3/src/nexus/database/models/relations/has_many.py +43 -0
  68. nexus_framework-0.2.3/src/nexus/database/models/relations/has_one.py +42 -0
  69. nexus_framework-0.2.3/src/nexus/database/models/soft_deletes.py +38 -0
  70. nexus_framework-0.2.3/src/nexus/database/query/builder.py +506 -0
  71. nexus_framework-0.2.3/src/nexus/database/schema/__init__.py +10 -0
  72. nexus_framework-0.2.3/src/nexus/database/schema/blueprint.py +202 -0
  73. nexus_framework-0.2.3/src/nexus/database/schema/schema.py +90 -0
  74. nexus_framework-0.2.3/src/nexus/database/seeder.py +32 -0
  75. nexus_framework-0.2.3/src/nexus/events/__init__.py +8 -0
  76. nexus_framework-0.2.3/src/nexus/events/dispatcher.py +110 -0
  77. nexus_framework-0.2.3/src/nexus/events/event_service_provider.py +17 -0
  78. nexus_framework-0.2.3/src/nexus/exceptions/__init__.py +7 -0
  79. nexus_framework-0.2.3/src/nexus/exceptions/exception_service_provider.py +17 -0
  80. nexus_framework-0.2.3/src/nexus/exceptions/handler.py +379 -0
  81. nexus_framework-0.2.3/src/nexus/facades/__init__.py +62 -0
  82. nexus_framework-0.2.3/src/nexus/facades/app.py +11 -0
  83. nexus_framework-0.2.3/src/nexus/facades/artisan.py +28 -0
  84. nexus_framework-0.2.3/src/nexus/facades/auth.py +73 -0
  85. nexus_framework-0.2.3/src/nexus/facades/cache.py +90 -0
  86. nexus_framework-0.2.3/src/nexus/facades/config.py +11 -0
  87. nexus_framework-0.2.3/src/nexus/facades/date.py +40 -0
  88. nexus_framework-0.2.3/src/nexus/facades/db.py +45 -0
  89. nexus_framework-0.2.3/src/nexus/facades/event.py +83 -0
  90. nexus_framework-0.2.3/src/nexus/facades/facade.py +104 -0
  91. nexus_framework-0.2.3/src/nexus/facades/gate.py +51 -0
  92. nexus_framework-0.2.3/src/nexus/facades/hash.py +33 -0
  93. nexus_framework-0.2.3/src/nexus/facades/inertia.py +62 -0
  94. nexus_framework-0.2.3/src/nexus/facades/log.py +83 -0
  95. nexus_framework-0.2.3/src/nexus/facades/mail.py +89 -0
  96. nexus_framework-0.2.3/src/nexus/facades/notification.py +69 -0
  97. nexus_framework-0.2.3/src/nexus/facades/queue.py +104 -0
  98. nexus_framework-0.2.3/src/nexus/facades/rate_limiter.py +13 -0
  99. nexus_framework-0.2.3/src/nexus/facades/request.py +18 -0
  100. nexus_framework-0.2.3/src/nexus/facades/route.py +13 -0
  101. nexus_framework-0.2.3/src/nexus/facades/schedule.py +51 -0
  102. nexus_framework-0.2.3/src/nexus/facades/schema.py +56 -0
  103. nexus_framework-0.2.3/src/nexus/facades/session.py +29 -0
  104. nexus_framework-0.2.3/src/nexus/facades/storage.py +108 -0
  105. nexus_framework-0.2.3/src/nexus/facades/telescope.py +44 -0
  106. nexus_framework-0.2.3/src/nexus/facades/url.py +44 -0
  107. nexus_framework-0.2.3/src/nexus/facades/validator.py +37 -0
  108. nexus_framework-0.2.3/src/nexus/facades/view.py +42 -0
  109. nexus_framework-0.2.3/src/nexus/filesystem/__init__.py +11 -0
  110. nexus_framework-0.2.3/src/nexus/filesystem/driver.py +245 -0
  111. nexus_framework-0.2.3/src/nexus/filesystem/filesystem_service_provider.py +18 -0
  112. nexus_framework-0.2.3/src/nexus/filesystem/manager.py +104 -0
  113. nexus_framework-0.2.3/src/nexus/foundation/__init__.py +7 -0
  114. nexus_framework-0.2.3/src/nexus/foundation/application.py +380 -0
  115. nexus_framework-0.2.3/src/nexus/foundation/provider.py +24 -0
  116. nexus_framework-0.2.3/src/nexus/foundation/runner.py +46 -0
  117. nexus_framework-0.2.3/src/nexus/foundation/service_provider.py +5 -0
  118. nexus_framework-0.2.3/src/nexus/http/__init__.py +45 -0
  119. nexus_framework-0.2.3/src/nexus/http/exceptions.py +82 -0
  120. nexus_framework-0.2.3/src/nexus/http/middleware.py +77 -0
  121. nexus_framework-0.2.3/src/nexus/http/request.py +258 -0
  122. nexus_framework-0.2.3/src/nexus/http/requests/__init__.py +5 -0
  123. nexus_framework-0.2.3/src/nexus/http/requests/form_request.py +101 -0
  124. nexus_framework-0.2.3/src/nexus/http/resources/__init__.py +8 -0
  125. nexus_framework-0.2.3/src/nexus/http/resources/json_resource.py +117 -0
  126. nexus_framework-0.2.3/src/nexus/http/resources/resource_collection.py +127 -0
  127. nexus_framework-0.2.3/src/nexus/http/response.py +246 -0
  128. nexus_framework-0.2.3/src/nexus/http/uploaded_file.py +44 -0
  129. nexus_framework-0.2.3/src/nexus/inertia/__init__.py +20 -0
  130. nexus_framework-0.2.3/src/nexus/inertia/helpers.py +23 -0
  131. nexus_framework-0.2.3/src/nexus/inertia/inertia.py +65 -0
  132. nexus_framework-0.2.3/src/nexus/inertia/inertia_service_provider.py +15 -0
  133. nexus_framework-0.2.3/src/nexus/inertia/lazy.py +16 -0
  134. nexus_framework-0.2.3/src/nexus/inertia/middleware.py +47 -0
  135. nexus_framework-0.2.3/src/nexus/inertia/response.py +141 -0
  136. nexus_framework-0.2.3/src/nexus/logging/__init__.py +7 -0
  137. nexus_framework-0.2.3/src/nexus/logging/logging_service_provider.py +20 -0
  138. nexus_framework-0.2.3/src/nexus/logging/manager.py +308 -0
  139. nexus_framework-0.2.3/src/nexus/mail/__init__.py +15 -0
  140. nexus_framework-0.2.3/src/nexus/mail/mail_service_provider.py +17 -0
  141. nexus_framework-0.2.3/src/nexus/mail/mailable.py +100 -0
  142. nexus_framework-0.2.3/src/nexus/mail/manager.py +163 -0
  143. nexus_framework-0.2.3/src/nexus/mail/transport.py +90 -0
  144. nexus_framework-0.2.3/src/nexus/notifications/__init__.py +9 -0
  145. nexus_framework-0.2.3/src/nexus/notifications/manager.py +70 -0
  146. nexus_framework-0.2.3/src/nexus/notifications/notification.py +32 -0
  147. nexus_framework-0.2.3/src/nexus/notifications/notification_service_provider.py +17 -0
  148. nexus_framework-0.2.3/src/nexus/queue/__init__.py +18 -0
  149. nexus_framework-0.2.3/src/nexus/queue/driver.py +204 -0
  150. nexus_framework-0.2.3/src/nexus/queue/job.py +128 -0
  151. nexus_framework-0.2.3/src/nexus/queue/manager.py +84 -0
  152. nexus_framework-0.2.3/src/nexus/queue/queue_service_provider.py +18 -0
  153. nexus_framework-0.2.3/src/nexus/queue/worker.py +141 -0
  154. nexus_framework-0.2.3/src/nexus/routing/__init__.py +7 -0
  155. nexus_framework-0.2.3/src/nexus/routing/limiter.py +64 -0
  156. nexus_framework-0.2.3/src/nexus/routing/route.py +133 -0
  157. nexus_framework-0.2.3/src/nexus/routing/router.py +356 -0
  158. nexus_framework-0.2.3/src/nexus/routing/throttle.py +54 -0
  159. nexus_framework-0.2.3/src/nexus/routing/url.py +152 -0
  160. nexus_framework-0.2.3/src/nexus/schedule/__init__.py +9 -0
  161. nexus_framework-0.2.3/src/nexus/schedule/event.py +254 -0
  162. nexus_framework-0.2.3/src/nexus/schedule/schedule.py +58 -0
  163. nexus_framework-0.2.3/src/nexus/schedule/schedule_service_provider.py +17 -0
  164. nexus_framework-0.2.3/src/nexus/security/__init__.py +13 -0
  165. nexus_framework-0.2.3/src/nexus/security/cors.py +86 -0
  166. nexus_framework-0.2.3/src/nexus/security/csrf.py +74 -0
  167. nexus_framework-0.2.3/src/nexus/security/headers.py +65 -0
  168. nexus_framework-0.2.3/src/nexus/session/__init__.py +25 -0
  169. nexus_framework-0.2.3/src/nexus/session/driver.py +176 -0
  170. nexus_framework-0.2.3/src/nexus/session/manager.py +69 -0
  171. nexus_framework-0.2.3/src/nexus/session/middleware.py +73 -0
  172. nexus_framework-0.2.3/src/nexus/session/session.py +133 -0
  173. nexus_framework-0.2.3/src/nexus/session/session_service_provider.py +14 -0
  174. nexus_framework-0.2.3/src/nexus/starters/__init__.py +15 -0
  175. nexus_framework-0.2.3/src/nexus/starters/api.py +220 -0
  176. nexus_framework-0.2.3/src/nexus/starters/inertia.py +244 -0
  177. nexus_framework-0.2.3/src/nexus/starters/openapi.py +137 -0
  178. nexus_framework-0.2.3/src/nexus/starters/standard.py +994 -0
  179. nexus_framework-0.2.3/src/nexus/starters/web.py +400 -0
  180. nexus_framework-0.2.3/src/nexus/support/__init__.py +27 -0
  181. nexus_framework-0.2.3/src/nexus/support/arr.py +208 -0
  182. nexus_framework-0.2.3/src/nexus/support/carbon.py +442 -0
  183. nexus_framework-0.2.3/src/nexus/support/collection.py +393 -0
  184. nexus_framework-0.2.3/src/nexus/support/env.py +61 -0
  185. nexus_framework-0.2.3/src/nexus/support/helpers.py +68 -0
  186. nexus_framework-0.2.3/src/nexus/support/str.py +327 -0
  187. nexus_framework-0.2.3/src/nexus/telescope/__init__.py +20 -0
  188. nexus_framework-0.2.3/src/nexus/telescope/debugbar.py +130 -0
  189. nexus_framework-0.2.3/src/nexus/telescope/entry.py +70 -0
  190. nexus_framework-0.2.3/src/nexus/telescope/middleware.py +168 -0
  191. nexus_framework-0.2.3/src/nexus/telescope/telescope.py +69 -0
  192. nexus_framework-0.2.3/src/nexus/telescope/telescope_service_provider.py +15 -0
  193. nexus_framework-0.2.3/src/nexus/testing/__init__.py +38 -0
  194. nexus_framework-0.2.3/src/nexus/testing/client.py +450 -0
  195. nexus_framework-0.2.3/src/nexus/testing/database.py +88 -0
  196. nexus_framework-0.2.3/src/nexus/testing/fakes/__init__.py +21 -0
  197. nexus_framework-0.2.3/src/nexus/testing/fakes/event_fake.py +96 -0
  198. nexus_framework-0.2.3/src/nexus/testing/fakes/log_fake.py +140 -0
  199. nexus_framework-0.2.3/src/nexus/testing/fakes/mail_fake.py +139 -0
  200. nexus_framework-0.2.3/src/nexus/testing/fakes/notification_fake.py +104 -0
  201. nexus_framework-0.2.3/src/nexus/testing/fakes/queue_fake.py +168 -0
  202. nexus_framework-0.2.3/src/nexus/testing/fakes/storage_fake.py +25 -0
  203. nexus_framework-0.2.3/src/nexus/testing/response.py +339 -0
  204. nexus_framework-0.2.3/src/nexus/testing/test_case.py +98 -0
  205. nexus_framework-0.2.3/src/nexus/testing/time.py +117 -0
  206. nexus_framework-0.2.3/src/nexus/validation/__init__.py +8 -0
  207. nexus_framework-0.2.3/src/nexus/validation/rule.py +18 -0
  208. nexus_framework-0.2.3/src/nexus/validation/validation_service_provider.py +17 -0
  209. nexus_framework-0.2.3/src/nexus/validation/validator.py +518 -0
  210. nexus_framework-0.2.3/src/nexus/view/__init__.py +24 -0
  211. nexus_framework-0.2.3/src/nexus/view/compiler.py +166 -0
  212. nexus_framework-0.2.3/src/nexus/view/factory.py +213 -0
  213. nexus_framework-0.2.3/src/nexus/view/view_service_provider.py +14 -0
  214. nexus_framework-0.2.3/src/nexus_framework.egg-info/PKG-INFO +1165 -0
  215. nexus_framework-0.2.3/src/nexus_framework.egg-info/SOURCES.txt +218 -0
  216. nexus_framework-0.2.3/src/nexus_framework.egg-info/dependency_links.txt +1 -0
  217. nexus_framework-0.2.3/src/nexus_framework.egg-info/entry_points.txt +2 -0
  218. nexus_framework-0.2.3/src/nexus_framework.egg-info/requires.txt +24 -0
  219. nexus_framework-0.2.3/src/nexus_framework.egg-info/top_level.txt +1 -0
  220. nexus_framework-0.2.2/.gitignore +0 -56
  221. nexus_framework-0.2.2/LICENSE +0 -21
  222. nexus_framework-0.2.2/PKG-INFO +0 -213
  223. nexus_framework-0.2.2/README.md +0 -138
  224. nexus_framework-0.2.2/nexus/__init__.py +0 -218
  225. nexus_framework-0.2.2/nexus/ai/__init__.py +0 -39
  226. nexus_framework-0.2.2/nexus/ai/agent.py +0 -178
  227. nexus_framework-0.2.2/nexus/ai/decorator.py +0 -130
  228. nexus_framework-0.2.2/nexus/ai/llm.py +0 -455
  229. nexus_framework-0.2.2/nexus/ai/memory.py +0 -66
  230. nexus_framework-0.2.2/nexus/ai/prompt.py +0 -50
  231. nexus_framework-0.2.2/nexus/ai/rag.py +0 -108
  232. nexus_framework-0.2.2/nexus/ai/vector.py +0 -197
  233. nexus_framework-0.2.2/nexus/cli.py +0 -614
  234. nexus_framework-0.2.2/nexus/config/__init__.py +0 -5
  235. nexus_framework-0.2.2/nexus/config/settings.py +0 -98
  236. nexus_framework-0.2.2/nexus/core/__init__.py +0 -1
  237. nexus_framework-0.2.2/nexus/core/entities/__init__.py +0 -348
  238. nexus_framework-0.2.2/nexus/core/exceptions/__init__.py +0 -314
  239. nexus_framework-0.2.2/nexus/core/interfaces/__init__.py +0 -69
  240. nexus_framework-0.2.2/nexus/core/jwt.py +0 -145
  241. nexus_framework-0.2.2/nexus/data/__init__.py +0 -30
  242. nexus_framework-0.2.2/nexus/data/frame.py +0 -406
  243. nexus_framework-0.2.2/nexus/data/loader.py +0 -277
  244. nexus_framework-0.2.2/nexus/data/pipeline.py +0 -190
  245. nexus_framework-0.2.2/nexus/data/sink.py +0 -220
  246. nexus_framework-0.2.2/nexus/data/testing.py +0 -193
  247. nexus_framework-0.2.2/nexus/db/__init__.py +0 -67
  248. nexus_framework-0.2.2/nexus/db/auto.py +0 -123
  249. nexus_framework-0.2.2/nexus/db/expert.py +0 -146
  250. nexus_framework-0.2.2/nexus/db/magic.py +0 -335
  251. nexus_framework-0.2.2/nexus/db/model.py +0 -684
  252. nexus_framework-0.2.2/nexus/db/session.py +0 -231
  253. nexus_framework-0.2.2/nexus/db/sync.py +0 -41
  254. nexus_framework-0.2.2/nexus/deployment.py +0 -191
  255. nexus_framework-0.2.2/nexus/logging/__init__.py +0 -5
  256. nexus_framework-0.2.2/nexus/logging/logger.py +0 -65
  257. nexus_framework-0.2.2/nexus/magic/__init__.py +0 -27
  258. nexus_framework-0.2.2/nexus/magic/injector.py +0 -307
  259. nexus_framework-0.2.2/nexus/magic/introspect.py +0 -122
  260. nexus_framework-0.2.2/nexus/observability.py +0 -593
  261. nexus_framework-0.2.2/nexus/plugins/__init__.py +0 -206
  262. nexus_framework-0.2.2/nexus/scaffolding.py +0 -1010
  263. nexus_framework-0.2.2/nexus/testing.py +0 -592
  264. nexus_framework-0.2.2/nexus/web/__init__.py +0 -116
  265. nexus_framework-0.2.2/nexus/web/app.py +0 -958
  266. nexus_framework-0.2.2/nexus/web/asgi.py +0 -227
  267. nexus_framework-0.2.2/nexus/web/auth.py +0 -643
  268. nexus_framework-0.2.2/nexus/web/background.py +0 -59
  269. nexus_framework-0.2.2/nexus/web/cookies.py +0 -70
  270. nexus_framework-0.2.2/nexus/web/debugger.py +0 -551
  271. nexus_framework-0.2.2/nexus/web/idempotency.py +0 -74
  272. nexus_framework-0.2.2/nexus/web/lifespan.py +0 -78
  273. nexus_framework-0.2.2/nexus/web/middlewares.py +0 -480
  274. nexus_framework-0.2.2/nexus/web/openapi.py +0 -216
  275. nexus_framework-0.2.2/nexus/web/pagination.py +0 -81
  276. nexus_framework-0.2.2/nexus/web/router.py +0 -579
  277. nexus_framework-0.2.2/nexus/web/security.py +0 -84
  278. nexus_framework-0.2.2/nexus/web/session.py +0 -349
  279. nexus_framework-0.2.2/nexus/web/sse.py +0 -120
  280. nexus_framework-0.2.2/nexus/web/staticfiles.py +0 -146
  281. nexus_framework-0.2.2/nexus/web/template/__init__.py +0 -18
  282. nexus_framework-0.2.2/nexus/web/template/compiler.py +0 -198
  283. nexus_framework-0.2.2/nexus/web/template/engine.py +0 -133
  284. nexus_framework-0.2.2/nexus/web/template/filters.py +0 -133
  285. nexus_framework-0.2.2/nexus/web/template/lexer.py +0 -170
  286. nexus_framework-0.2.2/nexus/web/template/parser.py +0 -356
  287. nexus_framework-0.2.2/nexus/web/upload.py +0 -68
  288. nexus_framework-0.2.2/nexus/web/validation.py +0 -242
  289. nexus_framework-0.2.2/nexus/web/websocket.py +0 -120
  290. nexus_framework-0.2.2/pyproject.toml +0 -166
  291. {nexus_framework-0.2.2 → nexus_framework-0.2.3/src}/nexus/py.typed +0 -0
@@ -0,0 +1,1165 @@
1
+ Metadata-Version: 2.4
2
+ Name: nexus-framework
3
+ Version: 0.2.3
4
+ Summary: An expressive, batteries-included asynchronous web framework for Python inspired by Laravel.
5
+ Author-email: Nexus Core Team <core@nexus-framework.org>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/nexus-framework/nexus
8
+ Project-URL: Documentation, https://github.com/nexus-framework/nexus#readme
9
+ Project-URL: Repository, https://github.com/nexus-framework/nexus.git
10
+ Project-URL: Issues, https://github.com/nexus-framework/nexus/issues
11
+ Keywords: laravel,python,framework,asyncio,eloquent,blade,artisan,asgi,web,starlette,uvicorn
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Internet :: WWW/HTTP
19
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
20
+ Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
21
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
22
+ Classifier: Framework :: AsyncIO
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.11
25
+ Description-Content-Type: text/markdown
26
+ Requires-Dist: starlette>=0.37.0
27
+ Requires-Dist: uvicorn[standard]>=0.29.0
28
+ Requires-Dist: sqlalchemy>=2.0.29
29
+ Requires-Dist: pydantic>=2.6.4
30
+ Requires-Dist: pydantic-settings>=2.2.1
31
+ Requires-Dist: typer>=0.12.0
32
+ Requires-Dist: rich>=13.7.0
33
+ Requires-Dist: jinja2>=3.1.3
34
+ Requires-Dist: python-dotenv>=1.0.1
35
+ Requires-Dist: python-multipart>=0.0.9
36
+ Requires-Dist: anyio>=4.3.0
37
+ Requires-Dist: faker>=24.0.0
38
+ Provides-Extra: dev
39
+ Requires-Dist: pytest>=8.1.0; extra == "dev"
40
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
41
+ Requires-Dist: httpx>=0.27.0; extra == "dev"
42
+ Requires-Dist: ruff>=0.3.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.9.0; extra == "dev"
44
+ Requires-Dist: build>=1.0.0; extra == "dev"
45
+ Requires-Dist: twine>=5.0.0; extra == "dev"
46
+ Provides-Extra: docs
47
+ Requires-Dist: mkdocs-material>=9.5.0; extra == "docs"
48
+
49
+ # Nexus Framework
50
+
51
+ An expressive, batteries-included, asynchronous web framework for Python, bringing the developer ergonomics, convention-over-configuration mindset, and rapid application development of Laravel to modern Python.
52
+
53
+ ---
54
+
55
+ ## Architecture & Features
56
+
57
+ - **Dual-Mode ASGI Engine:** Async-first performance with transparent support for synchronous handlers.
58
+ - **IoC Container & Auto-Wiring:** Type-hinted dependency injection, singleton management, and circular dependency protection.
59
+ - **Service Providers:** Two-phase (`register` and `boot`) modular service lifecycle.
60
+ - **Context-Safe Facades:** Static-like access (`App`, `Route`, `DB`, `Auth`) powered by Python's `contextvars` for safe concurrent request isolation.
61
+ - **Eloquent-style Active Record:** Fluent query builder and models backed by SQLAlchemy Core.
62
+ - **Artisan-inspired CLI:** Code generators (`make:*`), dev server (`serve`), and interactive shell (`tinker`).
63
+
64
+ ---
65
+
66
+ ## Installation & Development Setup
67
+
68
+ Clone the repository and set up your Python 3.12+ virtual environment:
69
+
70
+ ```bash
71
+ # Create virtual environment
72
+ python -m venv .venv
73
+
74
+ # Activate virtual environment
75
+ # Windows:
76
+ .\.venv\Scripts\Activate.ps1
77
+ # Unix/macOS:
78
+ source .venv/bin/activate
79
+
80
+ # Install in editable mode with development dependencies
81
+ pip install -e ".[dev]"
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Running Quality Checks & Tests
87
+
88
+ ```bash
89
+ # Run test suite
90
+ pytest
91
+
92
+ # Run static type checking
93
+ mypy src
94
+
95
+ # Run linter and formatting checks
96
+ ruff check src tests
97
+ ```
98
+
99
+ ---
100
+
101
+ ## Core Usage Examples
102
+
103
+ ### 1. Inversion of Control (IoC) Container & Auto-Wiring
104
+
105
+ ```python
106
+ from nexus.container import Container
107
+
108
+ container = Container()
109
+
110
+ class Database:
111
+ pass
112
+
113
+ class UserRepository:
114
+ def __init__(self, db: Database) -> None:
115
+ self.db = db
116
+
117
+ # Register singleton
118
+ container.singleton(Database)
119
+
120
+ # Auto-wires Database into UserRepository automatically
121
+ repo = container.make(UserRepository)
122
+ assert isinstance(repo.db, Database)
123
+ ```
124
+
125
+ ### 2. Service Provider Lifecycle
126
+
127
+ ```python
128
+ from nexus.application import Application
129
+ from nexus.foundation.provider import ServiceProvider
130
+
131
+ class AppServiceProvider(ServiceProvider):
132
+ def register(self) -> None:
133
+ # Register services & bindings
134
+ self.app.singleton("payment_gateway", lambda app: StripeGateway())
135
+
136
+ def boot(self) -> None:
137
+ # Execute startup configurations
138
+ pass
139
+
140
+ app = Application(base_path=".")
141
+ app.register_provider(AppServiceProvider)
142
+ app.boot_providers()
143
+ ```
144
+
145
+ ### 3. Context-Safe Facades & Config
146
+
147
+ ```python
148
+ from nexus.facades import App, Config, Log
149
+ from nexus.support.env import env
150
+
151
+ # Type-cast environment variable
152
+ debug_mode = env("APP_DEBUG", False)
153
+
154
+ # Static access to configuration and application
155
+ app_name = Config.get("app.name", "Nexus")
156
+ Config.set("app.env", "production")
157
+
158
+ # Static logging
159
+ Log.info("Application configured and ready")
160
+ ```
161
+
162
+ ### 4. Dual-Mode Handler Runner (Sync & Async)
163
+
164
+ ```python
165
+ from nexus.foundation.runner import HandlerRunner
166
+
167
+ runner = HandlerRunner()
168
+
169
+ # Automatically awaits asynchronous coroutines on event loop
170
+ async def async_handler():
171
+ return {"mode": "async"}
172
+
173
+ # Automatically offloads synchronous functions to worker threadpool
174
+ def sync_handler():
175
+ return {"mode": "sync"}
176
+
177
+ await runner.run(async_handler)
178
+ await runner.run(sync_handler)
179
+ ```
180
+
181
+ ### 5. Fluent Routing & Route Groups
182
+
183
+ ```python
184
+ from nexus.facades import Route
185
+
186
+ # Basic routes with parameter regex constraints
187
+ Route.get("/users/{id}", lambda id: {"user_id": id}).where_number("id")
188
+
189
+ # Route groups with shared prefix and middleware
190
+ Route.group({"prefix": "api/v1"}, lambda: [
191
+ Route.get("/status", lambda: {"active": True}),
192
+ Route.post("/posts", lambda: {"created": True}),
193
+ ])
194
+
195
+ # RESTful resource routing
196
+ Route.resource("photos", PhotoController)
197
+ ```
198
+
199
+ ### 6. Declarative Form Requests & Input Validation
200
+
201
+ ```python
202
+ from pydantic import BaseModel
203
+ from nexus.http.requests import FormRequest
204
+
205
+ class UserSchema(BaseModel):
206
+ name: str
207
+ email: str
208
+ age: int
209
+
210
+ class StoreUserRequest(FormRequest):
211
+ def rules(self):
212
+ return UserSchema
213
+
214
+ # Type-hinted in controller: automatically validates before executing!
215
+ def store(form: StoreUserRequest):
216
+ data = form.validated()
217
+ return {"user": data["name"]}
218
+ ```
219
+
220
+ ### 7. Middleware Pipeline & Rate Limiting
221
+
222
+ ```python
223
+ from nexus.http.middleware import Middleware
224
+ from nexus.routing.throttle import ThrottleRequests
225
+
226
+ class SecurityHeadersMiddleware(Middleware):
227
+ async def handle(self, request, next_handler):
228
+ response = await next_handler(request)
229
+ response.header("X-Frame-Options", "DENY")
230
+ return response
231
+
232
+ # Attach route-level rate limiting (e.g. 60 requests per minute)
233
+ Route.get("/api/data", lambda: {"data": []}).middleware(
234
+ ThrottleRequests(max_attempts=60, decay_seconds=60)
235
+ )
236
+ ```
237
+
238
+ ### 8. Eloquent Active Record Models & Relationships
239
+
240
+ ```python
241
+ from typing import ClassVar
242
+ from nexus.database.models import Model, SoftDeletes
243
+ from nexus.database.models.relations import BelongsTo, HasMany
244
+
245
+ class Post(Model):
246
+ fillable: ClassVar[list[str]] = ["user_id", "title", "content"]
247
+
248
+ def user(self) -> BelongsTo:
249
+ return self.belongs_to(User, "user_id", "id")
250
+
251
+ class User(Model, SoftDeletes):
252
+ fillable: ClassVar[list[str]] = ["name", "email", "is_admin"]
253
+ casts: ClassVar[dict[str, str]] = {"is_admin": "bool"}
254
+
255
+ def posts(self) -> HasMany:
256
+ return self.has_many(Post, "user_id", "id")
257
+
258
+ @classmethod
259
+ def scope_admins(cls, query):
260
+ query.where("is_admin", True)
261
+
262
+ # Eloquent CRUD API
263
+ user = User.create(name="Taylor", email="taylor@example.com", is_admin=True)
264
+ admins = User.query().admins().latest().get()
265
+
266
+ # Eager loading (eliminating N+1 query problems)
267
+ authors = User.query().with_("posts").get()
268
+ first_user_posts = authors[0].posts
269
+ ```
270
+
271
+ ### 9. Database Migrations, Schema Builder & Query Builder
272
+
273
+ ```python
274
+ from nexus.facades import DB, Schema
275
+ from nexus.database.migrations import Migration
276
+ from nexus.database.schema import Blueprint
277
+
278
+ # Fluent Query Builder
279
+ active_users = (
280
+ DB.table("users")
281
+ .where("votes", ">", 100)
282
+ .order_by("votes", "desc")
283
+ .paginate(per_page=15)
284
+ )
285
+
286
+ # Schema Migration DSL
287
+ class CreateArticlesTable(Migration):
288
+ def up(self) -> None:
289
+ def table_definition(table: Blueprint) -> None:
290
+ table.id()
291
+ table.foreign_id("user_id")
292
+ table.string("title")
293
+ table.text("body").nullable()
294
+ table.timestamps()
295
+ table.soft_deletes()
296
+
297
+ Schema.create("articles", table_definition)
298
+
299
+ def down(self) -> None:
300
+ Schema.drop_if_exists("articles")
301
+ ```
302
+
303
+ ### 10. Artisan-Style CLI & Code Scaffolding
304
+
305
+ Nexus provides a rich, Typer-powered and Rich-styled command-line toolchain for code generation, database management, and development inspection:
306
+
307
+ ```bash
308
+ # Display help and all available commands
309
+ python nexus.py --help
310
+ # or via installed entrypoint:
311
+ nexus --help
312
+
313
+ # Code Scaffolding (make:*)
314
+ nexus make:controller UserController --resource
315
+ nexus make:model Post -m -f -s # creates model, migration, factory, and seeder
316
+ nexus make:migration create_orders_table --create=orders
317
+ nexus make:middleware VerifyApiKey
318
+ nexus make:request StorePostRequest
319
+ nexus make:provider PaymentServiceProvider
320
+ nexus make:command SendWeeklyDigest
321
+ nexus make:policy PostPolicy
322
+
323
+ # Database Management
324
+ nexus migrate # Run pending migrations
325
+ nexus migrate:rollback # Rollback last migration batch
326
+ nexus migrate:reset # Rollback all migrations
327
+ nexus migrate:refresh --seed # Reset and re-run all migrations with seeders
328
+ nexus migrate:fresh --seed # Drop all tables and re-run migrations
329
+ nexus migrate:status # Status table of all migrations
330
+ nexus db:seed # Run DatabaseSeeder
331
+
332
+ # Development & Inspection
333
+ nexus serve --host 127.0.0.1 --port 8000 # Start dev server with hot reload
334
+ nexus route:list # Colorized table of routes, verbs, and middleware
335
+ nexus tinker # Interactive REPL with pre-booted kernel and models
336
+ nexus clear:cache # Clear application cache
337
+ nexus config:clear # Reset configuration caches
338
+ nexus route:clear # Reset route definitions
339
+ ```
340
+
341
+ ### 11. Programmatic Artisan Facade & Custom Commands
342
+
343
+ Custom CLI commands can be defined fluently in `routes/console.py` or as `Command` classes in `app/console/commands/`:
344
+
345
+ ```python
346
+ from nexus.facades import Artisan
347
+ from nexus.console import Command
348
+
349
+ # In routes/console.py
350
+ @Artisan.command("inspire", help="Display an inspiring quote")
351
+ def inspire() -> None:
352
+ print("Simplicity is prerequisite for reliability. -- Edsger W. Dijkstra")
353
+
354
+ # Programmatic command execution (e.g. in test suites or deployment hooks)
355
+ Artisan.call("migrate")
356
+ Artisan.call("clear:cache")
357
+
358
+ # Subclassing the Command base class
359
+ class BackupCommand(Command):
360
+ name = "backup:run"
361
+ description = "Run database backup"
362
+
363
+ def handle(self) -> None:
364
+ self.info("Starting backup...")
365
+ # Backup logic
366
+ self.success("Backup completed successfully!")
367
+ ```
368
+
369
+ ### 12. Session Management & Flash Data
370
+
371
+ Nexus includes pluggable session drivers (`memory`, `file`, `database`) with anti-session fixation and flash data:
372
+
373
+ ```python
374
+ from nexus.facades import Session
375
+
376
+ # Set and retrieve session data
377
+ Session.put("user_id", 42)
378
+ user_id = Session.get("user_id")
379
+
380
+ # Flash data available only for the subsequent request
381
+ Session.flash("status", "Profile updated successfully!")
382
+
383
+ # Check existence & pull
384
+ if Session.has("status"):
385
+ message = Session.pull("status")
386
+
387
+ # Regenerate session ID (prevent session fixation on login)
388
+ Session.regenerate(destroy_old=True)
389
+ ```
390
+
391
+ ### 13. Security Middleware (CSRF, CORS, Security Headers)
392
+
393
+ Comprehensive security protection out-of-the-box:
394
+
395
+ ```python
396
+ from nexus.security.csrf import VerifyCsrfToken
397
+ from nexus.security.cors import CorsMiddleware
398
+ from nexus.security.headers import SecurityHeadersMiddleware
399
+
400
+ # CSRF verification with wildcard exclusions
401
+ csrf = VerifyCsrfToken(except_uris=["api/*", "stripe/webhook"])
402
+
403
+ # CORS preflight and origin verification
404
+ cors = CorsMiddleware(
405
+ allowed_origins=["https://myapp.com"],
406
+ allowed_methods=["GET", "POST", "PUT", "DELETE"],
407
+ allow_credentials=True,
408
+ )
409
+
410
+ # OWASP security headers (HSTS, X-Frame-Options, X-Content-Type-Options)
411
+ headers_middleware = SecurityHeadersMiddleware(frame_options="DENY")
412
+ ```
413
+
414
+ ### 14. Authentication, User Providers & Password Hashing
415
+
416
+ Multi-guard authentication supporting both stateful sessions and stateless API tokens:
417
+
418
+ ```python
419
+ from nexus.facades import Auth, Hash
420
+
421
+ # Password hashing with PBKDF2-HMAC-SHA256 (600,000 rounds) or Bcrypt
422
+ hashed_password = Hash.make("secret-password")
423
+ assert Hash.check("secret-password", hashed_password)
424
+
425
+ # Attempt web login using credentials
426
+ if Auth.attempt({"email": "admin@example.com", "password": "password123"}):
427
+ current_user = Auth.user()
428
+ user_id = Auth.id()
429
+
430
+ # Check authentication state
431
+ if Auth.check():
432
+ print(f"Logged in as {Auth.user().email}")
433
+ elif Auth.guest():
434
+ print("Welcome Guest")
435
+
436
+ # Stateless token guard for API endpoints
437
+ api_user = Auth.guard("api").user()
438
+
439
+ # Logout
440
+ Auth.logout()
441
+ ```
442
+
443
+ ### 15. Authorization Gates & Policies
444
+
445
+ Define custom authorization abilities and policies:
446
+
447
+ ```python
448
+ from nexus.facades import Gate
449
+
450
+ # Define an inline gate
451
+ Gate.define("edit-settings", lambda user: user.is_admin)
452
+
453
+ # Assign a policy class to an Eloquent model
454
+ class PostPolicy:
455
+ def update(self, user, post) -> bool:
456
+ return user.id == post.user_id
457
+
458
+ Gate.policy(Post, PostPolicy)
459
+
460
+ # Check permissions
461
+ if Gate.allows("update", post):
462
+ post.update(title="New Title")
463
+ else:
464
+ # Denied
465
+ Gate.authorize("update", post) # raises ForbiddenHttpException (403)
466
+ ```
467
+
468
+ ### 16. Blade-Style View Engine & Jinja2 Integration
469
+
470
+ Write clean templates using familiar Laravel Blade directives precompiled into Jinja2:
471
+
472
+ ```html
473
+ <!-- resources/views/layouts/app.html -->
474
+ <!DOCTYPE html>
475
+ <html>
476
+ <head>
477
+ <title>@yield('title', 'My Application')</title>
478
+ @vite(['resources/css/app.css', 'resources/js/app.js'])
479
+ </head>
480
+ <body>
481
+ @auth
482
+ <p>Welcome, {{ user.name }}!</p>
483
+ @guest
484
+ <a href="/login">Sign In</a>
485
+ @endauth
486
+
487
+ <div class="content">
488
+ @yield('content')
489
+ </div>
490
+ </body>
491
+ </html>
492
+ ```
493
+
494
+ ```html
495
+ <!-- resources/views/posts/create.html -->
496
+ @extends('layouts.app')
497
+
498
+ @section('title', 'Create Post')
499
+
500
+ @section('content')
501
+ <form method="POST" action="/posts">
502
+ @csrf
503
+ @method('POST')
504
+ <input type="text" name="title" placeholder="Post Title">
505
+ <button type="submit">Submit</button>
506
+ </form>
507
+ @endsection
508
+ ```
509
+
510
+ Render views effortlessly using the global `view()` helper or `View` facade:
511
+
512
+ ```python
513
+ from nexus.view import view
514
+
515
+ @Route.get("/posts/create")
516
+ def create_post():
517
+ return view("posts.create", {"active": True})
518
+ ```
519
+
520
+ ### 17. Background Jobs, Queues & Worker Daemons
521
+
522
+ Nexus provides unified asynchronous queues (`sync`, `memory`, `database`, `redis`):
523
+
524
+ ```python
525
+ from nexus.queue import Job
526
+ from nexus.facades import Queue
527
+
528
+ class SendVerificationEmail(Job):
529
+ tries = 3
530
+ backoff = 5 # wait 5s between retries
531
+
532
+ def __init__(self, user_id: int) -> None:
533
+ super().__init__(user_id)
534
+ self.user_id = user_id
535
+
536
+ def handle(self) -> None:
537
+ print(f"Sending verification email to user: {self.user_id}")
538
+
539
+ # Fluent asynchronous dispatch
540
+ SendVerificationEmail.dispatch(user_id=42).on_queue("emails").delay(60)
541
+
542
+ # Run queue worker via Artisan CLI
543
+ # nexus queue:work --queue=emails --sleep=3
544
+ ```
545
+
546
+ ### 18. Task Scheduling & Cron Workflows
547
+
548
+ Define scheduled tasks in code without writing manual cron entries:
549
+
550
+ ```python
551
+ from nexus.facades import Schedule
552
+
553
+ # Artisan commands
554
+ Schedule.command("backup:run").daily().at("02:00").without_overlapping()
555
+
556
+ # Python callables
557
+ Schedule.call(lambda: print("Pruning expired tokens...")).every_five_minutes()
558
+
559
+ # Shell commands
560
+ Schedule.exec("node scripts/generate-sitemap.js").weekly().sundays().at("03:30")
561
+
562
+ # Run scheduler worker via Artisan CLI
563
+ # nexus schedule:run
564
+ # nexus schedule:work --sleep=60
565
+ ```
566
+
567
+ ### 19. Event Dispatcher & Queued Observers
568
+
569
+ Decouple application workflows with synchronous and background queued listeners:
570
+
571
+ ```python
572
+ from nexus.facades import Event
573
+ from nexus.queue import ShouldQueue
574
+
575
+ class OrderShipped:
576
+ def __init__(self, order_id: int) -> None:
577
+ self.order_id = order_id
578
+
579
+ # Queued listener runs in background automatically
580
+ class SendShippingNotification(ShouldQueue):
581
+ def handle(self, event: OrderShipped) -> None:
582
+ print(f"Notification sent for Order #{event.order_id}")
583
+
584
+ # Register & dispatch
585
+ Event.listen(OrderShipped, SendShippingNotification)
586
+ Event.dispatch(OrderShipped(order_id=1024))
587
+ ```
588
+
589
+ ### 20. Cache Repository, Tags & Atomic Locks
590
+
591
+ High-performance cache layer (`memory`, `file`, `redis`):
592
+
593
+ ```python
594
+ from nexus.facades import Cache
595
+
596
+ # Basic cache
597
+ Cache.put("user_42", {"name": "Alice"}, ttl=3600)
598
+ user = Cache.get("user_42")
599
+
600
+ # Remember (cache or compute)
601
+ stats = Cache.remember("dashboard_stats", 300, lambda: {"views": 15000})
602
+
603
+ # Cache Tags
604
+ Cache.tags("reports", "financials").put("q3", {"profit": 250000})
605
+ Cache.tags("reports").flush() # Flushes all tagged entries
606
+
607
+ # Atomic Locks (concurrency control)
608
+ with Cache.lock("heavy_data_import", seconds=120) as acquired:
609
+ if acquired:
610
+ print("Importing safely without race conditions!")
611
+ ```
612
+
613
+ ### 21. Mail, Mailables & Multi-Channel Notifications
614
+
615
+ Deliver emails using SMTP, File, or Array transports:
616
+
617
+ ```python
618
+ from nexus.facades import Mail, Notification
619
+ from nexus.mail import Mailable
620
+ from nexus.notifications import Notification as BaseNotification
621
+
622
+ class OrderInvoiceMail(Mailable):
623
+ subject = "Your Invoice"
624
+
625
+ def __init__(self, order) -> None:
626
+ super().__init__()
627
+ self.order = order
628
+
629
+ def build(self) -> None:
630
+ self.view("emails.invoice", {"order": self.order})
631
+ self.attach("invoice.pdf", b"...pdf_bytes...", "application/pdf")
632
+
633
+ # Send email immediately or queue to background
634
+ Mail.to("customer@example.com").send(OrderInvoiceMail(order))
635
+ Mail.to("customer@example.com").queue(OrderInvoiceMail(order))
636
+
637
+ # Multi-channel notification (Mail + Database)
638
+ class OrderStatusUpdated(BaseNotification):
639
+ def via(self, notifiable):
640
+ return ["mail", "database"]
641
+
642
+ def to_mail(self, notifiable):
643
+ return OrderInvoiceMail(notifiable.order)
644
+
645
+ Notification.send(customer, OrderStatusUpdated())
646
+ ```
647
+
648
+ ### 22. Filesystem & Storage Disks
649
+
650
+ Local and virtual cloud storage disks:
651
+
652
+ ```python
653
+ from nexus.facades import Storage
654
+
655
+ # Write and read files
656
+ Storage.put("avatars/1.png", image_bytes)
657
+ content = Storage.get("avatars/1.png")
658
+
659
+ # File inspection and public URLs
660
+ if Storage.exists("avatars/1.png"):
661
+ file_url = Storage.url("avatars/1.png") # /storage/avatars/1.png
662
+ size_bytes = Storage.size("avatars/1.png")
663
+
664
+ # Copy, move, delete
665
+ Storage.copy("avatars/1.png", "backup/1.png")
666
+ Storage.delete("avatars/1.png")
667
+ ```
668
+
669
+ ### 23. Testing Framework & HTTP TestClient
670
+
671
+ Nexus provides a fluent, lightning-fast in-memory testing client (`TestClient`) and rich assertion wrapper (`TestResponse`):
672
+
673
+ ```python
674
+ from nexus.testing import TestCase
675
+
676
+ class UserApiTest(TestCase):
677
+ def test_user_retrieval(self) -> None:
678
+ # Fluent request chaining
679
+ res = self.client.get("/api/v1/users", params={"page": 1})
680
+
681
+ # Fluent status, header, and JSON assertions
682
+ res.assert_ok() \
683
+ .assert_header("content-type", "application/json") \
684
+ .assert_json({"total": 25}) \
685
+ .assert_json_path("data.0.name", "John Doe")
686
+
687
+ def test_validation_errors(self) -> None:
688
+ # Submit invalid payload
689
+ res = self.client.post("/api/v1/users", json={"name": "Alice"})
690
+
691
+ # Fluent validation assertions
692
+ res.assert_status(422) \
693
+ .assert_invalid(["email"]) \
694
+ .assert_valid(["name"]) \
695
+ .assert_json_validation_errors(["email"])
696
+
697
+ def test_authenticated_route(self) -> None:
698
+ user = User.find(1)
699
+ res = self.acting_as(user).get("/api/v1/profile")
700
+ res.assert_ok().assert_see("Welcome back")
701
+ ```
702
+
703
+ Generate new test cases using Artisan:
704
+ ```bash
705
+ nexus make:test UserApiTest # Creates tests/feature/test_user_api.py (subclasses TestCase with self.client)
706
+ nexus make:test CalculatorTest --unit # Creates tests/unit/test_calculator.py (isolated unittest.TestCase)
707
+ ```
708
+
709
+ ### 24. Facade Fakes & Time Travel
710
+
711
+ Test complex distributed systems, logs, and async queues with zero mocks boilerplate:
712
+
713
+ ```python
714
+ from nexus.facades import Event, Queue, Mail, Notification, Storage, Log
715
+ from nexus.testing import travel_to, freeze_time
716
+
717
+ def test_order_fulfillment():
718
+ # 1. Fake application facades
719
+ Event.fake()
720
+ Queue.fake()
721
+ Mail.fake()
722
+ Storage.fake()
723
+ Log.fake()
724
+
725
+ # 2. Time Travel
726
+ with travel_to("2026-01-01 12:00:00"):
727
+ process_order(order_id=42)
728
+
729
+ # 3. Assertions
730
+ Event.assert_dispatched(OrderPlaced)
731
+ Queue.assert_pushed("GenerateInvoicePdfJob")
732
+ Mail.assert_sent(OrderConfirmationMail)
733
+ Storage.assert_exists("invoices/42.pdf")
734
+ Log.assert_logged("info", lambda msg: "Order 42 processed" in msg)
735
+ ```
736
+
737
+ ### 25. Official Starter Kits & OpenAPI Swagger
738
+
739
+ Scaffold production-ready application architectures instantly with Artisan:
740
+
741
+ ```bash
742
+ # Generate API Starter (Sanctum tokens, JSON resources, and OpenAPI Swagger UI)
743
+ nexus make:starter api
744
+
745
+ # Generate Web Starter (Session auth, Blade views, Tailwind CSS v4, Alpine.js, and Vite)
746
+ nexus make:starter web
747
+
748
+ # Generate Inertia Starter (Modern SPA with React, Tailwind CSS v4, and Vite)
749
+ nexus make:starter inertia
750
+ ```
751
+
752
+ - **Nexus API Starter:** Interactive Swagger documentation automatically generated at `/api/docs` and schema at `/api/openapi.json`.
753
+ - **Nexus Web Starter:** Full authentication UI with Blade views (`login.blade.html`, `register.blade.html`, `dashboard.blade.html`), Tailwind CSS v4 styling, Alpine.js reactivity, and Vite NPM asset bundling (`@vite(['resources/css/app.css', 'resources/js/app.js'])`) with zero CDN reliance.
754
+ - **Nexus Inertia Starter:** Reactive Single-Page Application (SPA) powered by React/Vue, `@inertia` layout, Tailwind CSS v4 (`@import "tailwindcss";`), and Python Nexus backend.
755
+
756
+ ### 26. Fluent Collections (`Collection` & `collect()`)
757
+
758
+ Chainable, expressive array and dictionary transformations inspired by Laravel Collections:
759
+
760
+ ```python
761
+ from nexus.support import collect
762
+
763
+ users = collect([
764
+ {"id": 1, "name": "Alice", "role": "admin", "score": 90},
765
+ {"id": 2, "name": "Bob", "role": "user", "score": 75},
766
+ {"id": 3, "name": "Charlie", "role": "admin", "score": 85},
767
+ ])
768
+
769
+ # Pluck, filter, and sort
770
+ names = users.where("role", "admin").sort_by("score", descending=True).pluck("name").all()
771
+ # ["Alice", "Charlie"]
772
+
773
+ # Aggregates and grouping
774
+ avg_score = users.avg("score") # 83.33
775
+ grouped = users.group_by("role") # {"admin": Collection([...]), "user": Collection([...])}
776
+ ```
777
+
778
+ ### 27. String & Array Helpers (`Str`, `Stringable`, `Arr`)
779
+
780
+ Rich text manipulation and nested dictionary dot-notation utilities:
781
+
782
+ ```python
783
+ from nexus.support import Str, str_helper, Arr
784
+
785
+ # Static and fluent string manipulation
786
+ slug = Str.slug("Nexus Web Framework 2026!") # "nexus-web-framework-2026"
787
+ snake = Str.snake("UserProfileView") # "user_profile_view"
788
+ uuid_str = Str.uuid()
789
+ masked = Str.mask("secretpassword", "*", 3, 6) # "sec******sword"
790
+
791
+ # Fluent Stringable chaining
792
+ title = str_helper(" my_post_title ").trim().headline().value() # "My Post Title"
793
+
794
+ # Nested dictionary dot-notation traversal
795
+ payload = {"app": {"server": {"port": 8000}}}
796
+ port = Arr.get(payload, "app.server.port", 3000) # 8000
797
+ Arr.set(payload, "app.server.ssl", True)
798
+ exists = Arr.has(payload, "app.server.ssl") # True
799
+ ```
800
+
801
+ ### 28. Fluent Datetime Engine (`Carbon` & `Date` Facade)
802
+
803
+ Laravel Carbon-equivalent fluent datetime manipulation:
804
+
805
+ ```python
806
+ from nexus.facades import Date
807
+ from nexus.support import Carbon
808
+
809
+ # Instantiation & Parsing
810
+ now = Date.now()
811
+ parsed = Date.parse("2026-10-26 14:30:00")
812
+
813
+ # Chainable Arithmetic & Boundaries
814
+ future = now.add_days(7).start_of_day()
815
+ month_end = now.end_of_month()
816
+
817
+ # Expressive Human Diffing
818
+ two_hours_ago = now.sub_hours(2).diff_for_humans() # "2 hours ago"
819
+ next_week = now.add_days(5).diff_for_humans() # "in 5 days"
820
+ ```
821
+
822
+ ### 29. Standalone Validation Engine (`Validator`)
823
+
824
+ Validate data using standard Laravel pipe syntax rules, custom messages, and custom extensions:
825
+
826
+ ```python
827
+ from nexus.facades import Validator
828
+
829
+ validator = Validator.make(
830
+ data={"email": "dev@nexus.test", "age": 28, "password": "secret", "password_confirmation": "secret"},
831
+ rules={
832
+ "email": "required|email",
833
+ "age": "required|integer|between:18,99",
834
+ "password": "required|min:6|confirmed",
835
+ },
836
+ messages={
837
+ "email": "Please provide a valid corporate email address.",
838
+ }
839
+ )
840
+
841
+ if validator.fails():
842
+ errors = validator.errors().to_dict() # {"email": [...], ...}
843
+ else:
844
+ validated_data = validator.validated()
845
+ ```
846
+
847
+ ### 30. Multi-Channel Logging (`LogManager` & `Log` Facade)
848
+
849
+ Structured, channel-based logging supporting daily rotation and contextual tags:
850
+
851
+ ```python
852
+ from nexus.facades import Log
853
+
854
+ # Log to default or specific channel
855
+ Log.info("User registered successfully", context={"user_id": 42})
856
+ Log.channel("daily").warning("Disk space low")
857
+ Log.stack(["single", "daily"]).critical("Database connection timeout")
858
+
859
+ # Contextual logging
860
+ Log.share_context(request_id="req-12345", ip="127.0.0.1")
861
+ # All subsequent logs in this async context automatically include request_id and ip!
862
+ ```
863
+
864
+ ### 31. Global Exception Handler (`ExceptionHandler`)
865
+
866
+ Unified exception reporting and response rendering for web and API requests:
867
+
868
+ ```python
869
+ from nexus.exceptions.handler import ExceptionHandler
870
+ from nexus.facades import App
871
+
872
+ handler: ExceptionHandler = App.make("exception.handler")
873
+
874
+ # Custom reportable and renderable handlers
875
+ handler.reportable(PaymentGatewayError, lambda exc: send_slack_alert(exc))
876
+ handler.renderable(PaymentGatewayError, lambda req, exc: JsonResponse({"error": "Payment failed"}, status_code=402))
877
+ ```
878
+
879
+ - **API Requests:** Automatically returns clean JSON responses (`{"message": "...", "errors": {...}, "status": 422}`).
880
+ - **Web Requests:** Automatically renders dark-mode styled HTML error pages (404, 403, 419, 500) and rich debug stack traces when `app.debug=True`.
881
+
882
+ ### 32. API Resources & Collections (`JsonResource` & `ResourceCollection`)
883
+
884
+ Transform Eloquent models and paginated datasets into structured JSON API responses:
885
+
886
+ ```python
887
+ from nexus.http.resources import JsonResource, ResourceCollection
888
+
889
+ class UserResource(JsonResource):
890
+ def to_array(self, request=None):
891
+ return {
892
+ "id": self.id,
893
+ "name": self.name.title(),
894
+ "email": self.email,
895
+ }
896
+
897
+ # Single resource
898
+ return UserResource(user).additional({"meta": {"version": "v1"}})
899
+
900
+ # Collection with automatic pagination metadata & links
901
+ return UserResource.collection(User.paginate(15))
902
+ ```
903
+
904
+ ### 33. URL Generator & Signed Routes (`URL` Facade & `route()`)
905
+
906
+ Generate URLs for named routes, HMAC-SHA256 tamper-proof signed links, and expiration checks:
907
+
908
+ ```python
909
+ from nexus.facades import URL
910
+ from nexus.support import route
911
+
912
+ # Named route URL generation
913
+ profile_url = route("users.show", id=42, tab="security")
914
+ # "http://localhost:8000/users/42?tab=security"
915
+
916
+ # Temporary signed route with 30-minute expiration
917
+ signed_url = URL.signed_route("unsubscribe", {"user_id": 10}, expiration=1800)
918
+ # "http://localhost:8000/unsubscribe/10?expires=1730000000&signature=abc123def..."
919
+
920
+ # In route handler / middleware
921
+ if not request.has_valid_signature():
922
+ abort(403, "Invalid or expired signature.")
923
+ ```
924
+
925
+ ### 34. Active Record State Tracking & Lifecycle
926
+
927
+ Inspect model dirty state, retrieve original values, reload from database, or touch timestamps:
928
+
929
+ ```python
930
+ user = User.find(1)
931
+ user.name = "New Name"
932
+
933
+ user.is_dirty() # True
934
+ user.is_dirty("name") # True
935
+ user.is_dirty("email") # False
936
+ user.get_dirty() # {"name": "New Name"}
937
+ user.get_original("name") # "Old Name"
938
+
939
+ user.refresh() # Discards memory modifications, reloads from database
940
+ user.touch() # Updates updated_at timestamp immediately
941
+ ```
942
+
943
+ ### 35. Object-Oriented Validation Rules (`Rule`)
944
+
945
+ Create encapsulated, reusable validation rule objects:
946
+
947
+ ```python
948
+ from nexus.validation import Rule, Validator
949
+
950
+ class UppercaseRule(Rule):
951
+ def passes(self, attribute, value) -> bool:
952
+ return isinstance(value, str) and value.isupper()
953
+
954
+ def message(self) -> str:
955
+ return "The :attribute must be completely uppercase."
956
+
957
+ validator = Validator.make(
958
+ data={"code": "promo2026"},
959
+ rules={"code": ["required", UppercaseRule()]},
960
+ )
961
+ ```
962
+
963
+ ### 36. Artisan Scaffolding Generator Suite
964
+
965
+ Accelerate development with built-in Artisan generator commands:
966
+
967
+ ```bash
968
+ nexus make:controller UserController --api
969
+ nexus make:model Post -mfs # Model + Migration + Factory + Seeder
970
+ nexus make:job ProcessPaymentJob
971
+ nexus make:event OrderShipped
972
+ nexus make:listener SendShipmentEmail --event=OrderShipped --queued
973
+ nexus make:mail WelcomeMail
974
+ nexus make:notification NewMessageNotification
975
+ nexus make:rule ValidTaxIdentifier
976
+ nexus make:resource UserResource
977
+ nexus make:test UserFeatureTest
978
+ nexus sanctum:install # Scaffold personal access tokens migration
979
+ ```
980
+
981
+ ### 37. Nexus Sanctum: API Token Authentication
982
+
983
+ Issue and verify lightweight, SHA-256 hashed personal access tokens with granular abilities and expiration:
984
+
985
+ ```python
986
+ from nexus.database.models import Model
987
+ from nexus.auth import Authenticatable, HasApiTokens
988
+ from nexus.auth.sanctum import CheckAbilities
989
+
990
+ class User(Model, Authenticatable, HasApiTokens):
991
+ table = "users"
992
+ fillable = ["name", "email", "password"]
993
+
994
+ # 1. Create a personal access token (returns plain text token only once)
995
+ token_res = user.create_token(
996
+ name="mobile-app",
997
+ abilities=["orders:create", "orders:read"],
998
+ expires_at=Date.now().add_days(30),
999
+ )
1000
+ print(token_res.plain_text_token) # "1|4f9b20..."
1001
+
1002
+ # 2. Check token abilities
1003
+ user.token_can("orders:create") # True
1004
+ user.token_can("orders:delete") # False
1005
+
1006
+ # 3. Protect routes with ability middlewares
1007
+ @router.post("/orders", action=OrderController.store, middleware=[CheckAbilities("orders:create")])
1008
+ ```
1009
+
1010
+ ### 38. Nexus Inertia.js Adapter
1011
+
1012
+ Build modern Single Page Apps using React, Vue, or Svelte without building a separate REST API:
1013
+
1014
+ ```python
1015
+ from nexus.inertia import inertia, Inertia
1016
+ from nexus.facades import Route
1017
+
1018
+ # 1. Global shared data (e.g. current user, flash notifications)
1019
+ Inertia.share("auth", lambda: {"user": request.user.to_dict() if request.user else None})
1020
+
1021
+ # 2. Render Inertia component in controller / route
1022
+ @router.get("/dashboard")
1023
+ def dashboard(request):
1024
+ return inertia("Dashboard/Index", {
1025
+ "metrics": {"total_revenue": 95000, "active_users": 1420},
1026
+ "recent_orders": Inertia.lazy(lambda: Order.latest().take(10).get()),
1027
+ })
1028
+
1029
+ # 3. Automatic asset versioning & external redirection
1030
+ Inertia.version("v1.0.4")
1031
+ Inertia.location("https://external-auth.example.com")
1032
+ ```
1033
+
1034
+ In your Blade layout (`resources/views/app.blade.php`):
1035
+ ```html
1036
+ <!DOCTYPE html>
1037
+ <html>
1038
+ <head>
1039
+ <meta charset="utf-8" />
1040
+ @inertiaHead
1041
+ </head>
1042
+ <body>
1043
+ @inertia
1044
+ </body>
1045
+ </html>
1046
+ ```
1047
+
1048
+ ### 39. Faker Integration in Model Factories
1049
+
1050
+ Generate realistic mock data and test fixtures with automatic Faker bindings, states, and sequences:
1051
+
1052
+ ```python
1053
+ from nexus.database.factory import Factory
1054
+ from app.models.user import User
1055
+
1056
+ class UserFactory(Factory[User]):
1057
+ model = User
1058
+
1059
+ def definition(self):
1060
+ return {
1061
+ "name": self.faker.name(),
1062
+ "email": self.faker.email(),
1063
+ "address": self.faker.address(),
1064
+ "is_admin": False,
1065
+ }
1066
+
1067
+ # 1. In-memory instances or persisted database records
1068
+ mock_user = UserFactory.new().make()
1069
+ saved_user = UserFactory.new().create()
1070
+
1071
+ # 2. State transformations & sequential attributes
1072
+ admin_users = (
1073
+ UserFactory.new(count=5)
1074
+ .state({"is_admin": True})
1075
+ .sequence(lambda idx: {"email": f"admin_{idx + 1}@company.com"})
1076
+ .create()
1077
+ )
1078
+
1079
+ # 3. Direct spawning from Model
1080
+ new_users = User.factory().count(10).create()
1081
+ ```
1082
+
1083
+ ### 40. Nexus Telescope & In-Browser Debugbar
1084
+
1085
+ Inspect real-time request metrics, database queries, memory usage, latency, and logs directly in your browser:
1086
+
1087
+ ```python
1088
+ # config/app.py
1089
+ return {
1090
+ "debug": True,
1091
+ }
1092
+ ```
1093
+
1094
+ When debug mode is active:
1095
+ - **Floating In-Browser Debugbar**: Automatically rendered at the bottom of HTML responses with badges for Status (`200 OK`), Duration (`3.4 ms`), Memory (`1.8 MB`), Query count, and Route name.
1096
+ - **Query Inspector**: Expand the Queries tab to inspect exact SQL strings, parameter bindings, and query timings.
1097
+ - **Dedicated Web Dashboard**: Visit `http://localhost:8000/telescope` for historical request telemetry.
1098
+ - **JSON Telemetry API**: Available at `/telescope/api/requests` for headless SPA inspection.
1099
+
1100
+ Query telemetry programmatically via the `Telescope` facade:
1101
+
1102
+ ```python
1103
+ from nexus.facades import Telescope
1104
+
1105
+ recent_requests = Telescope.entries(limit=50)
1106
+ ```
1107
+
1108
+ ### 32. Fully Configurable Architecture (Laravel-Parity Configuration)
1109
+
1110
+ Nexus features a zero-boilerplate, deeply configurable environment and configuration system with full Laravel parity:
1111
+
1112
+ ```bash
1113
+ # Publish official framework configuration files (app, database, auth, session, logging, cache, queue, mail, telescope, cors)
1114
+ nexus config:publish all
1115
+
1116
+ # Publish a specific configuration file
1117
+ nexus config:publish database
1118
+
1119
+ # Create a custom application configuration
1120
+ nexus make:config payment
1121
+
1122
+ # Clear and reload configuration caches
1123
+ nexus config:clear
1124
+ ```
1125
+
1126
+ #### `.env` Environment Variables & `env()` Helper
1127
+ Environment variables are automatically loaded and typed:
1128
+
1129
+ ```python
1130
+ from nexus.support.env import env
1131
+
1132
+ # Automatically casts "true"/"false" to bool, "null" to None, ints, and floats
1133
+ db_host = env("DB_HOST", "127.0.0.1")
1134
+ debug_mode = env("APP_DEBUG", False)
1135
+ ```
1136
+
1137
+ #### `config/*.py` Dot-Notation Traversal & `Config` Facade
1138
+ Every file in `config/` is automatically mounted under its filename:
1139
+
1140
+ ```python
1141
+ from nexus.facades import Config
1142
+ from nexus.support import config
1143
+
1144
+ # Access via dot-notation
1145
+ db_default = config("database.default") # "sqlite"
1146
+ app_name = Config.get("app.name", "Nexus")
1147
+
1148
+ # Runtime mutation
1149
+ Config.set("app.debug", True)
1150
+ ```
1151
+
1152
+ In Blade templates, use the `config()` helper directly:
1153
+ ```html
1154
+ <title>{{ config('app.name', 'Nexus') }}</title>
1155
+ ```
1156
+
1157
+ ---
1158
+
1159
+ ## Project Roadmap
1160
+
1161
+ See [ROADMAP.md](ROADMAP.md) for detailed architectural decisions, milestone tracking, and phase-by-phase implementation plans.
1162
+
1163
+
1164
+
1165
+