oneie 2.0.2 → 2.0.5

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 (459) hide show
  1. package/AGENTS.md +245 -0
  2. package/CLAUDE.md +725 -0
  3. package/LICENSE.md +84 -0
  4. package/README.md +489 -931
  5. package/folders.yaml +78 -17
  6. package/one/.obsidian/app.json +1 -0
  7. package/one/.obsidian/appearance.json +1 -0
  8. package/one/.obsidian/core-plugins.json +33 -0
  9. package/one/.obsidian/workspace.json +211 -0
  10. package/one/connections/a2a.md +551 -0
  11. package/one/connections/acp.md +761 -0
  12. package/one/connections/acps.md +731 -0
  13. package/one/connections/agentkit.md +349 -0
  14. package/one/connections/agui.md +767 -0
  15. package/one/connections/any-backend.md +1702 -0
  16. package/one/connections/ap2.md +998 -0
  17. package/one/connections/api-docs.md +1891 -0
  18. package/one/connections/api.md +2190 -0
  19. package/one/connections/architecture-diagram.md +94 -0
  20. package/one/connections/communications.md +449 -0
  21. package/one/connections/connections.md +339 -0
  22. package/one/connections/copilotkit.md +1559 -0
  23. package/one/connections/cryptonetworks.md +781 -0
  24. package/one/connections/documentation.md +1120 -0
  25. package/one/connections/effect.md +279 -0
  26. package/one/connections/elizaos.md +1290 -0
  27. package/one/connections/inference.md +58 -0
  28. package/one/connections/kyc.md +632 -0
  29. package/one/connections/mcp.md +842 -0
  30. package/one/connections/membership.md +1152 -0
  31. package/one/connections/middleware.md +1067 -0
  32. package/one/connections/multitenant.md +1341 -0
  33. package/one/connections/n8n.md +1015 -0
  34. package/one/connections/patterns.md +89 -0
  35. package/one/connections/protocols.md +279 -0
  36. package/one/connections/relationships.md +107 -0
  37. package/one/connections/schema.md +587 -0
  38. package/one/connections/service-layer.md +550 -0
  39. package/one/connections/structure.md +0 -0
  40. package/one/connections/vectors.md +207 -0
  41. package/one/connections/wordpress.md +1302 -0
  42. package/one/connections/workflow-copy.md +905 -0
  43. package/one/connections/workflow-examples.md +741 -0
  44. package/one/connections/workflow.md +905 -0
  45. package/one/connections/workflows/delegation.md +885 -0
  46. package/one/connections/workflows/frontend.md +1037 -0
  47. package/one/connections/workflows/strategy.md +903 -0
  48. package/one/connections/workflows/tasks.md +698 -0
  49. package/one/connections/x402.md +1249 -0
  50. package/one/events/CASCADE-2-BACKEND-AGNOSTIC.md +412 -0
  51. package/one/events/FEATURE-2-4-COMPLETE.md +302 -0
  52. package/one/events/FEATURE_2_3_COMPLETE.md +575 -0
  53. package/one/events/GROUPS-MIGRATION.md +625 -0
  54. package/one/events/INSTALL-TESTS.md +293 -0
  55. package/one/events/INTEGRATION-ARCHITECTURE.md +561 -0
  56. package/one/events/INTEGRATION-CHECKLIST.md +1234 -0
  57. package/one/events/INTEGRATION-ORCHESTRATION.md +2623 -0
  58. package/one/events/INTEGRATION-SUMMARY.md +653 -0
  59. package/one/events/MIGRATION-REPORT.md +435 -0
  60. package/one/events/MIGRATION.md +69 -0
  61. package/one/events/README-archived.md +519 -0
  62. package/one/events/TEST-SUMMARY.md +393 -0
  63. package/one/events/TESTS-QUICK-REF.md +262 -0
  64. package/one/events/events.md +545 -0
  65. package/one/groups/groups.md +543 -0
  66. package/one/groups/one.md +599 -0
  67. package/one/groups/revenue.md +673 -0
  68. package/one/groups/strategy.md +869 -0
  69. package/one/groups/vision.md +98 -0
  70. package/one/knowledge/CLOUDFLARE_ENV_SETUP.md +49 -0
  71. package/one/knowledge/ai-platform.md +305 -0
  72. package/one/knowledge/architecture-any-backend.md +1366 -0
  73. package/one/knowledge/architecture-diagram.md +94 -0
  74. package/one/knowledge/architecture-frontend.md +930 -0
  75. package/one/knowledge/architecture.md +2077 -0
  76. package/one/knowledge/crypto.md +960 -0
  77. package/one/knowledge/docs/flow.md +0 -0
  78. package/one/knowledge/dsl.md +1660 -0
  79. package/one/knowledge/files.md +2471 -0
  80. package/one/knowledge/frontend.md +1038 -0
  81. package/one/knowledge/hono.md +2109 -0
  82. package/one/knowledge/implementation-examples.md +2536 -0
  83. package/one/knowledge/inference-score.md +159 -0
  84. package/one/knowledge/knowledge.md +642 -0
  85. package/one/knowledge/language.md +980 -0
  86. package/one/knowledge/lessons-learned.md +70 -0
  87. package/one/knowledge/ontology-6-dimensions.md +0 -0
  88. package/one/knowledge/ontology-documentation.md +356 -0
  89. package/one/knowledge/ontology-engineering-specification.md +1292 -0
  90. package/one/knowledge/ontology-engineering.md +1652 -0
  91. package/one/knowledge/ontology-frontend-copy-2.md +1492 -0
  92. package/one/knowledge/ontology-frontend-copy.md +753 -0
  93. package/one/knowledge/ontology-frontend-specifications.md +2188 -0
  94. package/one/knowledge/ontology-frontend.md +2427 -0
  95. package/one/knowledge/ontology-minimal.yaml +299 -0
  96. package/one/knowledge/ontology.md +2830 -0
  97. package/one/knowledge/ontology.md.backup +2822 -0
  98. package/one/knowledge/ontology.yaml +1165 -0
  99. package/one/knowledge/patterns/backend/convex-mutation-pattern.md +100 -0
  100. package/one/knowledge/patterns/backend/convex-query-pattern.md +88 -0
  101. package/one/knowledge/patterns/backend/mutation-template.md +231 -0
  102. package/one/knowledge/patterns/backend/query-template.md +267 -0
  103. package/one/knowledge/patterns/backend/service-template.md +237 -0
  104. package/one/knowledge/patterns/design/component-architecture.md +399 -0
  105. package/one/knowledge/patterns/design/test-driven-design-pattern.md +162 -0
  106. package/one/knowledge/patterns/design/wireframe-template.md +216 -0
  107. package/one/knowledge/patterns/frontend/component-template.md +195 -0
  108. package/one/knowledge/patterns/frontend/form-template.md +276 -0
  109. package/one/knowledge/patterns/frontend/page-template.md +178 -0
  110. package/one/knowledge/patterns/frontend/react-component-pattern.md +128 -0
  111. package/one/knowledge/patterns/test/acceptance-criteria-template.md +378 -0
  112. package/one/knowledge/patterns/test/technical-test-template.md +544 -0
  113. package/one/knowledge/patterns/test/test-driven-pattern.md +140 -0
  114. package/one/knowledge/patterns/test/user-flow-template.md +254 -0
  115. package/one/knowledge/provider-creation-guide.md +1064 -0
  116. package/one/knowledge/quality-loop.md +401 -0
  117. package/one/knowledge/readme.md +131 -0
  118. package/one/knowledge/rules.md +626 -0
  119. package/one/knowledge/score.md +67 -0
  120. package/one/knowledge/specifications.md +855 -0
  121. package/one/knowledge/tags.md +130 -0
  122. package/one/knowledge/todo.md +251 -0
  123. package/one/license.md +84 -0
  124. package/one/people/anthony-o-connell.md +440 -0
  125. package/one/people/people.md +567 -0
  126. package/one/things/CHECKLIST.md +356 -0
  127. package/one/things/ONE.md +510 -0
  128. package/one/things/agents/agent-backend.md +1401 -0
  129. package/one/things/agents/agent-builder.md +955 -0
  130. package/one/things/agents/agent-clean.md +709 -0
  131. package/one/things/agents/agent-clone.md +1341 -0
  132. package/one/things/agents/agent-designer.md +2177 -0
  133. package/one/things/agents/agent-director.md +1508 -0
  134. package/one/things/agents/agent-documenter.md +1049 -0
  135. package/one/things/agents/agent-frontend.md +1119 -0
  136. package/one/things/agents/agent-integrator.md +1192 -0
  137. package/one/things/agents/agent-problem-solver.md +1379 -0
  138. package/one/things/agents/agent-quality.md +1353 -0
  139. package/one/things/agents/agent-sales.md +986 -0
  140. package/one/things/cascade/cascade.yaml +464 -0
  141. package/one/things/cascade/docs/examples/1-1-agent-prompts/design.md +470 -0
  142. package/one/things/cascade/docs/examples/1-1-agent-prompts/tests.md +264 -0
  143. package/one/things/cascade/docs/examples/1-1-agent-prompts.md +486 -0
  144. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/design.md +497 -0
  145. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator/tests.md +227 -0
  146. package/one/things/cascade/docs/examples/1-2-yaml-orchestrator.md +516 -0
  147. package/one/things/cascade/docs/examples/1-3-event-coordination/design.md +544 -0
  148. package/one/things/cascade/docs/examples/1-3-event-coordination/tests.md +223 -0
  149. package/one/things/cascade/docs/examples/1-3-event-coordination.md +508 -0
  150. package/one/things/cascade/docs/examples/1-4-knowledge-management/design.md +609 -0
  151. package/one/things/cascade/docs/examples/1-4-knowledge-management/tests.md +195 -0
  152. package/one/things/cascade/docs/examples/1-4-knowledge-management.md +577 -0
  153. package/one/things/cascade/docs/examples/1-5-quality-loops/design.md +797 -0
  154. package/one/things/cascade/docs/examples/1-5-quality-loops/tests.md +212 -0
  155. package/one/things/cascade/docs/examples/1-5-quality-loops.md +641 -0
  156. package/one/things/cascade/docs/examples/1-6-numbering-structure/design.md +610 -0
  157. package/one/things/cascade/docs/examples/1-6-numbering-structure/tests.md +213 -0
  158. package/one/things/cascade/docs/examples/1-6-numbering-structure.md +575 -0
  159. package/one/things/cascade/docs/examples/readme.md +222 -0
  160. package/one/things/cascade/docs/getting-started.md +515 -0
  161. package/one/things/cascade/docs/workflow.md +1372 -0
  162. package/one/things/cascade/readme.md +336 -0
  163. package/one/things/cascade/templates/feature-template.md +267 -0
  164. package/one/things/claude/agents/advocacy-activation-manager.md +685 -0
  165. package/one/things/claude/agents/advocacy-campaign-designer.md +663 -0
  166. package/one/things/claude/agents/analyst.md +483 -0
  167. package/one/things/claude/agents/architect.md +480 -0
  168. package/one/things/claude/agents/brand-identity-specialist.md +513 -0
  169. package/one/things/claude/agents/bstp-token-strategist.md +667 -0
  170. package/one/things/claude/agents/builder-repo.md +489 -0
  171. package/one/things/claude/agents/bullstamp-community-builder.md +574 -0
  172. package/one/things/claude/agents/bullstamp-marketing-orchestrator.md +506 -0
  173. package/one/things/claude/agents/bulltilt-platform-growth.md +567 -0
  174. package/one/things/claude/agents/company-bullstamp-character.md +587 -0
  175. package/one/things/claude/agents/company-bullstamp-community.md +292 -0
  176. package/one/things/claude/agents/company-bullstamp-marketing.md +292 -0
  177. package/one/things/claude/agents/company-bullstamp-token.md +292 -0
  178. package/one/things/claude/agents/company-bulltilt-growth.md +292 -0
  179. package/one/things/claude/agents/content-bibliography-formatter.md +381 -0
  180. package/one/things/claude/agents/content-calendar-planner.md +448 -0
  181. package/one/things/claude/agents/content-chapter-formatter.md +488 -0
  182. package/one/things/claude/agents/content-formatter.md +546 -0
  183. package/one/things/claude/agents/content-hook-specialist.md +462 -0
  184. package/one/things/claude/agents/content-image-formatter.md +535 -0
  185. package/one/things/claude/agents/content-introduction-formatter.md +485 -0
  186. package/one/things/claude/agents/content-multiplication-engine.md +556 -0
  187. package/one/things/claude/agents/content-playbook-writer.md +448 -0
  188. package/one/things/claude/agents/content-team-manager.md +622 -0
  189. package/one/things/claude/agents/content-toc-formatter.md +522 -0
  190. package/one/things/claude/agents/convex-backend-specialist.md +2561 -0
  191. package/one/things/claude/agents/core-manager.md +582 -0
  192. package/one/things/claude/agents/core-master.md +403 -0
  193. package/one/things/claude/agents/cross-functional-manager.md +471 -0
  194. package/one/things/claude/agents/crypto-airdrop-strategist.md +602 -0
  195. package/one/things/claude/agents/crypto-analytics-educator.md +553 -0
  196. package/one/things/claude/agents/crypto-architecture-specialist.md +466 -0
  197. package/one/things/claude/agents/crypto-community-analyst.md +298 -0
  198. package/one/things/claude/agents/crypto-community-psychologist.md +509 -0
  199. package/one/things/claude/agents/crypto-dex-optimization-expert.md +538 -0
  200. package/one/things/claude/agents/crypto-dex-optimizer.md +292 -0
  201. package/one/things/claude/agents/crypto-diamond-formation-specialist.md +513 -0
  202. package/one/things/claude/agents/crypto-diamond-hands.md +292 -0
  203. package/one/things/claude/agents/crypto-ecosystem-expansion-manager.md +554 -0
  204. package/one/things/claude/agents/crypto-engagement-specialist.md +540 -0
  205. package/one/things/claude/agents/crypto-market-researcher.md +292 -0
  206. package/one/things/claude/agents/crypto-marketing-orchestrator.md +523 -0
  207. package/one/things/claude/agents/crypto-network-effect-amplifier.md +569 -0
  208. package/one/things/claude/agents/crypto-optimization-analyst.md +554 -0
  209. package/one/things/claude/agents/crypto-strategic-synthesizer.md +517 -0
  210. package/one/things/claude/agents/crypto-team-manager.md +387 -0
  211. package/one/things/claude/agents/crypto-token-analyst.md +278 -0
  212. package/one/things/claude/agents/crypto-viral-content-creator.md +546 -0
  213. package/one/things/claude/agents/crypto-wallet-identification-expert.md +517 -0
  214. package/one/things/claude/agents/crypto-wallet-identifier.md +292 -0
  215. package/one/things/claude/agents/customer-journey-designer.md +481 -0
  216. package/one/things/claude/agents/customer-success-manager.md +581 -0
  217. package/one/things/claude/agents/dev.md +413 -0
  218. package/one/things/claude/agents/documenter.md +546 -0
  219. package/one/things/claude/agents/elevate-marketing-orchestrator.md +410 -0
  220. package/one/things/claude/agents/engagement-specialist.md +509 -0
  221. package/one/things/claude/agents/engineering-architect.md +387 -0
  222. package/one/things/claude/agents/engineering-business-analyst.md +537 -0
  223. package/one/things/claude/agents/engineering-developer.md +387 -0
  224. package/one/things/claude/agents/engineering-director.md +282 -0
  225. package/one/things/claude/agents/engineering-ingestor.md +649 -0
  226. package/one/things/claude/agents/engineering-product-manager.md +537 -0
  227. package/one/things/claude/agents/engineering-product-owner.md +537 -0
  228. package/one/things/claude/agents/engineering-project-coordinator.md +537 -0
  229. package/one/things/claude/agents/engineering-quality-assurance.md +393 -0
  230. package/one/things/claude/agents/engineering-team-manager.md +512 -0
  231. package/one/things/claude/agents/engineering-user-experience.md +387 -0
  232. package/one/things/claude/agents/framework-elevate-manager.md +294 -0
  233. package/one/things/claude/agents/improver.md +763 -0
  234. package/one/things/claude/agents/intelligence-team-manager.md +385 -0
  235. package/one/things/claude/agents/lead-capture-expert.md +466 -0
  236. package/one/things/claude/agents/lead-magnet-creator.md +453 -0
  237. package/one/things/claude/agents/market-research-analyst.md +412 -0
  238. package/one/things/claude/agents/marketing-brand-identity.md +314 -0
  239. package/one/things/claude/agents/marketing-content-hooks.md +450 -0
  240. package/one/things/claude/agents/marketing-content-multiplier.md +326 -0
  241. package/one/things/claude/agents/marketing-content-poster.md +361 -0
  242. package/one/things/claude/agents/marketing-customer-journey.md +326 -0
  243. package/one/things/claude/agents/marketing-director.md +397 -0
  244. package/one/things/claude/agents/marketing-engagement.md +326 -0
  245. package/one/things/claude/agents/marketing-lead-capture.md +326 -0
  246. package/one/things/claude/agents/marketing-lead-magnet.md +326 -0
  247. package/one/things/claude/agents/marketing-network-effects.md +326 -0
  248. package/one/things/claude/agents/marketing-nurture-campaigns.md +326 -0
  249. package/one/things/claude/agents/marketing-share-optimizer.md +326 -0
  250. package/one/things/claude/agents/marketing-team-manager.md +446 -0
  251. package/one/things/claude/agents/marketing-viral-growth.md +201 -0
  252. package/one/things/claude/agents/mission-commander.md +373 -0
  253. package/one/things/claude/agents/network-effect-analyst.md +587 -0
  254. package/one/things/claude/agents/nextjs-15-specialist.md +1547 -0
  255. package/one/things/claude/agents/npx.md +890 -0
  256. package/one/things/claude/agents/nurture-campaign-manager.md +531 -0
  257. package/one/things/claude/agents/one-master.md +355 -0
  258. package/one/things/claude/agents/one-orchestrator.md +315 -0
  259. package/one/things/claude/agents/one.md +601 -0
  260. package/one/things/claude/agents/playbook-generator.md +503 -0
  261. package/one/things/claude/agents/pm.md +326 -0
  262. package/one/things/claude/agents/po.md +345 -0
  263. package/one/things/claude/agents/qa.md +336 -0
  264. package/one/things/claude/agents/research-foundation-analyst.md +307 -0
  265. package/one/things/claude/agents/research-intelligence-gatherer.md +408 -0
  266. package/one/things/claude/agents/research-market-analyst.md +307 -0
  267. package/one/things/claude/agents/research-team-manager.md +482 -0
  268. package/one/things/claude/agents/sales-environment-optimizer.md +494 -0
  269. package/one/things/claude/agents/sales-team-manager.md +400 -0
  270. package/one/things/claude/agents/sales-upsell-strategist.md +307 -0
  271. package/one/things/claude/agents/service-advocacy-campaigns.md +307 -0
  272. package/one/things/claude/agents/service-advocacy-manager.md +307 -0
  273. package/one/things/claude/agents/service-success-manager.md +307 -0
  274. package/one/things/claude/agents/service-team-manager.md +400 -0
  275. package/one/things/claude/agents/shadcn-ui-design-system-specialist.md +2302 -0
  276. package/one/things/claude/agents/share-optimization-specialist.md +551 -0
  277. package/one/things/claude/agents/sm.md +327 -0
  278. package/one/things/claude/agents/story-teller.md +473 -0
  279. package/one/things/claude/agents/task-master.md +596 -0
  280. package/one/things/claude/agents/tauri-cross-platform-specialist.md +1827 -0
  281. package/one/things/claude/agents/tester.md +556 -0
  282. package/one/things/claude/agents/the-bull-character-manager.md +580 -0
  283. package/one/things/claude/agents/tools-playbook-generator.md +489 -0
  284. package/one/things/claude/agents/turbo-repo-builder.md +316 -0
  285. package/one/things/claude/agents/upsell-strategist.md +480 -0
  286. package/one/things/claude/agents/ux-expert.md +335 -0
  287. package/one/things/claude/agents/viral-growth-orchestrator.md +497 -0
  288. package/one/things/claude/claude-code-hooks-development.json +21 -0
  289. package/one/things/claude/claude-code-hooks-production.json +21 -0
  290. package/one/things/claude/claude-code-hooks.json +25 -0
  291. package/one/things/claude/commands/agent.md +104 -0
  292. package/one/things/claude/commands/cascade-status.md +128 -0
  293. package/one/things/claude/commands/ingest.md +290 -0
  294. package/one/things/claude/commands/ingestor.md +136 -0
  295. package/one/things/claude/commands/mission.md +83 -0
  296. package/one/things/claude/commands/npx.md +133 -0
  297. package/one/things/claude/commands/one.md +440 -0
  298. package/one/things/claude/commands/quality-check.md +204 -0
  299. package/one/things/claude/commands/smart-route.md +220 -0
  300. package/one/things/claude/commands/start.md +121 -0
  301. package/one/things/claude/commands/story.md +83 -0
  302. package/one/things/claude/commands/task.md +173 -0
  303. package/one/things/claude/hook-bypass.json +32 -0
  304. package/one/things/claude/hooks/agent-hook-config.json +427 -0
  305. package/one/things/claude/hooks/agent-hook-manager.js +525 -0
  306. package/one/things/claude/hooks/agent-load-balancer.js +271 -0
  307. package/one/things/claude/hooks/agent-request-interceptor.js +70 -0
  308. package/one/things/claude/hooks/build-hook.sh +156 -0
  309. package/one/things/claude/hooks/cascade-feedback.js +297 -0
  310. package/one/things/claude/hooks/cascade-integration-hooks.js +648 -0
  311. package/one/things/claude/hooks/cleanup-hook.sh +201 -0
  312. package/one/things/claude/hooks/continuous-improvement-monitor.js +510 -0
  313. package/one/things/claude/hooks/file-organization-engine.js +427 -0
  314. package/one/things/claude/hooks/file-organization-hook.sh +80 -0
  315. package/one/things/claude/hooks/file-organization-monitor.js +269 -0
  316. package/one/things/claude/hooks/format-hook.sh +43 -0
  317. package/one/things/claude/hooks/hook-bypass.sh +293 -0
  318. package/one/things/claude/hooks/hook-config-manager.js +202 -0
  319. package/one/things/claude/hooks/hook-debouncer.sh +62 -0
  320. package/one/things/claude/hooks/hook-logger.sh +89 -0
  321. package/one/things/claude/hooks/hook-orchestrator.js +662 -0
  322. package/one/things/claude/hooks/hook-performance-report.js +120 -0
  323. package/one/things/claude/hooks/lint-hook.sh +140 -0
  324. package/one/things/claude/hooks/mcp-cascade-integration.js +816 -0
  325. package/one/things/claude/hooks/memory-optimizer.js +510 -0
  326. package/one/things/claude/hooks/notification-hook.sh +204 -0
  327. package/one/things/claude/hooks/ontology-compliance.js +394 -0
  328. package/one/things/claude/hooks/ontology-hook-manager.js +316 -0
  329. package/one/things/claude/hooks/ontology-validation-engine.js +317 -0
  330. package/one/things/claude/hooks/ontology-validation-hook.sh +86 -0
  331. package/one/things/claude/hooks/performance-metrics.json +25 -0
  332. package/one/things/claude/hooks/performance-monitoring-hook.js +422 -0
  333. package/one/things/claude/hooks/quality-scoring-engine.js +834 -0
  334. package/one/things/claude/hooks/security-hook.sh +256 -0
  335. package/one/things/claude/hooks/simple-load-balancer.js +238 -0
  336. package/one/things/claude/hooks/startup-optimizer.js +625 -0
  337. package/one/things/claude/hooks/story-scoring-system.js +445 -0
  338. package/one/things/claude/hooks/story-validation-engine.js +473 -0
  339. package/one/things/claude/hooks/story-validation-hook-enhanced.sh +210 -0
  340. package/one/things/claude/hooks/story-validation-hook.sh +145 -0
  341. package/one/things/claude/hooks/structure-synchronizer.js +194 -0
  342. package/one/things/claude/hooks/sub-agent-output-validator.js +647 -0
  343. package/one/things/claude/hooks/sub-agent-validation-hook.js +343 -0
  344. package/one/things/claude/hooks/test-hook.sh +145 -0
  345. package/one/things/claude/hooks/test-story-validation.sh +170 -0
  346. package/one/things/claude/hooks/trinity-validation-system.js +392 -0
  347. package/one/things/claude/settings-local.json +86 -0
  348. package/one/things/cli/cli-code.md +652 -0
  349. package/one/things/cli/cli-compiler-code.md +652 -0
  350. package/one/things/cli/cli.md +1068 -0
  351. package/one/things/components/card-shadcn.md +929 -0
  352. package/one/things/components/card.md +1050 -0
  353. package/one/things/components.md +1669 -0
  354. package/one/things/componets.md +4 -0
  355. package/one/things/creator-diagram.md +166 -0
  356. package/one/things/examples/children/lemonade-stand.md +366 -0
  357. package/one/things/examples/enterprise/crm-saas.md +1429 -0
  358. package/one/things/features/1-1-agent-prompts/design.md +470 -0
  359. package/one/things/features/1-1-agent-prompts/tests.md +264 -0
  360. package/one/things/features/1-1-agent-prompts.md +486 -0
  361. package/one/things/features/1-2-yaml-orchestrator/design.md +497 -0
  362. package/one/things/features/1-2-yaml-orchestrator/tests.md +227 -0
  363. package/one/things/features/1-2-yaml-orchestrator.md +516 -0
  364. package/one/things/features/1-3-event-coordination/design.md +544 -0
  365. package/one/things/features/1-3-event-coordination/tests.md +223 -0
  366. package/one/things/features/1-3-event-coordination.md +508 -0
  367. package/one/things/features/1-4-knowledge-management/design.md +609 -0
  368. package/one/things/features/1-4-knowledge-management/tests.md +195 -0
  369. package/one/things/features/1-4-knowledge-management.md +577 -0
  370. package/one/things/features/1-5-quality-loops/design.md +797 -0
  371. package/one/things/features/1-5-quality-loops/tests.md +212 -0
  372. package/one/things/features/1-5-quality-loops.md +641 -0
  373. package/one/things/features/1-6-numbering-structure/design.md +610 -0
  374. package/one/things/features/1-6-numbering-structure/tests.md +213 -0
  375. package/one/things/features/1-6-numbering-structure.md +575 -0
  376. package/one/things/features/2-1-dataprovider-interface.md +2358 -0
  377. package/one/things/features/2-2-config-system.md +3075 -0
  378. package/one/things/features/2-3-effectts-services.md +1498 -0
  379. package/one/things/features/2-4-react-hooks.md +2120 -0
  380. package/one/things/features/2-5-auth-migration.md +2046 -0
  381. package/one/things/features/2-6-dashboard-migration.md +1985 -0
  382. package/one/things/features/2-7-alternative-providers.md +2505 -0
  383. package/one/things/features/2-7-implementation-report.md +680 -0
  384. package/one/things/features/2-cli.md +1235 -0
  385. package/one/things/features/2-design.md +1738 -0
  386. package/one/things/features/2-tests.md +520 -0
  387. package/one/things/features/AUTH_HOOKS_IMPLEMENTATION.md +521 -0
  388. package/one/things/features/DECOUPLING.md +272 -0
  389. package/one/things/features/DEPLOYMENT.md +452 -0
  390. package/one/things/features/IMPLEMENTATION_SUMMARY.md +316 -0
  391. package/one/things/features/dataprovider-interface/1-tests.md +1522 -0
  392. package/one/things/features/improve.md +843 -0
  393. package/one/things/features/remove-convex-deps.md +45 -0
  394. package/one/things/features/top-features.md +79 -0
  395. package/one/things/features/use-one-backend.md +1180 -0
  396. package/one/things/ideas/1-create-workflow.md +189 -0
  397. package/one/things/ideas/2-backend-agnostic-frontend.md +384 -0
  398. package/one/things/plans/1-create-workflow-status.md +555 -0
  399. package/one/things/plans/1-create-workflow.md +713 -0
  400. package/one/things/plans/2-backend-agnostic-frontend.md +543 -0
  401. package/one/things/plans/3-groups.md +502 -0
  402. package/one/things/plans/app.md +761 -0
  403. package/one/things/plans/backend-agnostic-frontend.md +323 -0
  404. package/one/things/plans/better-auth-any-backend-revised.md +1065 -0
  405. package/one/things/plans/better-auth-any-backend.md +1852 -0
  406. package/one/things/plans/better-auth-available-features.md +235 -0
  407. package/one/things/plans/big-plan.md +38 -0
  408. package/one/things/plans/convex-better-auth.md +1109 -0
  409. package/one/things/plans/convex-on-off.md +389 -0
  410. package/one/things/plans/deploy-to-cloudflare.md +581 -0
  411. package/one/things/plans/desktop.md +1121 -0
  412. package/one/things/plans/effect-components.md +1669 -0
  413. package/one/things/plans/effect.md +973 -0
  414. package/one/things/plans/email.md +953 -0
  415. package/one/things/plans/enhance-auth.md +1669 -0
  416. package/one/things/plans/install-components.md +198 -0
  417. package/one/things/plans/landing.md +728 -0
  418. package/one/things/plans/layout.md +205 -0
  419. package/one/things/plans/mail-backend.md +1308 -0
  420. package/one/things/plans/mail.md +2624 -0
  421. package/one/things/plans/next-features.md +83 -0
  422. package/one/things/plans/one.md +658 -0
  423. package/one/things/plans/ontology-6-dimensions.md +2216 -0
  424. package/one/things/plans/ontology-driven-strategy.md +866 -0
  425. package/one/things/plans/ontology-ui-approach.md +357 -0
  426. package/one/things/plans/open-agent.md +785 -0
  427. package/one/things/plans/organizations-to-groups.md +705 -0
  428. package/one/things/plans/performace.md +90 -0
  429. package/one/things/plans/release.md +432 -0
  430. package/one/things/plans/releases.md +809 -0
  431. package/one/things/plans/repos.md +76 -0
  432. package/one/things/plans/separate-copy-2.md +1293 -0
  433. package/one/things/plans/separate-copy-3.md +2458 -0
  434. package/one/things/plans/separate-copy.md +1293 -0
  435. package/one/things/plans/separate.md +1983 -0
  436. package/one/things/plans/shadcn-integration-summary.md +450 -0
  437. package/one/things/plans/sidebar.md +172 -0
  438. package/one/things/plans/small-fixes.md +5 -0
  439. package/one/things/plans/test-backend-connection.md +476 -0
  440. package/one/things/plans/workflow-files.md +1196 -0
  441. package/one/things/plans/workflow.md +1372 -0
  442. package/one/things/products/cascade-landing-page.md +737 -0
  443. package/one/things/products/cascade.md +1518 -0
  444. package/one/things/products/context-engineering.md +1427 -0
  445. package/one/things/products/onthology.md +0 -0
  446. package/one/things/products/ontology-ui-shadcn.md +1280 -0
  447. package/one/things/products/ontology-ui.md +1387 -0
  448. package/one/things/products/ontology.md +717 -0
  449. package/one/things/products/sdk.md +557 -0
  450. package/one/things/promptkit.md +903 -0
  451. package/one/things/service-providers-new.md +982 -0
  452. package/one/things/service-providers.md +1092 -0
  453. package/one/things/system.md +600 -0
  454. package/one/things/tests/2-1-dataprovider-interface.md +1144 -0
  455. package/one/things/tests/2-1-test-analysis.md +496 -0
  456. package/one/things/things.md +349 -0
  457. package/one/things/todo.md +1248 -0
  458. package/one/things/vision/elegant-interface.md +214 -0
  459. package/package.json +5 -2
