hazo_auth 1.4.2 → 1.6.1

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 (354) hide show
  1. package/README.md +65 -19
  2. package/SETUP_CHECKLIST.md +779 -0
  3. package/dist/app/api/hazo_auth/change_password/route.d.ts +8 -0
  4. package/dist/app/api/hazo_auth/change_password/route.d.ts.map +1 -0
  5. package/dist/app/api/hazo_auth/change_password/route.js +98 -0
  6. package/dist/app/api/hazo_auth/forgot_password/route.d.ts +8 -0
  7. package/dist/app/api/hazo_auth/forgot_password/route.d.ts.map +1 -0
  8. package/dist/app/api/hazo_auth/forgot_password/route.js +78 -0
  9. package/dist/app/api/hazo_auth/get_auth/route.d.ts +10 -0
  10. package/dist/app/api/hazo_auth/get_auth/route.d.ts.map +1 -0
  11. package/dist/app/api/hazo_auth/get_auth/route.js +63 -0
  12. package/dist/app/api/hazo_auth/invalidate_cache/route.d.ts +14 -0
  13. package/dist/app/api/hazo_auth/invalidate_cache/route.d.ts.map +1 -0
  14. package/dist/app/api/hazo_auth/invalidate_cache/route.js +96 -0
  15. package/dist/app/api/hazo_auth/library_photo/[category]/[filename]/route.d.ts +9 -0
  16. package/dist/app/api/hazo_auth/library_photo/[category]/[filename]/route.d.ts.map +1 -0
  17. package/dist/app/api/hazo_auth/library_photo/[category]/[filename]/route.js +82 -0
  18. package/dist/app/api/hazo_auth/library_photos/route.d.ts +22 -0
  19. package/dist/app/api/hazo_auth/library_photos/route.d.ts.map +1 -0
  20. package/dist/app/api/hazo_auth/library_photos/route.js +80 -0
  21. package/dist/app/api/hazo_auth/login/route.d.ts +12 -0
  22. package/dist/app/api/hazo_auth/login/route.d.ts.map +1 -0
  23. package/dist/app/api/hazo_auth/login/route.js +140 -0
  24. package/dist/app/api/hazo_auth/logout/route.d.ts +8 -0
  25. package/dist/app/api/hazo_auth/logout/route.d.ts.map +1 -0
  26. package/dist/app/api/hazo_auth/logout/route.js +71 -0
  27. package/dist/app/api/hazo_auth/me/route.d.ts +3 -0
  28. package/dist/app/api/hazo_auth/me/route.d.ts.map +1 -0
  29. package/dist/app/api/hazo_auth/me/route.js +34 -0
  30. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.d.ts +7 -0
  31. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.d.ts.map +1 -0
  32. package/dist/app/api/hazo_auth/profile_picture/[filename]/route.js +43 -0
  33. package/dist/app/api/hazo_auth/register/route.d.ts +9 -0
  34. package/dist/app/api/hazo_auth/register/route.d.ts.map +1 -0
  35. package/dist/app/api/hazo_auth/register/route.js +80 -0
  36. package/dist/app/api/hazo_auth/remove_profile_picture/route.d.ts +8 -0
  37. package/dist/app/api/hazo_auth/remove_profile_picture/route.d.ts.map +1 -0
  38. package/dist/app/api/hazo_auth/remove_profile_picture/route.js +64 -0
  39. package/dist/app/api/hazo_auth/resend_verification/route.d.ts +8 -0
  40. package/dist/app/api/hazo_auth/resend_verification/route.d.ts.map +1 -0
  41. package/dist/app/api/hazo_auth/resend_verification/route.js +79 -0
  42. package/dist/app/api/hazo_auth/reset_password/route.d.ts +8 -0
  43. package/dist/app/api/hazo_auth/reset_password/route.d.ts.map +1 -0
  44. package/dist/app/api/hazo_auth/reset_password/route.js +76 -0
  45. package/dist/app/api/hazo_auth/update_user/route.d.ts +9 -0
  46. package/dist/app/api/hazo_auth/update_user/route.d.ts.map +1 -0
  47. package/dist/app/api/hazo_auth/update_user/route.js +95 -0
  48. package/dist/app/api/hazo_auth/upload_profile_picture/route.d.ts +9 -0
  49. package/dist/app/api/hazo_auth/upload_profile_picture/route.d.ts.map +1 -0
  50. package/dist/app/api/hazo_auth/upload_profile_picture/route.js +204 -0
  51. package/dist/app/api/hazo_auth/validate_reset_token/route.d.ts +6 -0
  52. package/dist/app/api/hazo_auth/validate_reset_token/route.d.ts.map +1 -0
  53. package/dist/app/api/hazo_auth/validate_reset_token/route.js +58 -0
  54. package/dist/app/api/hazo_auth/verify_email/route.d.ts +11 -0
  55. package/dist/app/api/hazo_auth/verify_email/route.d.ts.map +1 -0
  56. package/dist/app/api/hazo_auth/verify_email/route.js +63 -0
  57. package/dist/cli/generate.d.ts +7 -0
  58. package/dist/cli/generate.d.ts.map +1 -0
  59. package/dist/cli/generate.js +184 -0
  60. package/dist/cli/index.d.ts +3 -0
  61. package/dist/cli/index.d.ts.map +1 -0
  62. package/dist/cli/index.js +173 -0
  63. package/dist/cli/init.d.ts +2 -0
  64. package/dist/cli/init.d.ts.map +1 -0
  65. package/dist/cli/init.js +201 -0
  66. package/dist/cli/validate.d.ts +15 -0
  67. package/dist/cli/validate.d.ts.map +1 -0
  68. package/dist/cli/validate.js +509 -0
  69. package/dist/components/ui/card.d.ts +9 -0
  70. package/dist/components/ui/card.d.ts.map +1 -0
  71. package/dist/components/ui/card.js +45 -0
  72. package/dist/hooks/use-mobile.d.ts.map +1 -1
  73. package/dist/hooks/use-mobile.js +17 -3
  74. package/dist/lib/services/profile_picture_service.d.ts +34 -2
  75. package/dist/lib/services/profile_picture_service.d.ts.map +1 -1
  76. package/dist/lib/services/profile_picture_service.js +157 -15
  77. package/dist/page_components/forgot_password.d.ts +19 -0
  78. package/dist/page_components/forgot_password.d.ts.map +1 -0
  79. package/dist/page_components/forgot_password.js +36 -0
  80. package/dist/page_components/index.d.ts +7 -0
  81. package/dist/page_components/index.d.ts.map +1 -0
  82. package/dist/page_components/index.js +9 -0
  83. package/dist/page_components/login.d.ts +26 -0
  84. package/dist/page_components/login.d.ts.map +1 -0
  85. package/dist/page_components/login.js +40 -0
  86. package/dist/page_components/my_settings.d.ts +64 -0
  87. package/dist/page_components/my_settings.d.ts.map +1 -0
  88. package/dist/page_components/my_settings.js +67 -0
  89. package/dist/page_components/register.d.ts +25 -0
  90. package/dist/page_components/register.d.ts.map +1 -0
  91. package/dist/page_components/register.js +43 -0
  92. package/dist/page_components/reset_password.d.ts +25 -0
  93. package/dist/page_components/reset_password.d.ts.map +1 -0
  94. package/dist/page_components/reset_password.js +43 -0
  95. package/dist/page_components/verify_email.d.ts +21 -0
  96. package/dist/page_components/verify_email.d.ts.map +1 -0
  97. package/dist/page_components/verify_email.js +36 -0
  98. package/dist/server/routes/change_password.d.ts +2 -0
  99. package/dist/server/routes/change_password.d.ts.map +1 -0
  100. package/dist/server/routes/change_password.js +2 -0
  101. package/dist/server/routes/forgot_password.d.ts +2 -0
  102. package/dist/server/routes/forgot_password.d.ts.map +1 -0
  103. package/dist/server/routes/forgot_password.js +2 -0
  104. package/dist/server/routes/get_auth.d.ts +2 -0
  105. package/dist/server/routes/get_auth.d.ts.map +1 -0
  106. package/dist/server/routes/get_auth.js +2 -0
  107. package/dist/server/routes/index.d.ts +19 -0
  108. package/dist/server/routes/index.d.ts.map +1 -0
  109. package/dist/server/routes/index.js +25 -0
  110. package/dist/server/routes/invalidate_cache.d.ts +2 -0
  111. package/dist/server/routes/invalidate_cache.d.ts.map +1 -0
  112. package/dist/server/routes/invalidate_cache.js +2 -0
  113. package/dist/server/routes/library_photo.d.ts +2 -0
  114. package/dist/server/routes/library_photo.d.ts.map +1 -0
  115. package/dist/server/routes/library_photo.js +3 -0
  116. package/dist/server/routes/library_photos.d.ts +2 -0
  117. package/dist/server/routes/library_photos.d.ts.map +1 -0
  118. package/dist/server/routes/library_photos.js +2 -0
  119. package/dist/server/routes/login.d.ts +2 -0
  120. package/dist/server/routes/login.d.ts.map +1 -0
  121. package/dist/server/routes/login.js +2 -0
  122. package/dist/server/routes/logout.d.ts +2 -0
  123. package/dist/server/routes/logout.d.ts.map +1 -0
  124. package/dist/server/routes/logout.js +2 -0
  125. package/dist/server/routes/me.d.ts +2 -0
  126. package/dist/server/routes/me.d.ts.map +1 -0
  127. package/dist/server/routes/me.js +2 -0
  128. package/dist/server/routes/profile_picture_filename.d.ts +2 -0
  129. package/dist/server/routes/profile_picture_filename.d.ts.map +1 -0
  130. package/dist/server/routes/profile_picture_filename.js +3 -0
  131. package/dist/server/routes/register.d.ts +2 -0
  132. package/dist/server/routes/register.d.ts.map +1 -0
  133. package/dist/server/routes/register.js +2 -0
  134. package/dist/server/routes/remove_profile_picture.d.ts +2 -0
  135. package/dist/server/routes/remove_profile_picture.d.ts.map +1 -0
  136. package/dist/server/routes/remove_profile_picture.js +2 -0
  137. package/dist/server/routes/resend_verification.d.ts +2 -0
  138. package/dist/server/routes/resend_verification.d.ts.map +1 -0
  139. package/dist/server/routes/resend_verification.js +2 -0
  140. package/dist/server/routes/reset_password.d.ts +2 -0
  141. package/dist/server/routes/reset_password.d.ts.map +1 -0
  142. package/dist/server/routes/reset_password.js +2 -0
  143. package/dist/server/routes/update_user.d.ts +2 -0
  144. package/dist/server/routes/update_user.d.ts.map +1 -0
  145. package/dist/server/routes/update_user.js +2 -0
  146. package/dist/server/routes/upload_profile_picture.d.ts +2 -0
  147. package/dist/server/routes/upload_profile_picture.d.ts.map +1 -0
  148. package/dist/server/routes/upload_profile_picture.js +2 -0
  149. package/dist/server/routes/validate_reset_token.d.ts +2 -0
  150. package/dist/server/routes/validate_reset_token.d.ts.map +1 -0
  151. package/dist/server/routes/validate_reset_token.js +2 -0
  152. package/dist/server/routes/verify_email.d.ts +2 -0
  153. package/dist/server/routes/verify_email.d.ts.map +1 -0
  154. package/dist/server/routes/verify_email.js +2 -0
  155. package/package.json +40 -17
  156. package/components.json +0 -22
  157. package/instrumentation.ts +0 -32
  158. package/migrations/001_add_token_type_to_refresh_tokens.sql +0 -14
  159. package/migrations/002_add_name_to_hazo_users.sql +0 -7
  160. package/migrations/003_add_url_on_logon_to_hazo_users.sql +0 -8
  161. package/next.config.mjs +0 -67
  162. package/postcss.config.mjs +0 -8
  163. package/public/file.svg +0 -1
  164. package/public/globe.svg +0 -1
  165. package/public/next.svg +0 -1
  166. package/public/vercel.svg +0 -1
  167. package/public/window.svg +0 -1
  168. package/scripts/apply_migration.ts +0 -118
  169. package/scripts/init_users.ts +0 -378
  170. package/src/app/api/hazo_auth/auth/upload_profile_picture/route.ts +0 -268
  171. package/src/app/api/hazo_auth/change_password/route.ts +0 -132
  172. package/src/app/api/hazo_auth/forgot_password/route.ts +0 -107
  173. package/src/app/api/hazo_auth/get_auth/route.ts +0 -89
  174. package/src/app/api/hazo_auth/invalidate_cache/route.ts +0 -139
  175. package/src/app/api/hazo_auth/library_photos/route.ts +0 -73
  176. package/src/app/api/hazo_auth/login/route.ts +0 -181
  177. package/src/app/api/hazo_auth/logout/route.ts +0 -89
  178. package/src/app/api/hazo_auth/me/route.ts +0 -47
  179. package/src/app/api/hazo_auth/profile_picture/[filename]/route.ts +0 -67
  180. package/src/app/api/hazo_auth/register/route.ts +0 -109
  181. package/src/app/api/hazo_auth/remove_profile_picture/route.ts +0 -86
  182. package/src/app/api/hazo_auth/resend_verification/route.ts +0 -108
  183. package/src/app/api/hazo_auth/reset_password/route.ts +0 -107
  184. package/src/app/api/hazo_auth/update_user/route.ts +0 -126
  185. package/src/app/api/hazo_auth/upload_profile_picture/route.ts +0 -268
  186. package/src/app/api/hazo_auth/user_management/permissions/route.ts +0 -367
  187. package/src/app/api/hazo_auth/user_management/roles/route.ts +0 -442
  188. package/src/app/api/hazo_auth/user_management/users/roles/route.ts +0 -367
  189. package/src/app/api/hazo_auth/user_management/users/route.ts +0 -239
  190. package/src/app/api/hazo_auth/validate_reset_token/route.ts +0 -83
  191. package/src/app/api/hazo_auth/verify_email/route.ts +0 -88
  192. package/src/app/api/migrations/apply/route.ts +0 -91
  193. package/src/app/favicon.ico +0 -0
  194. package/src/app/fonts/GeistMonoVF.woff +0 -0
  195. package/src/app/fonts/GeistVF.woff +0 -0
  196. package/src/app/globals.css +0 -89
  197. package/src/app/hazo_auth/forgot_password/forgot_password_page_client.tsx +0 -60
  198. package/src/app/hazo_auth/forgot_password/page.tsx +0 -24
  199. package/src/app/hazo_auth/login/login_page_client.tsx +0 -86
  200. package/src/app/hazo_auth/login/page.tsx +0 -38
  201. package/src/app/hazo_auth/my_settings/my_settings_page_client.tsx +0 -120
  202. package/src/app/hazo_auth/my_settings/page.tsx +0 -40
  203. package/src/app/hazo_auth/register/page.tsx +0 -36
  204. package/src/app/hazo_auth/register/register_page_client.tsx +0 -81
  205. package/src/app/hazo_auth/reset_password/page.tsx +0 -29
  206. package/src/app/hazo_auth/reset_password/reset_password_page_client.tsx +0 -81
  207. package/src/app/hazo_auth/user_management/page.tsx +0 -14
  208. package/src/app/hazo_auth/user_management/user_management_page_client.tsx +0 -16
  209. package/src/app/hazo_auth/verify_email/page.tsx +0 -24
  210. package/src/app/hazo_auth/verify_email/verify_email_page_client.tsx +0 -60
  211. package/src/app/hazo_connect/api/sqlite/data/route.ts +0 -203
  212. package/src/app/hazo_connect/api/sqlite/schema/route.ts +0 -45
  213. package/src/app/hazo_connect/api/sqlite/tables/route.ts +0 -36
  214. package/src/app/hazo_connect/sqlite_admin/page.tsx +0 -51
  215. package/src/app/hazo_connect/sqlite_admin/sqlite-admin-client.tsx +0 -984
  216. package/src/app/layout.tsx +0 -43
  217. package/src/app/page.tsx +0 -170
  218. package/src/components/index.ts +0 -7
  219. package/src/components/layouts/email_verification/config/email_verification_field_config.ts +0 -86
  220. package/src/components/layouts/email_verification/hooks/use_email_verification.ts +0 -297
  221. package/src/components/layouts/email_verification/index.tsx +0 -297
  222. package/src/components/layouts/forgot_password/config/forgot_password_field_config.ts +0 -58
  223. package/src/components/layouts/forgot_password/hooks/use_forgot_password_form.ts +0 -179
  224. package/src/components/layouts/forgot_password/index.tsx +0 -168
  225. package/src/components/layouts/index.ts +0 -26
  226. package/src/components/layouts/login/config/login_field_config.ts +0 -67
  227. package/src/components/layouts/login/hooks/use_login_form.ts +0 -286
  228. package/src/components/layouts/login/index.tsx +0 -252
  229. package/src/components/layouts/my_settings/components/editable_field.tsx +0 -177
  230. package/src/components/layouts/my_settings/components/password_change_dialog.tsx +0 -301
  231. package/src/components/layouts/my_settings/components/profile_picture_dialog.tsx +0 -385
  232. package/src/components/layouts/my_settings/components/profile_picture_display.tsx +0 -66
  233. package/src/components/layouts/my_settings/components/profile_picture_gravatar_tab.tsx +0 -143
  234. package/src/components/layouts/my_settings/components/profile_picture_library_tab.tsx +0 -311
  235. package/src/components/layouts/my_settings/components/profile_picture_upload_tab.tsx +0 -341
  236. package/src/components/layouts/my_settings/config/my_settings_field_config.ts +0 -61
  237. package/src/components/layouts/my_settings/hooks/use_my_settings.ts +0 -458
  238. package/src/components/layouts/my_settings/index.tsx +0 -351
  239. package/src/components/layouts/register/config/register_field_config.ts +0 -101
  240. package/src/components/layouts/register/hooks/use_register_form.ts +0 -275
  241. package/src/components/layouts/register/index.tsx +0 -226
  242. package/src/components/layouts/reset_password/config/reset_password_field_config.ts +0 -86
  243. package/src/components/layouts/reset_password/hooks/use_reset_password_form.ts +0 -276
  244. package/src/components/layouts/reset_password/index.tsx +0 -294
  245. package/src/components/layouts/shared/components/already_logged_in_guard.tsx +0 -95
  246. package/src/components/layouts/shared/components/auth_page_shell.tsx +0 -36
  247. package/src/components/layouts/shared/components/field_error_message.tsx +0 -29
  248. package/src/components/layouts/shared/components/form_action_buttons.tsx +0 -64
  249. package/src/components/layouts/shared/components/form_field_wrapper.tsx +0 -44
  250. package/src/components/layouts/shared/components/form_header.tsx +0 -36
  251. package/src/components/layouts/shared/components/logout_button.tsx +0 -76
  252. package/src/components/layouts/shared/components/password_field.tsx +0 -72
  253. package/src/components/layouts/shared/components/profile_pic_menu.tsx +0 -321
  254. package/src/components/layouts/shared/components/profile_pic_menu_wrapper.tsx +0 -40
  255. package/src/components/layouts/shared/components/sidebar_layout_wrapper.tsx +0 -214
  256. package/src/components/layouts/shared/components/standalone_layout_wrapper.tsx +0 -53
  257. package/src/components/layouts/shared/components/two_column_auth_layout.tsx +0 -44
  258. package/src/components/layouts/shared/components/unauthorized_guard.tsx +0 -78
  259. package/src/components/layouts/shared/components/visual_panel.tsx +0 -41
  260. package/src/components/layouts/shared/config/layout_customization.ts +0 -95
  261. package/src/components/layouts/shared/data/layout_data_client.ts +0 -19
  262. package/src/components/layouts/shared/hooks/use_auth_status.ts +0 -103
  263. package/src/components/layouts/shared/hooks/use_hazo_auth.ts +0 -158
  264. package/src/components/layouts/shared/index.ts +0 -34
  265. package/src/components/layouts/shared/utils/ip_address.ts +0 -37
  266. package/src/components/layouts/shared/utils/validation.ts +0 -66
  267. package/src/components/layouts/user_management/components/roles_matrix.tsx +0 -607
  268. package/src/components/layouts/user_management/index.tsx +0 -1295
  269. package/src/components/ui/alert-dialog.tsx +0 -141
  270. package/src/components/ui/avatar.tsx +0 -50
  271. package/src/components/ui/button.tsx +0 -57
  272. package/src/components/ui/checkbox.tsx +0 -30
  273. package/src/components/ui/dialog.tsx +0 -122
  274. package/src/components/ui/dropdown-menu.tsx +0 -201
  275. package/src/components/ui/hazo_ui_tooltip.tsx +0 -67
  276. package/src/components/ui/index.ts +0 -22
  277. package/src/components/ui/input.tsx +0 -22
  278. package/src/components/ui/label.tsx +0 -26
  279. package/src/components/ui/separator.tsx +0 -31
  280. package/src/components/ui/sheet.tsx +0 -139
  281. package/src/components/ui/sidebar.tsx +0 -773
  282. package/src/components/ui/skeleton.tsx +0 -15
  283. package/src/components/ui/sonner.tsx +0 -31
  284. package/src/components/ui/switch.tsx +0 -29
  285. package/src/components/ui/table.tsx +0 -120
  286. package/src/components/ui/tabs.tsx +0 -55
  287. package/src/components/ui/tooltip.tsx +0 -32
  288. package/src/components/ui/vertical-tabs.tsx +0 -59
  289. package/src/hooks/use-mobile.tsx +0 -19
  290. package/src/index.ts +0 -7
  291. package/src/lib/already_logged_in_config.server.ts +0 -46
  292. package/src/lib/app_logger.ts +0 -24
  293. package/src/lib/auth/auth_cache.ts +0 -220
  294. package/src/lib/auth/auth_rate_limiter.ts +0 -121
  295. package/src/lib/auth/auth_types.ts +0 -65
  296. package/src/lib/auth/auth_utils.server.ts +0 -196
  297. package/src/lib/auth/hazo_get_auth.server.ts +0 -333
  298. package/src/lib/auth/index.ts +0 -23
  299. package/src/lib/auth/server_auth.ts +0 -88
  300. package/src/lib/auth_utility_config.server.ts +0 -136
  301. package/src/lib/config/config_loader.server.ts +0 -164
  302. package/src/lib/email_verification_config.server.ts +0 -32
  303. package/src/lib/file_types_config.server.ts +0 -25
  304. package/src/lib/forgot_password_config.server.ts +0 -32
  305. package/src/lib/hazo_connect_instance.server.ts +0 -101
  306. package/src/lib/hazo_connect_setup.server.ts +0 -194
  307. package/src/lib/hazo_connect_setup.ts +0 -54
  308. package/src/lib/index.ts +0 -44
  309. package/src/lib/login_config.server.ts +0 -71
  310. package/src/lib/messages_config.server.ts +0 -45
  311. package/src/lib/migrations/apply_migration.ts +0 -105
  312. package/src/lib/my_settings_config.server.ts +0 -135
  313. package/src/lib/password_requirements_config.server.ts +0 -39
  314. package/src/lib/profile_pic_menu_config.server.ts +0 -138
  315. package/src/lib/profile_picture_config.server.ts +0 -56
  316. package/src/lib/register_config.server.ts +0 -73
  317. package/src/lib/reset_password_config.server.ts +0 -75
  318. package/src/lib/services/email_service.ts +0 -581
  319. package/src/lib/services/email_verification_service.ts +0 -270
  320. package/src/lib/services/index.ts +0 -15
  321. package/src/lib/services/login_service.ts +0 -134
  322. package/src/lib/services/password_change_service.ts +0 -154
  323. package/src/lib/services/password_reset_service.ts +0 -405
  324. package/src/lib/services/profile_picture_remove_service.ts +0 -120
  325. package/src/lib/services/profile_picture_service.ts +0 -215
  326. package/src/lib/services/profile_picture_source_mapper.ts +0 -62
  327. package/src/lib/services/registration_service.ts +0 -184
  328. package/src/lib/services/token_service.ts +0 -240
  329. package/src/lib/services/user_profiles_service.ts +0 -143
  330. package/src/lib/services/user_update_service.ts +0 -141
  331. package/src/lib/ui_shell_config.server.ts +0 -73
  332. package/src/lib/ui_sizes_config.server.ts +0 -37
  333. package/src/lib/user_fields_config.server.ts +0 -31
  334. package/src/lib/user_management_config.server.ts +0 -39
  335. package/src/lib/utils/api_route_helpers.ts +0 -60
  336. package/src/lib/utils/error_sanitizer.ts +0 -75
  337. package/src/lib/utils.ts +0 -11
  338. package/src/middleware.ts +0 -94
  339. package/src/routes/index.ts +0 -34
  340. package/src/server/config/config_loader.ts +0 -496
  341. package/src/server/index.ts +0 -38
  342. package/src/server/logging/logger_service.ts +0 -56
  343. package/src/server/routes/root_router.ts +0 -16
  344. package/src/server/server.ts +0 -28
  345. package/src/server/types/app_types.ts +0 -74
  346. package/src/server/types/express.d.ts +0 -16
  347. package/src/stories/email_verification_layout.stories.tsx +0 -137
  348. package/src/stories/forgot_password_layout.stories.tsx +0 -85
  349. package/src/stories/login_layout.stories.tsx +0 -85
  350. package/src/stories/project_overview.stories.tsx +0 -33
  351. package/src/stories/register_layout.stories.tsx +0 -107
  352. package/tailwind.config.ts +0 -77
  353. package/tsconfig.build.json +0 -36
  354. package/tsconfig.json +0 -28