@@ -0,0 +1,1109 @@
1
+ # Adding Convex, Better Auth, and Better Auth UI to Your Astro Project
2
+
3
+ **This guide shows you exactly what to add to your existing Astro project** that already has React 19, Tailwind CSS 4.x, and shadcn/ui configured. You'll integrate a fresh Convex database backend with Better Auth for complete authentication (GitHub OAuth, Google OAuth, and email/password) using Better Auth UI's pre-built components.
4
+
5
+ ## 🎯 Implementation Status: Hybrid Approach
6
+
7
+ This project uses a **hybrid authentication system** that combines:
8
+ - **Custom Convex Backend**: Custom authentication mutations and queries for flexibility
9
+ - **Better Auth UI Frontend**: Beautiful, pre-built React components for the user interface
10
+
11
+ ### ✅ What's Implemented
12
+
13
+ #### Custom Convex Authentication Backend
14
+ - ✅ Convex database with custom schema (`users` and `sessions` tables)
15
+ - ✅ Custom auth mutations: `signUp`, `signIn`, `signOut`, `signInWithOAuth`
16
+ - ✅ Token-based session management with 30-day expiry
17
+ - ✅ SHA-256 password hashing (upgrade to bcrypt recommended for production)
18
+ - ✅ Secure httpOnly cookies for session tokens
19
+ - ✅ GitHub OAuth integration with custom handlers
20
+ - ✅ Google OAuth integration with custom handlers
21
+
22
+ #### Better Auth UI Integration
23
+ - ✅ Better Auth UI components library installed
24
+ - ✅ `AuthView` component for unified sign-in/sign-up experience
25
+ - ✅ `UserButton` component with dropdown menu
26
+ - ✅ `SettingsCards` component for account management
27
+ - ✅ `AuthUIProvider` wrapper for Better Auth UI configuration
28
+ - ✅ Better Auth UI styles integrated with shadcn/ui theme
29
+ - ✅ API bridge (`/api/auth/[...all].ts`) connecting UI to custom backend
30
+
31
+ #### Authentication Flow
32
+ - ✅ `/auth` - Unified authentication page with AuthView
33
+ - ✅ `/dashboard` - Protected route example with UserButton
34
+ - ✅ `/settings` - Account settings with SettingsCards
35
+ - ✅ Middleware for authentication checking on every request
36
+ - ✅ OAuth callback handlers for GitHub and Google
37
+ - ✅ Server-side cookie management for security
38
+
39
+ ### 📁 Key Files
40
+
41
+ **Frontend Components:**
42
+ - `src/components/AuthUIProvider.tsx` - Better Auth UI configuration wrapper
43
+ - `src/components/UserButton.tsx` - User button with Better Auth UI
44
+ - `src/lib/auth-client.ts` - Better Auth client for UI components
45
+ - `src/pages/auth.astro` - Unified authentication page
46
+ - `src/pages/settings.astro` - Account settings page
47
+ - `src/pages/dashboard.astro` - Example protected page
48
+
49
+ **Backend/API:**
50
+ - `convex/schema.ts` - Database schema (users, sessions)
51
+ - `convex/auth.ts` - Custom authentication mutations and queries
52
+ - `src/pages/api/auth/[...all].ts` - API bridge for Better Auth UI
53
+ - `src/pages/api/auth/github.ts` & `github/callback.ts` - GitHub OAuth
54
+ - `src/pages/api/auth/google.ts` & `google/callback.ts` - Google OAuth
55
+ - `src/pages/api/auth/set-cookie.ts` - Secure cookie setter
56
+ - `src/middleware.ts` - Authentication middleware
57
+
58
+ ### 🎨 Features
59
+
60
+ - **Email/Password Authentication**: Custom implementation with validation
61
+ - **OAuth (GitHub & Google)**: Full OAuth 2.0 flow with account linking
62
+ - **Session Management**: Token-based with secure httpOnly cookies
63
+ - **Protected Routes**: Middleware-based authentication checks
64
+ - **Beautiful UI**: Better Auth UI components with shadcn/ui theming
65
+ - **Account Settings**: Profile management, password changes, session viewing
66
+ - **Responsive Design**: Mobile-friendly authentication flows
67
+
68
+ ### 🚀 Why This Hybrid Approach?
69
+
70
+ 1. **Flexibility**: Custom backend allows full control over auth logic
71
+ 2. **Beautiful UI**: Better Auth UI provides production-ready components
72
+ 3. **Type Safety**: Convex provides end-to-end TypeScript safety
73
+ 4. **Performance**: Lightweight custom backend with no unnecessary dependencies
74
+ 5. **Maintainability**: Separation of concerns between backend logic and UI
75
+
76
+ ### 📝 Quick Start
77
+
78
+ 1. **Authentication Page**: Visit `/auth` for sign-in/sign-up
79
+ 2. **Dashboard**: Visit `/dashboard` (requires authentication)
80
+ 3. **Settings**: Visit `/settings` to manage your account
81
+ 4. **OAuth**: Click GitHub or Google buttons on auth page
82
+
83
+ ---
84
+
85
+ # Full Implementation Guide (Original Better Auth Component Approach)
86
+
87
+ The sections below describe the full Better Auth component integration. Our current implementation uses a hybrid approach (described above) that combines custom Convex auth with Better Auth UI components.
88
+
89
+ ## Prerequisites check
90
+
91
+ Before starting, confirm your existing project has:
92
+ - ✅ Astro with React 19 integration configured
93
+ - ✅ Tailwind CSS 4.x working
94
+ - ✅ shadcn/ui components installed with CSS variables enabled
95
+ - ✅ SSR or hybrid mode enabled (required for auth middleware)
96
+
97
+ ## Step 1: Install required packages
98
+
99
+ Install the authentication and database packages you'll need:
100
+
101
+ ```bash
102
+ npm install better-auth @daveyplate/better-auth-ui @convex-dev/better-auth convex@latest
103
+ ```
104
+
105
+ **What these do:**
106
+ - `better-auth` - Core authentication library (v1.3.23)
107
+ - `@daveyplate/better-auth-ui` - Pre-built React auth UI components (v3.2.5)
108
+ - `@convex-dev/better-auth` - Official Convex component for Better Auth (v0.8.6)
109
+ - `convex` - Convex backend client library
110
+
111
+ ## Step 2: Initialize Convex
112
+
113
+ Create your Convex project and start the development server:
114
+
115
+ ```bash
116
+ npx convex dev
117
+ ```
118
+
119
+ This command creates the Convex configuration files and starts a local dev server. Keep it running in a separate terminal—it auto-generates TypeScript types as you work.
120
+
121
+ **Files created:**
122
+ - `convex/` directory for backend functions
123
+ - `.env.local` with your `CONVEX_DEPLOYMENT` and `NEXT_PUBLIC_CONVEX_URL`
124
+
125
+ ## Step 3: Configure Astro for SSR
126
+
127
+ Authentication middleware requires server-side rendering. Update your Astro config:
128
+
129
+ ```javascript
130
+ // astro.config.mjs
131
+ import { defineConfig } from 'astro/config'
132
+ import react from '@astrojs/react'
133
+ import node from '@astrojs/node' // or vercel, netlify, cloudflare
134
+
135
+ export default defineConfig({
136
+ output: 'server', // Changed from 'static'
137
+ adapter: node({ mode: 'standalone' }),
138
+ integrations: [
139
+ react()
140
+ ]
141
+ })
142
+ ```
143
+
144
+ Install your adapter if not already present:
145
+
146
+ ```bash
147
+ npm install @astrojs/node
148
+ # or: npm install @astrojs/vercel
149
+ # or: npm install @astrojs/netlify
150
+ ```
151
+
152
+ ## Step 4: Register Convex Better Auth component
153
+
154
+ Create the Convex configuration file to register the Better Auth component:
155
+
156
+ ```typescript
157
+ // convex.config.ts
158
+ import { defineApp } from "convex/server"
159
+ import betterAuth from "@convex-dev/better-auth/convex.config"
160
+
161
+ const app = defineApp()
162
+ app.use(betterAuth)
163
+
164
+ export default app
165
+ ```
166
+
167
+ Configure the auth provider:
168
+
169
+ ```typescript
170
+ // convex/auth.config.ts
171
+ export default {
172
+ providers: [
173
+ {
174
+ domain: process.env.CONVEX_SITE_URL,
175
+ applicationID: "convex",
176
+ },
177
+ ],
178
+ }
179
+ ```
180
+
181
+ ## Step 5: Set up OAuth providers
182
+
183
+ ### Create GitHub OAuth App
184
+
185
+ Navigate to https://github.com/settings/developers and click "New OAuth App":
186
+
187
+ 1. **Application name**: Your app name
188
+ 2. **Homepage URL**: `http://localhost:4321` (Astro default)
189
+ 3. **Authorization callback URL**: `http://localhost:4321/api/auth/callback/github`
190
+ 4. Click "Register application"
191
+ 5. Generate a client secret and **save both Client ID and Client Secret immediately**
192
+
193
+ **For production**, create a separate OAuth app with your production domain:
194
+ - Callback URL: `https://yourdomain.com/api/auth/callback/github`
195
+
196
+ ### Create Google OAuth Credentials
197
+
198
+ Navigate to https://console.cloud.google.com/
199
+
200
+ 1. **Create or select a project**
201
+ 2. **Configure OAuth consent screen** (required first):
202
+ - Go to: APIs & Services → OAuth consent screen
203
+ - Select "External" user type
204
+ - Fill in app name, user support email, developer email
205
+ - Add scopes: `openid`, `email`, `profile`
206
+ - Add test users (for development)
207
+ - Save and continue
208
+
209
+ 3. **Create credentials**:
210
+ - Go to: APIs & Services → Credentials
211
+ - Click "Create Credentials" → "OAuth client ID"
212
+ - Application type: "Web application"
213
+ - **Authorized redirect URIs**:
214
+ - Add: `http://localhost:4321/api/auth/callback/google`
215
+ - Add: `https://yourdomain.com/api/auth/callback/google` (production)
216
+ - Click "Create"
217
+ - **Save Client ID and Client Secret immediately**
218
+
219
+ ## Step 6: Configure environment variables
220
+
221
+ Set your Convex environment variables (these go in the Convex dashboard, not your .env file):
222
+
223
+ ```bash
224
+ # Generate and set Better Auth secret
225
+ npx convex env set BETTER_AUTH_SECRET=$(openssl rand -base64 32)
226
+
227
+ # Set your site URL
228
+ npx convex env set SITE_URL http://localhost:4321
229
+
230
+ # Add OAuth credentials
231
+ npx convex env set GITHUB_CLIENT_ID your_github_client_id
232
+ npx convex env set GITHUB_CLIENT_SECRET your_github_client_secret
233
+ npx convex env set GOOGLE_CLIENT_ID your_google_client_id
234
+ npx convex env set GOOGLE_CLIENT_SECRET your_google_client_secret
235
+ ```
236
+
237
+ For production, add the `--prod` flag:
238
+
239
+ ```bash
240
+ npx convex env set BETTER_AUTH_SECRET your_production_secret --prod
241
+ npx convex env set SITE_URL https://yourdomain.com --prod
242
+ # ... repeat for other vars
243
+ ```
244
+
245
+ Your `.env.local` should already have (auto-created by `npx convex dev`):
246
+
247
+ ```bash
248
+ CONVEX_DEPLOYMENT=dev:adjective-animal-123
249
+ NEXT_PUBLIC_CONVEX_URL=https://adjective-animal-123.convex.cloud
250
+ ```
251
+
252
+ ## Step 7: Create Better Auth server instance
253
+
254
+ This file configures Better Auth on the Convex backend:
255
+
256
+ ```typescript
257
+ // convex/auth.ts
258
+ import { createClient, type GenericCtx } from "@convex-dev/better-auth"
259
+ import { convex } from "@convex-dev/better-auth/plugins"
260
+ import { components } from "./_generated/api"
261
+ import { DataModel } from "./_generated/dataModel"
262
+ import { query } from "./_generated/server"
263
+ import { betterAuth } from "better-auth"
264
+
265
+ const siteUrl = process.env.SITE_URL!
266
+
267
+ // Component client for Convex + Better Auth integration
268
+ export const authComponent = createClient<DataModel>(components.betterAuth)
269
+
270
+ // Create Better Auth instance with Convex adapter
271
+ export const createAuth = (
272
+ ctx: GenericCtx<DataModel>,
273
+ { optionsOnly } = { optionsOnly: false }
274
+ ) => {
275
+ return betterAuth({
276
+ logger: { disabled: optionsOnly },
277
+ baseURL: siteUrl,
278
+ database: authComponent.adapter(ctx),
279
+
280
+ // Email and password authentication
281
+ emailAndPassword: {
282
+ enabled: true,
283
+ requireEmailVerification: false,
284
+ },
285
+
286
+ // OAuth providers
287
+ socialProviders: {
288
+ github: {
289
+ clientId: process.env.GITHUB_CLIENT_ID as string,
290
+ clientSecret: process.env.GITHUB_CLIENT_SECRET as string,
291
+ },
292
+ google: {
293
+ clientId: process.env.GOOGLE_CLIENT_ID as string,
294
+ clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
295
+ accessType: "offline", // Get refresh tokens
296
+ prompt: "select_account", // Allow account selection
297
+ },
298
+ },
299
+
300
+ // REQUIRED: Convex plugin for compatibility
301
+ plugins: [convex()],
302
+ })
303
+ }
304
+
305
+ // Example query to get current authenticated user
306
+ export const getCurrentUser = query({
307
+ args: {},
308
+ handler: async (ctx) => {
309
+ return authComponent.getAuthUser(ctx)
310
+ },
311
+ })
312
+ ```
313
+
314
+ **Important note**: You'll see TypeScript errors until you save this file and Convex generates the types. Keep `npx convex dev` running.
315
+
316
+ ## Step 8: Register HTTP routes
317
+
318
+ Create the Convex HTTP router to handle Better Auth API endpoints:
319
+
320
+ ```typescript
321
+ // convex/http.ts
322
+ import { httpRouter } from "convex/server"
323
+ import { authComponent, createAuth } from "./auth"
324
+
325
+ const http = httpRouter()
326
+
327
+ // Register Better Auth routes
328
+ authComponent.registerRoutes(http, createAuth)
329
+
330
+ export default http
331
+ ```
332
+
333
+ ## Step 9: Create auth API route handler
334
+
335
+ Astro needs an API route to proxy auth requests to Convex. Create a catch-all route:
336
+
337
+ ```typescript
338
+ // src/pages/api/auth/[...all].ts
339
+ import type { APIRoute } from "astro"
340
+
341
+ export const prerender = false // Disable static generation
342
+
343
+ export const ALL: APIRoute = async ({ request }) => {
344
+ const convexUrl = import.meta.env.NEXT_PUBLIC_CONVEX_URL || import.meta.env.PUBLIC_CONVEX_URL
345
+
346
+ // Forward auth requests to Convex
347
+ const url = new URL(request.url)
348
+ const convexAuthUrl = `${convexUrl}/api/auth${url.pathname.replace('/api/auth', '')}`
349
+
350
+ return fetch(convexAuthUrl, {
351
+ method: request.method,
352
+ headers: request.headers,
353
+ body: request.body,
354
+ duplex: 'half'
355
+ } as RequestInit)
356
+ }
357
+ ```
358
+
359
+ ## Step 10: Create Better Auth client
360
+
361
+ Set up the client-side auth instance:
362
+
363
+ ```typescript
364
+ // src/lib/auth-client.ts
365
+ import { createAuthClient } from "better-auth/react"
366
+ import { convexClient } from "@convex-dev/better-auth/client/plugins"
367
+
368
+ export const authClient = createAuthClient({
369
+ plugins: [convexClient()],
370
+ })
371
+ ```
372
+
373
+ ## Step 11: Set up Convex client provider
374
+
375
+ Create a Convex provider component that integrates with Better Auth:
376
+
377
+ ```tsx
378
+ // src/components/ConvexClientProvider.tsx
379
+ "use client"
380
+
381
+ import { ReactNode } from "react"
382
+ import { ConvexReactClient } from "convex/react"
383
+ import { ConvexBetterAuthProvider } from "@convex-dev/better-auth/react"
384
+ import { authClient } from "@/lib/auth-client"
385
+
386
+ const convexUrl = import.meta.env.PUBLIC_CONVEX_URL || import.meta.env.NEXT_PUBLIC_CONVEX_URL
387
+
388
+ const convex = new ConvexReactClient(convexUrl)
389
+
390
+ export function ConvexClientProvider({ children }: { children: ReactNode }) {
391
+ return (
392
+ <ConvexBetterAuthProvider client={convex} authClient={authClient}>
393
+ {children}
394
+ </ConvexBetterAuthProvider>
395
+ )
396
+ }
397
+ ```
398
+
399
+ ## Step 12: Add Better Auth UI styles
400
+
401
+ Import Better Auth UI styles into your global CSS file:
402
+
403
+ ```css
404
+ /* src/styles/globals.css or wherever your Tailwind imports are */
405
+ @import "@daveyplate/better-auth-ui/css";
406
+
407
+ /* Your existing Tailwind directives */
408
+ @tailwind base;
409
+ @tailwind components;
410
+ @tailwind utilities;
411
+
412
+ /* Your existing shadcn/ui CSS variables remain unchanged */
413
+ ```
414
+
415
+ Better Auth UI inherits your shadcn/ui theming automatically since it's built on shadcn/ui components.
416
+
417
+ ## Step 13: Set up authentication middleware
418
+
419
+ Create middleware to check authentication status on every request:
420
+
421
+ ```typescript
422
+ // src/middleware.ts
423
+ import { defineMiddleware } from "astro:middleware"
424
+ import { authClient } from "./lib/auth-client"
425
+
426
+ export const onRequest = defineMiddleware(async (context, next) => {
427
+ try {
428
+ // Fetch session from Better Auth
429
+ const response = await fetch(
430
+ `${import.meta.env.PUBLIC_CONVEX_URL}/api/auth/get-session`,
431
+ {
432
+ headers: context.request.headers,
433
+ }
434
+ )
435
+
436
+ if (response.ok) {
437
+ const session = await response.json()
438
+ context.locals.user = session?.user || null
439
+ context.locals.session = session?.session || null
440
+ } else {
441
+ context.locals.user = null
442
+ context.locals.session = null
443
+ }
444
+ } catch (error) {
445
+ context.locals.user = null
446
+ context.locals.session = null
447
+ }
448
+
449
+ return next()
450
+ })
451
+ ```
452
+
453
+ Add TypeScript types for `Astro.locals`:
454
+
455
+ ```typescript
456
+ // src/env.d.ts
457
+ /// <reference path="../.astro/types.d.ts" />
458
+
459
+ declare namespace App {
460
+ interface Locals {
461
+ user: {
462
+ id: string
463
+ email: string
464
+ name?: string
465
+ image?: string
466
+ emailVerified: boolean
467
+ } | null
468
+ session: {
469
+ id: string
470
+ userId: string
471
+ expiresAt: Date
472
+ } | null
473
+ }
474
+ }
475
+ ```
476
+
477
+ ## Step 14: Create Auth UI Provider wrapper
478
+
479
+ Set up the Better Auth UI provider with your configuration:
480
+
481
+ ```tsx
482
+ // src/components/AuthProviders.tsx
483
+ "use client"
484
+
485
+ import { ReactNode } from "react"
486
+ import { AuthUIProvider } from "@daveyplate/better-auth-ui"
487
+ import { authClient } from "@/lib/auth-client"
488
+
489
+ // For Astro, we need to handle navigation differently
490
+ // This component will be used inside Astro islands
491
+ export function AuthProviders({ children }: { children: ReactNode }) {
492
+ const navigate = (path: string) => {
493
+ window.location.href = path
494
+ }
495
+
496
+ return (
497
+ <AuthUIProvider
498
+ authClient={authClient}
499
+ navigate={navigate}
500
+
501
+ // Social login configuration
502
+ social={{
503
+ providers: ["github", "google"],
504
+ signIn: "optional" // or "required"
505
+ }}
506
+
507
+ // Password requirements
508
+ credentials={{
509
+ passwordValidation: {
510
+ minLength: 8,
511
+ requireUppercase: true,
512
+ requireNumbers: true,
513
+ },
514
+ confirmPassword: true
515
+ }}
516
+
517
+ // Sign up customization
518
+ signUp={{
519
+ fields: ["name"]
520
+ }}
521
+
522
+ // Two-factor authentication
523
+ twoFactor={{
524
+ enabled: true,
525
+ methods: ["totp"]
526
+ }}
527
+
528
+ // Custom view paths (optional)
529
+ viewPaths={{
530
+ SIGN_IN: "sign-in",
531
+ SIGN_UP: "sign-up",
532
+ FORGOT_PASSWORD: "forgot-password",
533
+ RESET_PASSWORD: "reset-password",
534
+ }}
535
+ >
536
+ {children}
537
+ </AuthUIProvider>
538
+ )
539
+ }
540
+ ```
541
+
542
+ ## Step 15: Update your root layout
543
+
544
+ Wrap your application with both Convex and Auth providers:
545
+
546
+ ```astro
547
+ ---
548
+ // src/layouts/Layout.astro
549
+ import { ConvexClientProvider } from "@/components/ConvexClientProvider"
550
+ import { AuthProviders } from "@/components/AuthProviders"
551
+
552
+ interface Props {
553
+ title: string
554
+ }
555
+
556
+ const { title } = Astro.props
557
+ ---
558
+
559
+ <!doctype html>
560
+ <html lang="en">
561
+ <head>
562
+ <meta charset="UTF-8" />
563
+ <meta name="viewport" content="width=device-width" />
564
+ <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
565
+ <title>{title}</title>
566
+ </head>
567
+ <body>
568
+ <ConvexClientProvider client:only="react">
569
+ <AuthProviders client:only="react">
570
+ <slot />
571
+ </AuthProviders>
572
+ </ConvexClientProvider>
573
+ </body>
574
+ </html>
575
+ ```
576
+
577
+ **Critical**: Use `client:only="react"` for provider components to avoid hydration mismatches in Astro.
578
+
579
+ ## Step 16: Create authentication pages
580
+
581
+ Create a dynamic route to handle all auth views:
582
+
583
+ ```astro
584
+ ---
585
+ // src/pages/auth/[pathname].astro
586
+ import Layout from "@/layouts/Layout.astro"
587
+ import { AuthCard } from "@daveyplate/better-auth-ui"
588
+
589
+ export const prerender = false // Disable prerendering for auth pages
590
+
591
+ const { pathname } = Astro.params
592
+ ---
593
+
594
+ <Layout title="Authentication">
595
+ <main class="min-h-screen flex items-center justify-center bg-gradient-to-br from-background to-secondary/10">
596
+ <div class="w-full max-w-md px-4">
597
+ <AuthCard
598
+ pathname={pathname}
599
+ client:load
600
+ classNames={{
601
+ base: "shadow-xl",
602
+ header: "bg-gradient-to-r from-primary to-primary/80"
603
+ }}
604
+ />
605
+ </div>
606
+ </main>
607
+ </Layout>
608
+ ```
609
+
610
+ This single route handles all authentication flows:
611
+ - `/auth/sign-in` - Sign in page
612
+ - `/auth/sign-up` - Sign up page
613
+ - `/auth/forgot-password` - Password reset request
614
+ - `/auth/reset-password` - Password reset confirmation
615
+
616
+ ## Step 17: Create user interface components
617
+
618
+ Build components that use Better Auth UI and your auth state:
619
+
620
+ ```tsx
621
+ // src/components/UserButton.tsx
622
+ import { authClient } from "@/lib/auth-client"
623
+
624
+ export function UserButton() {
625
+ const { data: session, isPending } = authClient.useSession()
626
+
627
+ if (isPending) {
628
+ return <div className="h-9 w-9 rounded-full bg-muted animate-pulse" />
629
+ }
630
+
631
+ if (!session) {
632
+ return (
633
+ <a href="/auth/sign-in">
634
+ <button className="px-4 py-2 bg-primary text-primary-foreground rounded-md hover:bg-primary/90">
635
+ Sign In
636
+ </button>
637
+ </a>
638
+ )
639
+ }
640
+
641
+ return (
642
+ <div className="flex items-center gap-3">
643
+ <span className="text-sm">{session.user.name || session.user.email}</span>
644
+ <button
645
+ onClick={() => authClient.signOut()}
646
+ className="px-3 py-1.5 text-sm border rounded-md hover:bg-accent"
647
+ >
648
+ Sign Out
649
+ </button>
650
+ </div>
651
+ )
652
+ }
653
+ ```
654
+
655
+ Use it in your pages with appropriate hydration:
656
+
657
+ ```astro
658
+ ---
659
+ // src/pages/index.astro
660
+ import Layout from "@/layouts/Layout.astro"
661
+ import { UserButton } from "@/components/UserButton"
662
+ ---
663
+
664
+ <Layout title="Home">
665
+ <header class="border-b">
666
+ <div class="container mx-auto flex items-center justify-between py-4">
667
+ <h1 class="text-xl font-bold">My App</h1>
668
+ <UserButton client:load />
669
+ </div>
670
+ </header>
671
+
672
+ <main class="container mx-auto py-8">
673
+ <h2>Welcome!</h2>
674
+ </main>
675
+ </Layout>
676
+ ```
677
+
678
+ ## Step 18: Create protected routes
679
+
680
+ Implement route protection using middleware or page-level checks:
681
+
682
+ ### Method 1: Page-level protection
683
+
684
+ ```astro
685
+ ---
686
+ // src/pages/dashboard.astro
687
+ import Layout from "@/layouts/Layout.astro"
688
+ import { UserButton } from "@/components/UserButton"
689
+
690
+ export const prerender = false
691
+
692
+ // Redirect if not authenticated
693
+ const session = Astro.locals.session
694
+ if (!session) {
695
+ return Astro.redirect("/auth/sign-in?redirect=/dashboard")
696
+ }
697
+ ---
698
+
699
+ <Layout title="Dashboard">
700
+ <header class="border-b">
701
+ <div class="container mx-auto flex items-center justify-between py-4">
702
+ <h1 class="text-xl font-bold">Dashboard</h1>
703
+ <UserButton client:load />
704
+ </div>
705
+ </header>
706
+
707
+ <main class="container mx-auto py-8">
708
+ <h2>Welcome, {Astro.locals.user?.name}!</h2>
709
+ <p>Email: {Astro.locals.user?.email}</p>
710
+ </main>
711
+ </Layout>
712
+ ```
713
+
714
+ ### Method 2: Middleware-based route guards
715
+
716
+ Enhance your middleware to protect entire route patterns:
717
+
718
+ ```typescript
719
+ // src/middleware.ts
720
+ import { defineMiddleware, sequence } from "astro:middleware"
721
+
722
+ const authMiddleware = defineMiddleware(async (context, next) => {
723
+ // ... your existing session fetch code
724
+ return next()
725
+ })
726
+
727
+ const routeGuard = defineMiddleware(async ({ url, locals, redirect }, next) => {
728
+ const protectedRoutes = [
729
+ /^\/dashboard($|\/.*)/,
730
+ /^\/profile($|\/.*)/,
731
+ /^\/settings($|\/.*)/
732
+ ]
733
+
734
+ const isProtected = protectedRoutes.some(pattern => pattern.test(url.pathname))
735
+
736
+ if (isProtected && !locals.session) {
737
+ return redirect(`/auth/sign-in?redirect=${url.pathname}`)
738
+ }
739
+
740
+ return next()
741
+ })
742
+
743
+ export const onRequest = sequence(authMiddleware, routeGuard)
744
+ ```
745
+
746
+ ## Step 19: Create account settings page
747
+
748
+ Use Better Auth UI's settings components for a complete account management interface:
749
+
750
+ ```astro
751
+ ---
752
+ // src/pages/settings.astro
753
+ import Layout from "@/layouts/Layout.astro"
754
+ import { SettingsCards } from "@daveyplate/better-auth-ui"
755
+
756
+ export const prerender = false
757
+
758
+ const session = Astro.locals.session
759
+ if (!session) {
760
+ return Astro.redirect("/auth/sign-in?redirect=/settings")
761
+ }
762
+ ---
763
+
764
+ <Layout title="Account Settings">
765
+ <main class="container mx-auto py-8 max-w-2xl">
766
+ <h1 class="text-2xl font-bold mb-6">Account Settings</h1>
767
+ <SettingsCards client:load />
768
+ </main>
769
+ </Layout>
770
+ ```
771
+
772
+ The `SettingsCards` component automatically provides:
773
+ - Avatar upload
774
+ - Name and email changes
775
+ - Password management
776
+ - Two-factor authentication setup
777
+ - Active sessions management
778
+ - Linked social accounts
779
+ - Account deletion
780
+
781
+ ## Step 20: Use Better Auth with Convex queries
782
+
783
+ Access authenticated user data in Convex queries and mutations:
784
+
785
+ ```typescript
786
+ // convex/messages.ts
787
+ import { query, mutation } from "./_generated/server"
788
+ import { v } from "convex/values"
789
+ import { authComponent } from "./auth"
790
+
791
+ // Protected query
792
+ export const getMyMessages = query({
793
+ args: {},
794
+ handler: async (ctx) => {
795
+ const user = await authComponent.getAuthUser(ctx)
796
+
797
+ if (!user) {
798
+ throw new Error("Not authenticated")
799
+ }
800
+
801
+ return await ctx.db
802
+ .query("messages")
803
+ .filter((q) => q.eq(q.field("userId"), user.id))
804
+ .collect()
805
+ },
806
+ })
807
+
808
+ // Protected mutation
809
+ export const createMessage = mutation({
810
+ args: { content: v.string() },
811
+ handler: async (ctx, args) => {
812
+ const user = await authComponent.getAuthUser(ctx)
813
+
814
+ if (!user) {
815
+ throw new Error("Not authenticated")
816
+ }
817
+
818
+ await ctx.db.insert("messages", {
819
+ content: args.content,
820
+ userId: user.id,
821
+ createdAt: Date.now(),
822
+ })
823
+ },
824
+ })
825
+ ```
826
+
827
+ Use these queries in your React components:
828
+
829
+ ```tsx
830
+ // src/components/MessageList.tsx
831
+ import { useQuery, useMutation } from "convex/react"
832
+ import { api } from "../../convex/_generated/api"
833
+
834
+ export function MessageList() {
835
+ const messages = useQuery(api.messages.getMyMessages)
836
+ const createMessage = useMutation(api.messages.createMessage)
837
+
838
+ if (!messages) return <div>Loading...</div>
839
+
840
+ return (
841
+ <div>
842
+ <ul>
843
+ {messages.map((msg) => (
844
+ <li key={msg._id}>{msg.content}</li>
845
+ ))}
846
+ </ul>
847
+ <button onClick={() => createMessage({ content: "Hello!" })}>
848
+ Send Message
849
+ </button>
850
+ </div>
851
+ )
852
+ }
853
+ ```
854
+
855
+ ## Customizing Better Auth UI with Tailwind 4
856
+
857
+ Better Auth UI uses your existing shadcn/ui theme automatically. To customize further, modify your CSS variables:
858
+
859
+ ```css
860
+ /* src/styles/globals.css */
861
+
862
+ :root {
863
+ /* These variables are already defined by shadcn/ui */
864
+ /* Override them to customize Better Auth UI appearance */
865
+ --primary: oklch(0.55 0.25 262); /* Brand color */
866
+ --radius: 1rem; /* More rounded corners */
867
+ }
868
+
869
+ .dark {
870
+ /* Dark mode overrides work automatically */
871
+ --primary: oklch(0.75 0.2 262);
872
+ }
873
+ ```
874
+
875
+ Customize individual Better Auth UI components with classNames:
876
+
877
+ ```tsx
878
+ <AuthCard
879
+ pathname="sign-in"
880
+ classNames={{
881
+ base: "border-2 border-primary/20 shadow-2xl",
882
+ header: "bg-gradient-to-r from-primary to-secondary",
883
+ title: "text-2xl",
884
+ footerLink: "text-primary hover:text-primary/80"
885
+ }}
886
+ />
887
+ ```
888
+
889
+ ## Testing your authentication flow
890
+
891
+ ### Test email/password signup
892
+
893
+ 1. Navigate to `http://localhost:4321/auth/sign-up`
894
+ 2. Fill in name, email, and password
895
+ 3. Click "Sign Up"
896
+ 4. You should be signed in and redirected
897
+ 5. Check Convex dashboard to see the user record created
898
+
899
+ ### Test OAuth flows
900
+
901
+ **GitHub:**
902
+ 1. Navigate to `http://localhost:4321/auth/sign-in`
903
+ 2. Click "Sign in with GitHub"
904
+ 3. Authorize the application (first time only)
905
+ 4. You'll be redirected back and signed in
906
+
907
+ **Google:**
908
+ 1. Navigate to `http://localhost:4321/auth/sign-in`
909
+ 2. Click "Sign in with Google"
910
+ 3. Select your Google account
911
+ 4. Authorize the application
912
+ 5. You'll be redirected back and signed in
913
+
914
+ ### Test protected routes
915
+
916
+ 1. Sign out if signed in
917
+ 2. Try to access `http://localhost:4321/dashboard`
918
+ 3. You should be redirected to sign-in
919
+ 4. Sign in and you'll be redirected to dashboard
920
+
921
+ ### Test account settings
922
+
923
+ 1. Sign in to your account
924
+ 2. Navigate to `http://localhost:4321/settings`
925
+ 3. Test changing your name, email, or password
926
+ 4. Test linking additional OAuth providers
927
+ 5. Test session management
928
+
929
+ ## Common integration issues and solutions
930
+
931
+ ### Issue: Middleware not working
932
+
933
+ **Symptom**: `Astro.locals.session` is always null
934
+
935
+ **Solution**: Ensure you're using SSR mode, not static:
936
+
937
+ ```javascript
938
+ // astro.config.mjs
939
+ export default defineConfig({
940
+ output: 'server', // Not 'static'
941
+ adapter: node()
942
+ })
943
+ ```
944
+
945
+ ### Issue: Hydration mismatch errors
946
+
947
+ **Symptom**: React hydration errors in console
948
+
949
+ **Solution**: Use `client:only="react"` for auth providers and components that access session state during render:
950
+
951
+ ```astro
952
+ <ConvexClientProvider client:only="react">
953
+ <AuthProviders client:only="react">
954
+ <slot />
955
+ </AuthProviders>
956
+ </ConvexClientProvider>
957
+ ```
958
+
959
+ ### Issue: OAuth callback 404 errors
960
+
961
+ **Symptom**: OAuth redirects result in 404
962
+
963
+ **Solution**: Verify your callback URLs match exactly:
964
+ - In GitHub/Google OAuth settings
965
+ - In your environment variables
966
+ - Use `http://localhost:4321` for local dev (Astro's default port)
967
+
968
+ ### Issue: CORS errors with Convex
969
+
970
+ **Symptom**: API requests to Convex fail with CORS errors
971
+
972
+ **Solution**: Ensure your Convex `SITE_URL` environment variable matches your actual site URL:
973
+
974
+ ```bash
975
+ npx convex env set SITE_URL http://localhost:4321
976
+ ```
977
+
978
+ ### Issue: Session not persisting
979
+
980
+ **Symptom**: Users get signed out on page refresh
981
+
982
+ **Solution**: Check that cookies are being set. Better Auth uses HTTP-only cookies by default. Ensure:
983
+ 1. Your site URL is configured correctly
984
+ 2. You're not blocking cookies in browser
985
+ 3. In production, ensure HTTPS is enabled
986
+
987
+ ### Issue: TypeScript errors in convex/auth.ts
988
+
989
+ **Symptom**: Import errors for generated types
990
+
991
+ **Solution**: Keep `npx convex dev` running. It auto-generates types. Save the file and wait a few seconds for generation to complete.
992
+
993
+ ### Issue: React Context not working across islands
994
+
995
+ **Symptom**: Auth state not shared between components
996
+
997
+ **Solution**: Better Auth uses Nano Stores internally, so `authClient.useSession()` works across separate Astro islands automatically. Don't try to use React Context—it doesn't work across islands.
998
+
999
+ ### Issue: Better Auth UI styles not applying
1000
+
1001
+ **Symptom**: Auth components look unstyled
1002
+
1003
+ **Solution**: Ensure you imported Better Auth UI CSS:
1004
+
1005
+ ```css
1006
+ /* src/styles/globals.css */
1007
+ @import "@daveyplate/better-auth-ui/css";
1008
+ ```
1009
+
1010
+ And that shadcn/ui is configured with CSS variables enabled in your `components.json`.
1011
+
1012
+ ## Production deployment checklist
1013
+
1014
+ Before deploying to production:
1015
+
1016
+ ### Environment variables
1017
+
1018
+ - [ ] Set production `BETTER_AUTH_SECRET` (different from dev)
1019
+ - [ ] Set production `SITE_URL` to your actual domain
1020
+ - [ ] Update OAuth app callback URLs to production domain
1021
+ - [ ] Set all OAuth credentials in production Convex environment
1022
+ - [ ] Never commit `.env` files to version control
1023
+
1024
+ ### OAuth configuration
1025
+
1026
+ - [ ] Create separate production OAuth apps for GitHub/Google
1027
+ - [ ] Update callback URLs to production domain
1028
+ - [ ] For Google: Consider publishing your OAuth consent screen for public use
1029
+ - [ ] Test OAuth flows in production environment
1030
+
1031
+ ### Security
1032
+
1033
+ - [ ] Enable HTTPS in production (required for secure cookies)
1034
+ - [ ] Review your `trustedOrigins` in Better Auth config
1035
+ - [ ] Set up proper CORS if frontend is on different domain
1036
+ - [ ] Enable email verification for production accounts
1037
+ - [ ] Consider adding rate limiting for auth endpoints
1038
+
1039
+ ### Database
1040
+
1041
+ - [ ] Deploy Convex functions: `npx convex deploy`
1042
+ - [ ] Verify database migrations completed successfully
1043
+ - [ ] Test authentication flows in production
1044
+ - [ ] Set up monitoring for auth-related errors
1045
+
1046
+ ## File structure overview
1047
+
1048
+ Your project should now have these new files:
1049
+
1050
+ ```
1051
+ your-project/
1052
+ ├── src/
1053
+ │ ├── components/
1054
+ │ │ ├── ConvexClientProvider.tsx # NEW
1055
+ │ │ ├── AuthProviders.tsx # NEW
1056
+ │ │ └── UserButton.tsx # NEW
1057
+ │ ├── lib/
1058
+ │ │ └── auth-client.ts # NEW
1059
+ │ ├── pages/
1060
+ │ │ ├── auth/
1061
+ │ │ │ └── [pathname].astro # NEW
1062
+ │ │ ├── api/
1063
+ │ │ │ └── auth/
1064
+ │ │ │ └── [...all].ts # NEW
1065
+ │ │ ├── settings.astro # NEW
1066
+ │ │ └── dashboard.astro # NEW (example)
1067
+ │ ├── middleware.ts # NEW
1068
+ │ └── env.d.ts # UPDATED
1069
+ ├── convex/
1070
+ │ ├── auth.config.ts # NEW
1071
+ │ ├── auth.ts # NEW
1072
+ │ ├── http.ts # NEW
1073
+ │ └── messages.ts # NEW (example)
1074
+ ├── convex.config.ts # NEW
1075
+ └── astro.config.mjs # UPDATED
1076
+ ```
1077
+
1078
+ ## React 19 compatibility notes
1079
+
1080
+ Better Auth and Better Auth UI have no known issues with React 19. Both libraries were developed with modern React patterns and use standard hooks that are fully compatible with React 19. Unlike some older authentication libraries (like NextAuth v4), Better Auth was built with the latest React ecosystem in mind and doesn't have legacy dependencies that conflict with React 19.
1081
+
1082
+ ## Next steps and advanced features
1083
+
1084
+ Now that you have authentication working, consider adding:
1085
+
1086
+ **Two-factor authentication**: Already configured—users can enable it in settings
1087
+
1088
+ **Email verification**: Update your auth config:
1089
+ ```typescript
1090
+ emailAndPassword: {
1091
+ enabled: true,
1092
+ requireEmailVerification: true,
1093
+ sendVerificationEmail: async ({ user, url }) => {
1094
+ // Implement email sending (Resend, SendGrid, etc.)
1095
+ }
1096
+ }
1097
+ ```
1098
+
1099
+ **Organizations/Multi-tenancy**: Add the organizations plugin to Better Auth for team management
1100
+
1101
+ **Magic link authentication**: Enable passwordless login via email
1102
+
1103
+ **Passkeys/WebAuthn**: Add biometric authentication support
1104
+
1105
+ **Rate limiting**: Protect auth endpoints from brute force attacks
1106
+
1107
+ **Custom user fields**: Add additional fields to user profiles using Better Auth's `additionalFields` configuration
1108
+
1109
+ This integration gives you a production-ready authentication system with minimal code. Better Auth UI handles all the complex UI flows, Convex manages your backend securely, and everything integrates seamlessly with your existing Astro + React 19 + Tailwind 4 + shadcn/ui stack.