@@ -0,0 +1,779 @@
1
+ # hazo_auth Setup Checklist
2
+
3
+ This checklist provides step-by-step instructions for setting up the `hazo_auth` package in your Next.js project. AI assistants can follow this guide to ensure complete and correct setup.
4
+
5
+ ## Quick Start (Recommended)
6
+
7
+ The fastest way to set up hazo_auth:
8
+
9
+ ```bash
10
+ # 1. Install the package
11
+ npm install hazo_auth
12
+
13
+ # 2. Initialize project (creates directories, copies config files)
14
+ npx hazo_auth init
15
+
16
+ # 3. Generate API routes and pages
17
+ npx hazo_auth generate-routes --pages
18
+
19
+ # 4. Set up environment variables
20
+ cp .env.local.example .env.local
21
+ # Edit .env.local and add ZEPTOMAIL_API_KEY
22
+
23
+ # 5. Start dev server and test
24
+ npm run dev
25
+ # Visit http://localhost:3000/hazo_auth/login
26
+ ```
27
+
28
+ If this works, skip to [Phase 6: Verification Tests](#phase-6-verification-tests).
29
+
30
+ ---
31
+
32
+ ## Pre-flight Checks
33
+
34
+ Before starting, verify your project meets these requirements:
35
+
36
+ - [ ] Node.js 18+ installed
37
+ - [ ] Project uses Next.js 14+ with App Router
38
+ - [ ] npm or pnpm package manager
39
+ - [ ] Project has `app/` directory (Next.js App Router structure)
40
+
41
+ **Verify Node.js version:**
42
+ ```bash
43
+ node --version
44
+ # Expected: v18.x.x or higher
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Phase 1: Installation & Config Files
50
+
51
+ ### Step 1.1: Install the package
52
+
53
+ ```bash
54
+ npm install hazo_auth
55
+ ```
56
+
57
+ **Verify installation:**
58
+ ```bash
59
+ ls node_modules/hazo_auth/package.json
60
+ # Expected: file exists
61
+ ```
62
+
63
+ ### Step 1.2: Initialize project (Recommended)
64
+
65
+ Use the CLI to automatically set up directories and copy config files:
66
+
67
+ ```bash
68
+ npx hazo_auth init
69
+ ```
70
+
71
+ This command:
72
+ - Creates `public/profile_pictures/library/` directory
73
+ - Creates `public/profile_pictures/uploads/` directory
74
+ - Creates `data/` directory (for SQLite database)
75
+ - Copies `hazo_auth_config.ini` and `hazo_notify_config.ini`
76
+ - Copies profile picture library images
77
+ - Creates `.env.local.example` template
78
+
79
+ ### Step 1.2b: Manual config setup (Alternative)
80
+
81
+ If you prefer manual setup:
82
+
83
+ ```bash
84
+ cp node_modules/hazo_auth/hazo_auth_config.example.ini ./hazo_auth_config.ini
85
+ cp node_modules/hazo_auth/hazo_notify_config.example.ini ./hazo_notify_config.ini
86
+ ```
87
+
88
+ **Verify config files exist:**
89
+ ```bash
90
+ ls -la hazo_auth_config.ini hazo_notify_config.ini
91
+ # Expected: both files exist in project root
92
+ ```
93
+
94
+ ### Step 1.3: Configure database connection
95
+
96
+ Edit `hazo_auth_config.ini`:
97
+
98
+ **For SQLite (development):**
99
+ ```ini
100
+ [hazo_connect]
101
+ type = sqlite
102
+ sqlite_path = ./data/hazo_auth.sqlite
103
+ ```
104
+
105
+ **For PostgreSQL (production):**
106
+ ```ini
107
+ [hazo_connect]
108
+ type = postgrest
109
+ postgrest_url = https://your-postgrest-url.com
110
+ ```
111
+
112
+ ### Step 1.4: Configure UI shell mode
113
+
114
+ Edit `hazo_auth_config.ini`:
115
+ ```ini
116
+ [hazo_auth__ui_shell]
117
+ # Use 'standalone' for consuming projects (inherits your app's layout)
118
+ # Use 'test_sidebar' only for hazo_auth package development
119
+ layout_mode = standalone
120
+ ```
121
+
122
+ **Checklist:**
123
+ - [ ] `hazo_auth_config.ini` exists in project root
124
+ - [ ] `hazo_notify_config.ini` exists in project root
125
+ - [ ] Database type configured (sqlite or postgrest)
126
+ - [ ] UI shell mode set to `standalone`
127
+
128
+ ---
129
+
130
+ ## Phase 2: Environment Variables
131
+
132
+ ### Step 2.1: Create .env.local file
133
+
134
+ Create `.env.local` in your project root:
135
+
136
+ ```env
137
+ # Required for email functionality (Zeptomail)
138
+ ZEPTOMAIL_API_KEY=your_zeptomail_api_key_here
139
+
140
+ # Required for PostgreSQL/PostgREST (if using)
141
+ HAZO_CONNECT_POSTGREST_API_KEY=your_postgrest_api_key_here
142
+
143
+ # Required for JWT authentication
144
+ JWT_SECRET=your_secure_random_string_at_least_32_characters
145
+ ```
146
+
147
+ **Generate a secure JWT secret:**
148
+ ```bash
149
+ openssl rand -base64 32
150
+ ```
151
+
152
+ ### Step 2.2: Configure email settings
153
+
154
+ Edit `hazo_notify_config.ini`:
155
+ ```ini
156
+ [emailer]
157
+ emailer_module = zeptoemail_api
158
+ from_email = noreply@yourdomain.com
159
+ from_name = Your App Name
160
+ ```
161
+
162
+ **Checklist:**
163
+ - [ ] `.env.local` file created
164
+ - [ ] `ZEPTOMAIL_API_KEY` set (or email will not work)
165
+ - [ ] `JWT_SECRET` set
166
+ - [ ] `from_email` configured in `hazo_notify_config.ini`
167
+
168
+ ---
169
+
170
+ ## Phase 3: Database Setup
171
+
172
+ ### Option A: SQLite (Development)
173
+
174
+ Create the data directory:
175
+ ```bash
176
+ mkdir -p data
177
+ ```
178
+
179
+ The SQLite database will be created automatically on first use if using hazo_connect's SQLite adapter.
180
+
181
+ **Manual creation (if needed):**
182
+ ```bash
183
+ # Create database with initial schema
184
+ cat << 'EOF' | sqlite3 data/hazo_auth.sqlite
185
+ CREATE TABLE IF NOT EXISTS hazo_users (
186
+ id TEXT PRIMARY KEY,
187
+ email_address TEXT NOT NULL UNIQUE,
188
+ password_hash TEXT NOT NULL,
189
+ name TEXT,
190
+ email_verified INTEGER NOT NULL DEFAULT 0,
191
+ is_active INTEGER NOT NULL DEFAULT 1,
192
+ login_attempts INTEGER NOT NULL DEFAULT 0,
193
+ last_logon TEXT,
194
+ profile_picture_url TEXT,
195
+ profile_source TEXT,
196
+ mfa_secret TEXT,
197
+ url_on_logon TEXT,
198
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
199
+ changed_at TEXT NOT NULL DEFAULT (datetime('now'))
200
+ );
201
+
202
+ CREATE TABLE IF NOT EXISTS hazo_refresh_tokens (
203
+ id TEXT PRIMARY KEY,
204
+ user_id TEXT NOT NULL REFERENCES hazo_users(id) ON DELETE CASCADE,
205
+ token_hash TEXT NOT NULL,
206
+ token_type TEXT NOT NULL,
207
+ expires_at TEXT NOT NULL,
208
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
209
+ );
210
+
211
+ CREATE TABLE IF NOT EXISTS hazo_permissions (
212
+ id TEXT PRIMARY KEY,
213
+ permission_name TEXT NOT NULL UNIQUE,
214
+ description TEXT,
215
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
216
+ changed_at TEXT NOT NULL DEFAULT (datetime('now'))
217
+ );
218
+
219
+ CREATE TABLE IF NOT EXISTS hazo_roles (
220
+ id TEXT PRIMARY KEY,
221
+ role_name TEXT NOT NULL UNIQUE,
222
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
223
+ changed_at TEXT NOT NULL DEFAULT (datetime('now'))
224
+ );
225
+
226
+ CREATE TABLE IF NOT EXISTS hazo_role_permissions (
227
+ role_id TEXT NOT NULL REFERENCES hazo_roles(id) ON DELETE CASCADE,
228
+ permission_id TEXT NOT NULL REFERENCES hazo_permissions(id) ON DELETE CASCADE,
229
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
230
+ changed_at TEXT NOT NULL DEFAULT (datetime('now')),
231
+ PRIMARY KEY (role_id, permission_id)
232
+ );
233
+
234
+ CREATE TABLE IF NOT EXISTS hazo_user_roles (
235
+ user_id TEXT NOT NULL REFERENCES hazo_users(id) ON DELETE CASCADE,
236
+ role_id TEXT NOT NULL REFERENCES hazo_roles(id) ON DELETE CASCADE,
237
+ created_at TEXT NOT NULL DEFAULT (datetime('now')),
238
+ changed_at TEXT NOT NULL DEFAULT (datetime('now')),
239
+ PRIMARY KEY (user_id, role_id)
240
+ );
241
+ EOF
242
+ ```
243
+
244
+ **Verify SQLite database:**
245
+ ```bash
246
+ sqlite3 data/hazo_auth.sqlite ".tables"
247
+ # Expected: hazo_users hazo_refresh_tokens hazo_permissions hazo_roles hazo_role_permissions hazo_user_roles
248
+ ```
249
+
250
+ ### Option B: PostgreSQL (Production)
251
+
252
+ Run this SQL script in your PostgreSQL database:
253
+
254
+ ```sql
255
+ -- Create enum type
256
+ CREATE TYPE hazo_enum_profile_source_enum AS ENUM ('gravatar', 'custom', 'predefined');
257
+
258
+ -- Create users table
259
+ CREATE TABLE hazo_users (
260
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
261
+ email_address TEXT NOT NULL UNIQUE,
262
+ password_hash TEXT NOT NULL,
263
+ name TEXT,
264
+ email_verified BOOLEAN NOT NULL DEFAULT FALSE,
265
+ is_active BOOLEAN NOT NULL DEFAULT TRUE,
266
+ login_attempts INTEGER NOT NULL DEFAULT 0,
267
+ last_logon TIMESTAMP WITH TIME ZONE,
268
+ profile_picture_url TEXT,
269
+ profile_source hazo_enum_profile_source_enum,
270
+ mfa_secret TEXT,
271
+ url_on_logon TEXT,
272
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
273
+ changed_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
274
+ );
275
+ CREATE INDEX idx_hazo_users_email ON hazo_users(email_address);
276
+
277
+ -- Create refresh tokens table
278
+ CREATE TABLE hazo_refresh_tokens (
279
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
280
+ user_id UUID NOT NULL REFERENCES hazo_users(id) ON DELETE CASCADE,
281
+ token_hash TEXT NOT NULL,
282
+ token_type TEXT NOT NULL,
283
+ expires_at TIMESTAMP WITH TIME ZONE NOT NULL,
284
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
285
+ );
286
+ CREATE INDEX idx_hazo_refresh_tokens_user_id ON hazo_refresh_tokens(user_id);
287
+ CREATE INDEX idx_hazo_refresh_tokens_token_type ON hazo_refresh_tokens(token_type);
288
+
289
+ -- Create permissions table
290
+ CREATE TABLE hazo_permissions (
291
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
292
+ permission_name TEXT NOT NULL UNIQUE,
293
+ description TEXT,
294
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
295
+ changed_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
296
+ );
297
+
298
+ -- Create roles table
299
+ CREATE TABLE hazo_roles (
300
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
301
+ role_name TEXT NOT NULL UNIQUE,
302
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
303
+ changed_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
304
+ );
305
+
306
+ -- Create role-permissions junction table
307
+ CREATE TABLE hazo_role_permissions (
308
+ role_id UUID NOT NULL REFERENCES hazo_roles(id) ON DELETE CASCADE,
309
+ permission_id UUID NOT NULL REFERENCES hazo_permissions(id) ON DELETE CASCADE,
310
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
311
+ changed_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
312
+ PRIMARY KEY (role_id, permission_id)
313
+ );
314
+ CREATE INDEX idx_hazo_role_permissions_role_id ON hazo_role_permissions(role_id);
315
+ CREATE INDEX idx_hazo_role_permissions_permission_id ON hazo_role_permissions(permission_id);
316
+
317
+ -- Create user-roles junction table
318
+ CREATE TABLE hazo_user_roles (
319
+ user_id UUID NOT NULL REFERENCES hazo_users(id) ON DELETE CASCADE,
320
+ role_id UUID NOT NULL REFERENCES hazo_roles(id) ON DELETE CASCADE,
321
+ created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
322
+ changed_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
323
+ PRIMARY KEY (user_id, role_id)
324
+ );
325
+ CREATE INDEX idx_hazo_user_roles_user_id ON hazo_user_roles(user_id);
326
+ CREATE INDEX idx_hazo_user_roles_role_id ON hazo_user_roles(role_id);
327
+ ```
328
+
329
+ **Verify PostgreSQL tables:**
330
+ ```sql
331
+ SELECT table_name FROM information_schema.tables WHERE table_name LIKE 'hazo_%';
332
+ -- Expected: 6 tables listed
333
+ ```
334
+
335
+ **Checklist:**
336
+ - [ ] Database created (SQLite file or PostgreSQL)
337
+ - [ ] All 6 tables exist: `hazo_users`, `hazo_refresh_tokens`, `hazo_permissions`, `hazo_roles`, `hazo_role_permissions`, `hazo_user_roles`
338
+
339
+ ---
340
+
341
+ ## Phase 4: API Routes
342
+
343
+ Create API route files in your project. Each file re-exports handlers from hazo_auth.
344
+
345
+ ### Step 4.1: Generate routes automatically (Recommended)
346
+
347
+ ```bash
348
+ npx hazo_auth generate-routes
349
+ ```
350
+
351
+ This creates all required API routes automatically.
352
+
353
+ ### Step 4.2: Manual route creation (Alternative)
354
+
355
+ If automatic generation doesn't work, create these files manually:
356
+
357
+ **Required routes (create all of these):**
358
+
359
+ ```
360
+ app/api/hazo_auth/
361
+ ├── login/route.ts
362
+ ├── register/route.ts
363
+ ├── logout/route.ts
364
+ ├── me/route.ts
365
+ ├── forgot_password/route.ts
366
+ ├── reset_password/route.ts
367
+ ├── verify_email/route.ts
368
+ ├── resend_verification/route.ts
369
+ ├── update_user/route.ts
370
+ ├── change_password/route.ts
371
+ ├── upload_profile_picture/route.ts
372
+ ├── remove_profile_picture/route.ts
373
+ ├── library_photos/route.ts
374
+ ├── get_auth/route.ts
375
+ ├── validate_reset_token/route.ts
376
+ └── profile_picture/
377
+ └── [filename]/route.ts
378
+ ```
379
+
380
+ **Example route file content:**
381
+
382
+ `app/api/hazo_auth/login/route.ts`:
383
+ ```typescript
384
+ export { POST } from "hazo_auth/server/routes/login";
385
+ ```
386
+
387
+ `app/api/hazo_auth/register/route.ts`:
388
+ ```typescript
389
+ export { POST } from "hazo_auth/server/routes/register";
390
+ ```
391
+
392
+ `app/api/hazo_auth/logout/route.ts`:
393
+ ```typescript
394
+ export { POST } from "hazo_auth/server/routes/logout";
395
+ ```
396
+
397
+ `app/api/hazo_auth/me/route.ts`:
398
+ ```typescript
399
+ export { GET } from "hazo_auth/server/routes/me";
400
+ ```
401
+
402
+ `app/api/hazo_auth/forgot_password/route.ts`:
403
+ ```typescript
404
+ export { POST } from "hazo_auth/server/routes/forgot_password";
405
+ ```
406
+
407
+ `app/api/hazo_auth/reset_password/route.ts`:
408
+ ```typescript
409
+ export { POST } from "hazo_auth/server/routes/reset_password";
410
+ ```
411
+
412
+ `app/api/hazo_auth/verify_email/route.ts`:
413
+ ```typescript
414
+ export { GET } from "hazo_auth/server/routes/verify_email";
415
+ ```
416
+
417
+ `app/api/hazo_auth/resend_verification/route.ts`:
418
+ ```typescript
419
+ export { POST } from "hazo_auth/server/routes/resend_verification";
420
+ ```
421
+
422
+ `app/api/hazo_auth/update_user/route.ts`:
423
+ ```typescript
424
+ export { PATCH } from "hazo_auth/server/routes/update_user";
425
+ ```
426
+
427
+ `app/api/hazo_auth/change_password/route.ts`:
428
+ ```typescript
429
+ export { POST } from "hazo_auth/server/routes/change_password";
430
+ ```
431
+
432
+ `app/api/hazo_auth/upload_profile_picture/route.ts`:
433
+ ```typescript
434
+ export { POST } from "hazo_auth/server/routes/upload_profile_picture";
435
+ ```
436
+
437
+ `app/api/hazo_auth/remove_profile_picture/route.ts`:
438
+ ```typescript
439
+ export { DELETE } from "hazo_auth/server/routes/remove_profile_picture";
440
+ ```
441
+
442
+ `app/api/hazo_auth/library_photos/route.ts`:
443
+ ```typescript
444
+ export { GET } from "hazo_auth/server/routes/library_photos";
445
+ ```
446
+
447
+ `app/api/hazo_auth/get_auth/route.ts`:
448
+ ```typescript
449
+ export { POST } from "hazo_auth/server/routes/get_auth";
450
+ ```
451
+
452
+ `app/api/hazo_auth/validate_reset_token/route.ts`:
453
+ ```typescript
454
+ export { POST } from "hazo_auth/server/routes/validate_reset_token";
455
+ ```
456
+
457
+ `app/api/hazo_auth/profile_picture/[filename]/route.ts`:
458
+ ```typescript
459
+ export { GET } from "hazo_auth/server/routes/profile_picture_filename";
460
+ ```
461
+
462
+ **Checklist:**
463
+ - [ ] All 16 API route files created
464
+ - [ ] Each file exports the correct HTTP method (POST, GET, PATCH, DELETE)
465
+
466
+ ---
467
+
468
+ ## Phase 5: Page Routes
469
+
470
+ Create page files for each auth flow.
471
+
472
+ ### Step 5.1: Generate pages automatically (Recommended)
473
+
474
+ ```bash
475
+ npx hazo_auth generate-routes --pages
476
+ ```
477
+
478
+ This generates both API routes and page routes. The generated pages use zero-config components that work out of the box.
479
+
480
+ **Generated pages:**
481
+ ```
482
+ app/hazo_auth/
483
+ ├── login/page.tsx
484
+ ├── register/page.tsx
485
+ ├── forgot_password/page.tsx
486
+ ├── reset_password/page.tsx
487
+ ├── verify_email/page.tsx
488
+ └── my_settings/page.tsx
489
+ ```
490
+
491
+ ### Step 5.2: Manual page creation (Alternative)
492
+
493
+ If you prefer manual setup or need custom paths, create these files:
494
+
495
+ **Login page** - `app/hazo_auth/login/page.tsx`:
496
+ ```typescript
497
+ import { LoginPage } from "hazo_auth/pages/login";
498
+ export default LoginPage;
499
+ ```
500
+
501
+ **Register page** - `app/hazo_auth/register/page.tsx`:
502
+ ```typescript
503
+ import { RegisterPage } from "hazo_auth/pages/register";
504
+ export default RegisterPage;
505
+ ```
506
+
507
+ **Forgot password page** - `app/hazo_auth/forgot_password/page.tsx`:
508
+ ```typescript
509
+ import { ForgotPasswordPage } from "hazo_auth/pages/forgot_password";
510
+ export default ForgotPasswordPage;
511
+ ```
512
+
513
+ **Reset password page** - `app/hazo_auth/reset_password/page.tsx`:
514
+ ```typescript
515
+ import { ResetPasswordPage } from "hazo_auth/pages/reset_password";
516
+ export default ResetPasswordPage;
517
+ ```
518
+
519
+ **Email verification page** - `app/hazo_auth/verify_email/page.tsx`:
520
+ ```typescript
521
+ import { VerifyEmailPage } from "hazo_auth/pages/verify_email";
522
+ export default VerifyEmailPage;
523
+ ```
524
+
525
+ **My settings page** - `app/hazo_auth/my_settings/page.tsx`:
526
+ ```typescript
527
+ import { MySettingsPage } from "hazo_auth/pages/my_settings";
528
+ export default MySettingsPage;
529
+ ```
530
+
531
+ ### Step 5.3: Custom page routes (Advanced)
532
+
533
+ If you need custom paths or want to wrap pages with your own layout:
534
+
535
+ ```typescript
536
+ // app/(auth)/login/page.tsx
537
+ import { LoginPage } from "hazo_auth/pages/login";
538
+
539
+ export default function CustomLoginPage() {
540
+ return (
541
+ <div className="min-h-screen flex items-center justify-center">
542
+ <LoginPage
543
+ redirectRoute="/dashboard"
544
+ successMessage="Welcome back!"
545
+ />
546
+ </div>
547
+ );
548
+ }
549
+ ```
550
+
551
+ **Checklist:**
552
+ - [ ] Login page created (`/hazo_auth/login`)
553
+ - [ ] Register page created (`/hazo_auth/register`)
554
+ - [ ] Forgot password page created (`/hazo_auth/forgot_password`)
555
+ - [ ] Reset password page created (`/hazo_auth/reset_password`)
556
+ - [ ] Email verification page created (`/hazo_auth/verify_email`)
557
+ - [ ] My settings page created (`/hazo_auth/my_settings`)
558
+
559
+ ---
560
+
561
+ ## Phase 6: Verification Tests
562
+
563
+ Run these tests to verify your setup is working correctly.
564
+
565
+ ### Test 1: API Health Check
566
+
567
+ ```bash
568
+ curl -s http://localhost:3000/api/hazo_auth/me | jq
569
+ ```
570
+
571
+ **Expected response:**
572
+ ```json
573
+ {
574
+ "authenticated": false
575
+ }
576
+ ```
577
+
578
+ ### Test 2: Registration API
579
+
580
+ ```bash
581
+ curl -X POST http://localhost:3000/api/hazo_auth/register \
582
+ -H "Content-Type: application/json" \
583
+ -d '{"email":"test@example.com","password":"TestPass123!","name":"Test User"}'
584
+ ```
585
+
586
+ **Expected response:**
587
+ ```json
588
+ {
589
+ "success": true,
590
+ "message": "Registration successful. Please check your email to verify your account."
591
+ }
592
+ ```
593
+
594
+ ### Test 3: Email Sending
595
+
596
+ After registration, check the inbox for `test@example.com` for a verification email.
597
+
598
+ **If email not received, check:**
599
+ - `ZEPTOMAIL_API_KEY` is set in `.env.local`
600
+ - `from_email` is configured and verified in Zeptomail
601
+ - Check server logs for email errors
602
+
603
+ ### Test 4: Login API
604
+
605
+ ```bash
606
+ curl -X POST http://localhost:3000/api/hazo_auth/login \
607
+ -H "Content-Type: application/json" \
608
+ -d '{"email":"test@example.com","password":"TestPass123!"}'
609
+ ```
610
+
611
+ **Expected response (success):**
612
+ ```json
613
+ {
614
+ "success": true,
615
+ "user": {
616
+ "id": "...",
617
+ "email": "test@example.com",
618
+ "name": "Test User"
619
+ }
620
+ }
621
+ ```
622
+
623
+ ### Test 5: Profile Picture Library
624
+
625
+ ```bash
626
+ curl -s http://localhost:3000/api/hazo_auth/library_photos | jq
627
+ ```
628
+
629
+ **Expected response:**
630
+ ```json
631
+ {
632
+ "success": true,
633
+ "categories": ["Cars", "Young Cartoons"],
634
+ "source": "project"
635
+ }
636
+ ```
637
+
638
+ The `source` field indicates where photos are served from:
639
+ - `"project"` - Photos are in your project's `public/profile_pictures/library/`
640
+ - `"node_modules"` - Photos are served from `node_modules/hazo_auth/public/` via API route
641
+
642
+ **Test paginated photos:**
643
+ ```bash
644
+ curl -s "http://localhost:3000/api/hazo_auth/library_photos?category=Cars&page=1&page_size=5" | jq
645
+ ```
646
+
647
+ **Note:** Library photos work automatically whether they're copied to your project or still in node_modules. The API will serve them from node_modules as a fallback.
648
+
649
+ ### Test 6: Visit Pages in Browser
650
+
651
+ Start your dev server:
652
+ ```bash
653
+ npm run dev
654
+ ```
655
+
656
+ Visit each page and verify it loads:
657
+ - [ ] `http://localhost:3000/hazo_auth/login` - Login form displays
658
+ - [ ] `http://localhost:3000/hazo_auth/register` - Registration form displays
659
+ - [ ] `http://localhost:3000/hazo_auth/forgot_password` - Forgot password form displays
660
+ - [ ] `http://localhost:3000/hazo_auth/my_settings` - Settings page displays (after login)
661
+
662
+ ---
663
+
664
+ ## Troubleshooting
665
+
666
+ ### Issue: Email not sending
667
+
668
+ **Symptoms:** Registration succeeds but no email received.
669
+
670
+ **Solutions:**
671
+ 1. Check `ZEPTOMAIL_API_KEY` is set in `.env.local`
672
+ 2. Verify `from_email` in `hazo_notify_config.ini` is authorized in Zeptomail
673
+ 3. Check server console for error messages
674
+ 4. Verify `emailer_module` is set to `zeptoemail_api`
675
+
676
+ ### Issue: Profile pictures not showing
677
+
678
+ **Symptoms:** Avatar shows fallback initials, library photos empty.
679
+
680
+ **Solutions:**
681
+ 1. **Run init command** (copies library photos automatically):
682
+ ```bash
683
+ npx hazo_auth init
684
+ ```
685
+
686
+ 2. **Or manually copy library photos:**
687
+ ```bash
688
+ mkdir -p public/profile_pictures/library
689
+ cp -r node_modules/hazo_auth/public/profile_pictures/library/* public/profile_pictures/library/
690
+ ```
691
+
692
+ 3. **Check API response source:**
693
+ ```bash
694
+ curl -s http://localhost:3000/api/hazo_auth/library_photos | jq '.source'
695
+ ```
696
+ - If `"node_modules"` - Photos are being served from the package (slower but works)
697
+ - If `"project"` - Photos are in your public folder (optimal)
698
+
699
+ 4. Verify `library_photos` and `library_photo` API routes exist
700
+ 5. Check file permissions on `public/profile_pictures/`
701
+
702
+ ### Issue: Database connection failed
703
+
704
+ **Symptoms:** API returns 500 errors, "database connection failed" in logs.
705
+
706
+ **Solutions:**
707
+ 1. Verify `hazo_auth_config.ini` has correct database settings
708
+ 2. For SQLite: ensure `data/` directory exists and is writable
709
+ 3. For PostgreSQL: verify connection string and credentials
710
+ 4. Check `HAZO_CONNECT_POSTGREST_API_KEY` is set
711
+
712
+ ### Issue: "Module not found" errors
713
+
714
+ **Symptoms:** Import errors when running the app.
715
+
716
+ **Solutions:**
717
+ 1. Ensure `hazo_auth` is installed: `npm install hazo_auth`
718
+ 2. Clear node_modules and reinstall: `rm -rf node_modules && npm install`
719
+ 3. Verify you're importing from correct paths (see Phase 5)
720
+
721
+ ### Issue: API routes return 404
722
+
723
+ **Symptoms:** Calls to `/api/hazo_auth/*` return 404.
724
+
725
+ **Solutions:**
726
+ 1. Run `npx hazo_auth generate-routes` to create routes
727
+ 2. Verify route files exist in `app/api/hazo_auth/`
728
+ 3. Check Next.js is detecting routes: `npm run dev` and watch console
729
+ 4. Ensure route files export correct HTTP methods
730
+
731
+ ### Issue: Authentication not persisting
732
+
733
+ **Symptoms:** User logs in but immediately shows as logged out.
734
+
735
+ **Solutions:**
736
+ 1. Verify `JWT_SECRET` is set in `.env.local`
737
+ 2. Check cookies are being set (inspect browser devtools > Application > Cookies)
738
+ 3. Ensure API routes are on same domain (no CORS issues)
739
+
740
+ ---
741
+
742
+ ## Final Checklist
743
+
744
+ **Configuration:**
745
+ - [ ] `hazo_auth_config.ini` configured
746
+ - [ ] `hazo_notify_config.ini` configured
747
+ - [ ] `.env.local` with all required variables
748
+
749
+ **Database:**
750
+ - [ ] Database created and accessible
751
+ - [ ] All 6 tables exist
752
+
753
+ **API Routes:**
754
+ - [ ] All 16 API routes created
755
+ - [ ] `/api/hazo_auth/me` returns `{"authenticated": false}`
756
+
757
+ **Pages:**
758
+ - [ ] All 6 auth pages created
759
+ - [ ] Pages render without errors
760
+
761
+ **Features:**
762
+ - [ ] Registration works
763
+ - [ ] Email verification sends
764
+ - [ ] Login works
765
+ - [ ] Profile pictures display
766
+ - [ ] Settings page accessible
767
+
768
+ ---
769
+
770
+ ## Quick Setup Command
771
+
772
+ For AI assistants, here's a single command to verify setup status:
773
+
774
+ ```bash
775
+ npx hazo_auth validate
776
+ ```
777
+
778
+ This will check all configuration and report any issues.
779
+