openadminjs 0.1.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 (388) hide show
  1. package/.env.example +9 -0
  2. package/.github/FUNDING.yml +3 -0
  3. package/.github/ISSUE_TEMPLATE/bug_report.yml +10 -0
  4. package/.github/ISSUE_TEMPLATE/feature_request.yml +10 -0
  5. package/.github/PULL_REQUEST_TEMPLATE.md +9 -0
  6. package/.github/dependabot.yml +10 -0
  7. package/.github/workflows/ci.yml +26 -0
  8. package/CHANGELOG.md +5 -0
  9. package/CODE_OF_CONDUCT.md +3 -0
  10. package/CONTRIBUTING.md +11 -0
  11. package/LICENSE +21 -0
  12. package/README.md +175 -0
  13. package/ROADMAP.md +7 -0
  14. package/SECURITY.md +11 -0
  15. package/apps/admin/app/api/auth/login/route.ts +51 -0
  16. package/apps/admin/app/api/auth/logout/route.ts +11 -0
  17. package/apps/admin/app/api/auth/refresh/route.ts +46 -0
  18. package/apps/admin/app/api-tokens/page.tsx +253 -0
  19. package/apps/admin/app/audit-logs/page.tsx +5 -0
  20. package/apps/admin/app/dashboard/page.tsx +392 -0
  21. package/apps/admin/app/files/page.tsx +5 -0
  22. package/apps/admin/app/globals.css +206 -0
  23. package/apps/admin/app/jobs/page.tsx +19 -0
  24. package/apps/admin/app/layout.tsx +57 -0
  25. package/apps/admin/app/login/page.test.tsx +18 -0
  26. package/apps/admin/app/login/page.tsx +161 -0
  27. package/apps/admin/app/login/safe-next-param.ts +4 -0
  28. package/apps/admin/app/notifications/page.tsx +146 -0
  29. package/apps/admin/app/page.tsx +5 -0
  30. package/apps/admin/app/plugins/page.tsx +348 -0
  31. package/apps/admin/app/profile/page.tsx +116 -0
  32. package/apps/admin/app/resources/[resource]/[id]/edit/page.tsx +45 -0
  33. package/apps/admin/app/resources/[resource]/[id]/page.tsx +449 -0
  34. package/apps/admin/app/resources/[resource]/create/page.tsx +34 -0
  35. package/apps/admin/app/resources/[resource]/page.tsx +100 -0
  36. package/apps/admin/app/settings/page.tsx +233 -0
  37. package/apps/admin/components/ai-assistant-widget.tsx +684 -0
  38. package/apps/admin/components/app-shell.tsx +305 -0
  39. package/apps/admin/components/auth-guard.test.tsx +55 -0
  40. package/apps/admin/components/auth-guard.tsx +39 -0
  41. package/apps/admin/components/jobs-panel.tsx +103 -0
  42. package/apps/admin/components/logo.tsx +30 -0
  43. package/apps/admin/components/resource-form.tsx +349 -0
  44. package/apps/admin/components/resource-table.tsx +277 -0
  45. package/apps/admin/lib/ai-events.ts +23 -0
  46. package/apps/admin/lib/api.test.ts +118 -0
  47. package/apps/admin/lib/api.ts +135 -0
  48. package/apps/admin/lib/auth-flow.e2e.test.ts +79 -0
  49. package/apps/admin/lib/brand.ts +14 -0
  50. package/apps/admin/lib/locale.ts +49 -0
  51. package/apps/admin/lib/tokens.ts +93 -0
  52. package/apps/admin/middleware.ts +58 -0
  53. package/apps/admin/next-env.d.ts +6 -0
  54. package/apps/admin/next.config.mjs +7 -0
  55. package/apps/admin/package.json +44 -0
  56. package/apps/admin/postcss.config.mjs +6 -0
  57. package/apps/admin/public/brand/apple-touch-icon.png +0 -0
  58. package/apps/admin/public/brand/favicon.svg +1 -0
  59. package/apps/admin/public/brand/og-image.png +0 -0
  60. package/apps/admin/public/brand/openadminjs-icon-new.png +0 -0
  61. package/apps/admin/public/brand/openadminjs-logo-monochrome.png +0 -0
  62. package/apps/admin/public/brand/openadminjs-logo-new.png +0 -0
  63. package/apps/admin/tailwind.config.ts +37 -0
  64. package/apps/admin/tsconfig.json +23 -0
  65. package/apps/admin/vitest.config.ts +7 -0
  66. package/apps/api/package.json +56 -0
  67. package/apps/api/plugins.manifest.example.json +22 -0
  68. package/apps/api/plugins.manifest.json +4 -0
  69. package/apps/api/src/access/catalog.ts +112 -0
  70. package/apps/api/src/access/derive-permissions.test.ts +26 -0
  71. package/apps/api/src/access/derive-permissions.ts +36 -0
  72. package/apps/api/src/access/public-catalog.ts +28 -0
  73. package/apps/api/src/admin/admin-ai.controller.ts +125 -0
  74. package/apps/api/src/admin/admin-ai.events.ts +23 -0
  75. package/apps/api/src/admin/admin-ai.service.ts +1238 -0
  76. package/apps/api/src/admin/admin-analytics.service.ts +164 -0
  77. package/apps/api/src/admin/admin-plugins.controller.ts +32 -0
  78. package/apps/api/src/admin/admin-plugins.service.ts +253 -0
  79. package/apps/api/src/admin/admin-resource.service.test.ts +118 -0
  80. package/apps/api/src/admin/admin-resource.service.ts +375 -0
  81. package/apps/api/src/admin/admin.controller.ts +72 -0
  82. package/apps/api/src/admin/admin.module.ts +30 -0
  83. package/apps/api/src/admin/dto/plugins.dto.ts +37 -0
  84. package/apps/api/src/admin/validate-resource-payload.test.ts +44 -0
  85. package/apps/api/src/admin/validate-resource-payload.ts +103 -0
  86. package/apps/api/src/app.module.ts +37 -0
  87. package/apps/api/src/auth/auth.controller.ts +70 -0
  88. package/apps/api/src/auth/auth.dto.ts +49 -0
  89. package/apps/api/src/auth/auth.module.ts +30 -0
  90. package/apps/api/src/auth/auth.service.test.ts +75 -0
  91. package/apps/api/src/auth/auth.service.ts +231 -0
  92. package/apps/api/src/common/auth-realm.decorator.ts +6 -0
  93. package/apps/api/src/common/auth.guard.test.ts +61 -0
  94. package/apps/api/src/common/auth.guard.ts +78 -0
  95. package/apps/api/src/common/casl-ability.factory.test.ts +33 -0
  96. package/apps/api/src/common/casl-ability.factory.ts +41 -0
  97. package/apps/api/src/common/current-user.decorator.ts +6 -0
  98. package/apps/api/src/common/permission.decorator.ts +7 -0
  99. package/apps/api/src/common/permissions.guard.ts +31 -0
  100. package/apps/api/src/common/prisma.service.ts +13 -0
  101. package/apps/api/src/health/health.controller.ts +25 -0
  102. package/apps/api/src/mail/mail.module.ts +9 -0
  103. package/apps/api/src/mail/mail.service.ts +115 -0
  104. package/apps/api/src/main.ts +37 -0
  105. package/apps/api/src/plugins/bootstrap.ts +4 -0
  106. package/apps/api/src/plugins/bundled/hello.plugin.ts +19 -0
  107. package/apps/api/src/plugins/bundled/registry.ts +7 -0
  108. package/apps/api/src/plugins/manifest-path.ts +35 -0
  109. package/apps/api/src/plugins/manifest.schema.test.ts +28 -0
  110. package/apps/api/src/plugins/manifest.schema.ts +38 -0
  111. package/apps/api/src/plugins/plugin-loader.ts +109 -0
  112. package/apps/api/src/queue/queue.controller.ts +28 -0
  113. package/apps/api/src/queue/queue.module.ts +23 -0
  114. package/apps/api/src/queue/queue.processor.ts +47 -0
  115. package/apps/api/src/queue/queue.service.ts +50 -0
  116. package/apps/api/src/resources/categories.resource.ts +21 -0
  117. package/apps/api/src/resources/commerce.resource.ts +157 -0
  118. package/apps/api/src/resources/operations.resource.ts +111 -0
  119. package/apps/api/src/resources/posts.resource.ts +88 -0
  120. package/apps/api/src/resources/registry.ts +27 -0
  121. package/apps/api/src/resources/resource-hooks.install.ts +18 -0
  122. package/apps/api/src/resources/resource-hooks.registry.test.ts +72 -0
  123. package/apps/api/src/resources/resource-hooks.registry.ts +66 -0
  124. package/apps/api/src/resources/resource-hooks.runner.ts +86 -0
  125. package/apps/api/src/resources/system.resource.ts +51 -0
  126. package/apps/api/src/resources/users.resource.ts +19 -0
  127. package/apps/api/src/store/payment/payment.controller.ts +98 -0
  128. package/apps/api/src/store/payment/payment.module.ts +14 -0
  129. package/apps/api/src/store/payment/payment.provider.ts +38 -0
  130. package/apps/api/src/store/payment/payment.service.ts +235 -0
  131. package/apps/api/src/store/store.controller.ts +26 -0
  132. package/apps/api/src/store/store.module.ts +12 -0
  133. package/apps/api/src/test-setup.ts +1 -0
  134. package/apps/api/tsconfig.json +11 -0
  135. package/apps/api/vitest.config.ts +21 -0
  136. package/apps/web/README.md +12 -0
  137. package/apps/web/app/globals.css +12 -0
  138. package/apps/web/app/layout.tsx +18 -0
  139. package/apps/web/app/page.tsx +27 -0
  140. package/apps/web/app/posts/[slug]/page.tsx +38 -0
  141. package/apps/web/app/posts/page.tsx +20 -0
  142. package/apps/web/app/robots.txt/route.ts +9 -0
  143. package/apps/web/app/sitemap.xml/route.ts +20 -0
  144. package/apps/web/components/public-fields.tsx +22 -0
  145. package/apps/web/lib/openadmin-client.ts +82 -0
  146. package/apps/web/lib/seo.test.ts +41 -0
  147. package/apps/web/lib/seo.ts +53 -0
  148. package/apps/web/next-env.d.ts +6 -0
  149. package/apps/web/next.config.mjs +5 -0
  150. package/apps/web/package.json +30 -0
  151. package/apps/web/postcss.config.mjs +6 -0
  152. package/apps/web/public/brand/apple-touch-icon.png +0 -0
  153. package/apps/web/public/brand/favicon.svg +1 -0
  154. package/apps/web/public/brand/og-image.png +0 -0
  155. package/apps/web/public/brand/openadminjs-icon-new.png +0 -0
  156. package/apps/web/public/brand/openadminjs-logo-monochrome.png +0 -0
  157. package/apps/web/public/brand/openadminjs-logo-new.png +0 -0
  158. package/apps/web/tailwind.config.ts +21 -0
  159. package/apps/web/test/next-stub.ts +7 -0
  160. package/apps/web/tsconfig.json +23 -0
  161. package/apps/web/vitest.config.ts +19 -0
  162. package/docs/content/security.md +7 -0
  163. package/eslint.config.mjs +11 -0
  164. package/examples/README.md +80 -0
  165. package/examples/basic-admin/README.md +24 -0
  166. package/examples/basic-admin/package.json +17 -0
  167. package/examples/basic-admin/prisma/models.fragment.prisma +12 -0
  168. package/examples/basic-admin/src/index.test.ts +8 -0
  169. package/examples/basic-admin/src/index.ts +5 -0
  170. package/examples/basic-admin/src/resources/lead.resource.ts +30 -0
  171. package/examples/basic-admin/tsconfig.json +7 -0
  172. package/examples/basic-admin/vitest.config.ts +16 -0
  173. package/examples/blog-admin/README.md +18 -0
  174. package/examples/blog-admin/package.json +17 -0
  175. package/examples/blog-admin/prisma/models.fragment.prisma +30 -0
  176. package/examples/blog-admin/src/index.test.ts +8 -0
  177. package/examples/blog-admin/src/index.ts +5 -0
  178. package/examples/blog-admin/src/resources/authors.resource.ts +21 -0
  179. package/examples/blog-admin/src/resources/tags.resource.ts +20 -0
  180. package/examples/blog-admin/tsconfig.json +7 -0
  181. package/examples/blog-admin/vitest.config.ts +16 -0
  182. package/examples/crm-admin/README.md +17 -0
  183. package/examples/crm-admin/package.json +17 -0
  184. package/examples/crm-admin/prisma/models.fragment.prisma +50 -0
  185. package/examples/crm-admin/src/index.test.ts +9 -0
  186. package/examples/crm-admin/src/index.ts +7 -0
  187. package/examples/crm-admin/src/resources/activities.resource.ts +29 -0
  188. package/examples/crm-admin/src/resources/companies.resource.ts +21 -0
  189. package/examples/crm-admin/src/resources/contacts.resource.ts +24 -0
  190. package/examples/crm-admin/src/resources/deals.resource.ts +30 -0
  191. package/examples/crm-admin/tsconfig.json +7 -0
  192. package/examples/crm-admin/vitest.config.ts +16 -0
  193. package/examples/ecommerce-admin/README.md +17 -0
  194. package/examples/ecommerce-admin/package.json +17 -0
  195. package/examples/ecommerce-admin/prisma/models.fragment.prisma +43 -0
  196. package/examples/ecommerce-admin/src/index.test.ts +8 -0
  197. package/examples/ecommerce-admin/src/index.ts +7 -0
  198. package/examples/ecommerce-admin/src/resources/customers.resource.ts +21 -0
  199. package/examples/ecommerce-admin/src/resources/order-items.resource.ts +22 -0
  200. package/examples/ecommerce-admin/src/resources/orders.resource.ts +27 -0
  201. package/examples/ecommerce-admin/src/resources/products.resource.ts +23 -0
  202. package/examples/ecommerce-admin/tsconfig.json +7 -0
  203. package/examples/ecommerce-admin/vitest.config.ts +16 -0
  204. package/examples/marketplace-admin/README.md +17 -0
  205. package/examples/marketplace-admin/package.json +17 -0
  206. package/examples/marketplace-admin/prisma/models.fragment.prisma +32 -0
  207. package/examples/marketplace-admin/src/index.test.ts +8 -0
  208. package/examples/marketplace-admin/src/index.ts +6 -0
  209. package/examples/marketplace-admin/src/resources/listings.resource.ts +29 -0
  210. package/examples/marketplace-admin/src/resources/payouts.resource.ts +28 -0
  211. package/examples/marketplace-admin/src/resources/sellers.resource.ts +28 -0
  212. package/examples/marketplace-admin/tsconfig.json +7 -0
  213. package/examples/marketplace-admin/vitest.config.ts +16 -0
  214. package/examples/support-admin/README.md +18 -0
  215. package/examples/support-admin/package.json +17 -0
  216. package/examples/support-admin/prisma/models.fragment.prisma +20 -0
  217. package/examples/support-admin/src/index.test.ts +8 -0
  218. package/examples/support-admin/src/index.ts +5 -0
  219. package/examples/support-admin/src/resources/ticket-messages.resource.ts +22 -0
  220. package/examples/support-admin/src/resources/tickets.resource.ts +35 -0
  221. package/examples/support-admin/tsconfig.json +7 -0
  222. package/examples/support-admin/vitest.config.ts +16 -0
  223. package/package.json +33 -0
  224. package/packages/auth/package.json +17 -0
  225. package/packages/auth/src/index.test.ts +10 -0
  226. package/packages/auth/src/index.ts +17 -0
  227. package/packages/auth/tsconfig.json +8 -0
  228. package/packages/brand/apps/admin/public/brand/apple-touch-icon.png +0 -0
  229. package/packages/brand/apps/admin/public/brand/favicon.svg +1 -0
  230. package/packages/brand/apps/admin/public/brand/og-image.png +0 -0
  231. package/packages/brand/apps/admin/public/brand/openadminjs-icon-new.png +0 -0
  232. package/packages/brand/apps/admin/public/brand/openadminjs-logo-monochrome.png +0 -0
  233. package/packages/brand/apps/admin/public/brand/openadminjs-logo-new.png +0 -0
  234. package/packages/brand/apps/web/public/brand/apple-touch-icon.png +0 -0
  235. package/packages/brand/apps/web/public/brand/favicon.svg +1 -0
  236. package/packages/brand/apps/web/public/brand/og-image.png +0 -0
  237. package/packages/brand/apps/web/public/brand/openadminjs-icon-new.png +0 -0
  238. package/packages/brand/apps/web/public/brand/openadminjs-logo-monochrome.png +0 -0
  239. package/packages/brand/apps/web/public/brand/openadminjs-logo-new.png +0 -0
  240. package/packages/brand/package.json +19 -0
  241. package/packages/brand/site/assets/brand/favicon.svg +1 -0
  242. package/packages/brand/site/assets/brand/og-image.svg +1 -0
  243. package/packages/brand/site/assets/brand/openadminjs-icon.svg +1 -0
  244. package/packages/brand/site/assets/brand/openadminjs-logo-dark.svg +1 -0
  245. package/packages/brand/site/assets/brand/openadminjs-logo-horizontal.svg +1 -0
  246. package/packages/brand/site/assets/brand/openadminjs-logo-monochrome.svg +1 -0
  247. package/packages/brand/site/assets/brand/openadminjs-logo.svg +1 -0
  248. package/packages/brand/src/generate-assets.mjs +182 -0
  249. package/packages/brand/src/index.test.ts +9 -0
  250. package/packages/brand/src/index.ts +7 -0
  251. package/packages/brand/tsconfig.json +7 -0
  252. package/packages/cli/package.json +44 -0
  253. package/packages/cli/src/create-project.ts +227 -0
  254. package/packages/cli/src/index.test.ts +8 -0
  255. package/packages/cli/src/index.ts +90 -0
  256. package/packages/cli/src/resource-slug.test.ts +10 -0
  257. package/packages/cli/src/resource-slug.ts +4 -0
  258. package/packages/cli/template/.env.example +4 -0
  259. package/packages/cli/template/README.md +13 -0
  260. package/packages/cli/template/apps/web/README.md +12 -0
  261. package/packages/cli/template/apps/web/app/globals.css +12 -0
  262. package/packages/cli/template/apps/web/app/layout.tsx +18 -0
  263. package/packages/cli/template/apps/web/app/page.tsx +27 -0
  264. package/packages/cli/template/apps/web/app/posts/[slug]/page.tsx +38 -0
  265. package/packages/cli/template/apps/web/app/posts/page.tsx +20 -0
  266. package/packages/cli/template/apps/web/app/robots.txt/route.ts +9 -0
  267. package/packages/cli/template/apps/web/app/sitemap.xml/route.ts +20 -0
  268. package/packages/cli/template/apps/web/components/public-fields.tsx +22 -0
  269. package/packages/cli/template/apps/web/lib/openadmin-client.ts +71 -0
  270. package/packages/cli/template/apps/web/lib/seo.ts +42 -0
  271. package/packages/cli/template/apps/web/next-env.d.ts +2 -0
  272. package/packages/cli/template/apps/web/next.config.mjs +5 -0
  273. package/packages/cli/template/apps/web/package.json +29 -0
  274. package/packages/cli/template/apps/web/postcss.config.mjs +6 -0
  275. package/packages/cli/template/apps/web/public/brand/apple-touch-icon.png +0 -0
  276. package/packages/cli/template/apps/web/public/brand/favicon.svg +1 -0
  277. package/packages/cli/template/apps/web/public/brand/og-image.png +0 -0
  278. package/packages/cli/template/apps/web/public/brand/openadminjs-icon-new.png +0 -0
  279. package/packages/cli/template/apps/web/public/brand/openadminjs-logo-monochrome.png +0 -0
  280. package/packages/cli/template/apps/web/public/brand/openadminjs-logo-new.png +0 -0
  281. package/packages/cli/template/apps/web/tailwind.config.ts +21 -0
  282. package/packages/cli/template/apps/web/tsconfig.json +23 -0
  283. package/packages/cli/template/package.json +19 -0
  284. package/packages/cli/template/pnpm-workspace.yaml +3 -0
  285. package/packages/cli/tsconfig.json +10 -0
  286. package/packages/core/package.json +20 -0
  287. package/packages/core/src/index.js +1 -0
  288. package/packages/core/src/index.test.ts +27 -0
  289. package/packages/core/src/index.ts +61 -0
  290. package/packages/core/tsconfig.json +8 -0
  291. package/packages/create-openadminjs/package.json +25 -0
  292. package/packages/create-openadminjs/src/index.ts +70 -0
  293. package/packages/create-openadminjs/src/package-name.test.ts +13 -0
  294. package/packages/create-openadminjs/src/package-name.ts +8 -0
  295. package/packages/create-openadminjs/src/render-files.test.ts +26 -0
  296. package/packages/create-openadminjs/src/render-files.ts +21 -0
  297. package/packages/create-openadminjs/template/.env.example +4 -0
  298. package/packages/create-openadminjs/template/README.md +13 -0
  299. package/packages/create-openadminjs/template/apps/web/README.md +12 -0
  300. package/packages/create-openadminjs/template/apps/web/app/globals.css +12 -0
  301. package/packages/create-openadminjs/template/apps/web/app/layout.tsx +18 -0
  302. package/packages/create-openadminjs/template/apps/web/app/page.tsx +27 -0
  303. package/packages/create-openadminjs/template/apps/web/app/posts/[slug]/page.tsx +38 -0
  304. package/packages/create-openadminjs/template/apps/web/app/posts/page.tsx +20 -0
  305. package/packages/create-openadminjs/template/apps/web/app/robots.txt/route.ts +9 -0
  306. package/packages/create-openadminjs/template/apps/web/app/sitemap.xml/route.ts +20 -0
  307. package/packages/create-openadminjs/template/apps/web/components/public-fields.tsx +22 -0
  308. package/packages/create-openadminjs/template/apps/web/lib/openadmin-client.ts +71 -0
  309. package/packages/create-openadminjs/template/apps/web/lib/seo.ts +42 -0
  310. package/packages/create-openadminjs/template/apps/web/next-env.d.ts +2 -0
  311. package/packages/create-openadminjs/template/apps/web/next.config.mjs +5 -0
  312. package/packages/create-openadminjs/template/apps/web/package.json +29 -0
  313. package/packages/create-openadminjs/template/apps/web/postcss.config.mjs +6 -0
  314. package/packages/create-openadminjs/template/apps/web/public/brand/apple-touch-icon.png +0 -0
  315. package/packages/create-openadminjs/template/apps/web/public/brand/favicon.svg +1 -0
  316. package/packages/create-openadminjs/template/apps/web/public/brand/og-image.png +0 -0
  317. package/packages/create-openadminjs/template/apps/web/public/brand/openadminjs-icon-new.png +0 -0
  318. package/packages/create-openadminjs/template/apps/web/public/brand/openadminjs-logo-monochrome.png +0 -0
  319. package/packages/create-openadminjs/template/apps/web/public/brand/openadminjs-logo-new.png +0 -0
  320. package/packages/create-openadminjs/template/apps/web/tailwind.config.ts +21 -0
  321. package/packages/create-openadminjs/template/apps/web/tsconfig.json +23 -0
  322. package/packages/create-openadminjs/template/package.json +19 -0
  323. package/packages/create-openadminjs/template/pnpm-workspace.yaml +3 -0
  324. package/packages/create-openadminjs/tsconfig.json +10 -0
  325. package/packages/mail/package.json +18 -0
  326. package/packages/mail/src/index.test.ts +23 -0
  327. package/packages/mail/src/index.ts +246 -0
  328. package/packages/mail/tsconfig.json +5 -0
  329. package/packages/notifications/package.json +16 -0
  330. package/packages/notifications/src/index.test.ts +9 -0
  331. package/packages/notifications/src/index.ts +5 -0
  332. package/packages/notifications/tsconfig.json +5 -0
  333. package/packages/payments/package.json +15 -0
  334. package/packages/payments/src/index.ts +256 -0
  335. package/packages/payments/tsconfig.json +9 -0
  336. package/packages/permissions/package.json +17 -0
  337. package/packages/permissions/src/blueprints.js +57 -0
  338. package/packages/permissions/src/blueprints.test.ts +62 -0
  339. package/packages/permissions/src/blueprints.ts +89 -0
  340. package/packages/permissions/src/index.js +11 -0
  341. package/packages/permissions/src/index.test.ts +34 -0
  342. package/packages/permissions/src/index.ts +22 -0
  343. package/packages/permissions/tsconfig.json +8 -0
  344. package/packages/plugin-sdk/package.json +26 -0
  345. package/packages/plugin-sdk/src/hooks.ts +44 -0
  346. package/packages/plugin-sdk/src/index.ts +37 -0
  347. package/packages/plugin-sdk/src/sdk.test.ts +13 -0
  348. package/packages/plugin-sdk/tsconfig.json +8 -0
  349. package/packages/plugin-sdk/vitest.config.ts +5 -0
  350. package/packages/queue/package.json +16 -0
  351. package/packages/queue/src/index.test.ts +12 -0
  352. package/packages/queue/src/index.ts +6 -0
  353. package/packages/queue/tsconfig.json +5 -0
  354. package/packages/resource/package.json +17 -0
  355. package/packages/resource/src/index.js +177 -0
  356. package/packages/resource/src/index.test.ts +151 -0
  357. package/packages/resource/src/index.ts +344 -0
  358. package/packages/resource/tsconfig.json +8 -0
  359. package/packages/storage/package.json +16 -0
  360. package/packages/storage/src/index.test.ts +10 -0
  361. package/packages/storage/src/index.ts +23 -0
  362. package/packages/storage/tsconfig.json +5 -0
  363. package/pnpm-workspace.yaml +4 -0
  364. package/prisma/migrations/20260505151751_baseline_init_all_tables/migration.sql +371 -0
  365. package/prisma/migrations/migration_lock.toml +3 -0
  366. package/prisma/schema.prisma +291 -0
  367. package/prisma/seed.ts +210 -0
  368. package/scripts/check-static-site.mjs +17 -0
  369. package/scripts/e2e-smoke.mjs +17 -0
  370. package/scripts/make-executable.mjs +4 -0
  371. package/site/.nojekyll +0 -0
  372. package/site/assets/brand/apple-touch-icon.png +0 -0
  373. package/site/assets/brand/favicon.svg +1 -0
  374. package/site/assets/brand/og-image.png +0 -0
  375. package/site/assets/brand/openadminjs-icon-new.png +0 -0
  376. package/site/assets/brand/openadminjs-logo-monochrome.png +0 -0
  377. package/site/assets/brand/openadminjs-logo-new.png +0 -0
  378. package/site/assets/css/styles.css +1521 -0
  379. package/site/assets/js/main.js +193 -0
  380. package/site/assets/partners/arcbyte.svg +11 -0
  381. package/site/assets/partners/gridstack.svg +8 -0
  382. package/site/assets/partners/nebula.svg +12 -0
  383. package/site/assets/partners/orbitlab.svg +7 -0
  384. package/site/assets/partners/pulseforge.svg +11 -0
  385. package/site/assets/partners/vertex.svg +6 -0
  386. package/site/docs.html +1452 -0
  387. package/site/index.html +357 -0
  388. package/tsconfig.base.json +23 -0
@@ -0,0 +1,27 @@
1
+ import Link from "next/link";
2
+ import { listPublicRecords } from "../lib/openadmin-client";
3
+
4
+ export default async function HomePage() {
5
+ const posts = await listPublicRecords("posts");
6
+
7
+ return (
8
+ <main className="mx-auto max-w-5xl px-4 py-12">
9
+ <section className="max-w-3xl">
10
+ <p className="text-sm font-semibold uppercase text-emerald-700">OpenAdminJS Web Layer</p>
11
+ <h1 className="mt-3 text-4xl font-semibold tracking-normal">Public frontend powered by resources</h1>
12
+ <p className="mt-4 text-lg leading-8 text-slate-600">
13
+ This side is part of generated applications. Use it to build public pages, SEO landing pages, catalogs, blogs or custom frontend flows on top of the same API and resource metadata.
14
+ </p>
15
+ </section>
16
+
17
+ <section className="mt-10 grid gap-4">
18
+ {posts.map((post) => (
19
+ <Link key={post.id} href={`/posts/${post.slug}`} className="rounded-md border border-slate-200 bg-white p-5 hover:border-emerald-300">
20
+ <h2 className="font-semibold">{String(post.title)}</h2>
21
+ <p className="mt-2 text-sm leading-6 text-slate-600">{String(post.excerpt)}</p>
22
+ </Link>
23
+ ))}
24
+ </section>
25
+ </main>
26
+ );
27
+ }
@@ -0,0 +1,38 @@
1
+ import { notFound } from "next/navigation";
2
+ import type { Metadata } from "next";
3
+ import { PublicFields } from "../../../components/public-fields";
4
+ import { getPublicRecord, getPublicResource, listPublicRecords } from "../../../lib/openadmin-client";
5
+ import { metadataForRecord } from "../../../lib/seo";
6
+
7
+ export async function generateStaticParams() {
8
+ const posts = await listPublicRecords("posts");
9
+ return posts.map((post) => ({ slug: String(post.slug ?? post.id) }));
10
+ }
11
+
12
+ export async function generateMetadata({ params }: { params: Promise<{ slug: string }> }): Promise<Metadata> {
13
+ const { slug } = await params;
14
+ const resource = getPublicResource("posts");
15
+ const post = await getPublicRecord("posts", slug);
16
+ if (!post) return {};
17
+ return metadataForRecord(resource, post);
18
+ }
19
+
20
+ export default async function PostPage({ params }: { params: Promise<{ slug: string }> }) {
21
+ const { slug } = await params;
22
+ const resource = getPublicResource("posts");
23
+ const post = await getPublicRecord("posts", slug);
24
+ if (!post) notFound();
25
+
26
+ return (
27
+ <main className="mx-auto max-w-3xl px-4 py-12">
28
+ <article>
29
+ <p className="text-sm font-semibold uppercase text-emerald-700">{resource.label}</p>
30
+ <h1 className="mt-3 text-4xl font-semibold tracking-normal">{String(post.title)}</h1>
31
+ <p className="mt-4 text-lg leading-8 text-slate-600">{String(post.excerpt)}</p>
32
+ <div className="mt-10">
33
+ <PublicFields resource={resource} record={post} />
34
+ </div>
35
+ </article>
36
+ </main>
37
+ );
38
+ }
@@ -0,0 +1,20 @@
1
+ import Link from "next/link";
2
+ import { listPublicRecords } from "../../lib/openadmin-client";
3
+
4
+ export default async function PostsPage() {
5
+ const posts = await listPublicRecords("posts");
6
+
7
+ return (
8
+ <main className="mx-auto max-w-4xl px-4 py-12">
9
+ <h1 className="text-3xl font-semibold tracking-normal">Posts</h1>
10
+ <div className="mt-8 grid gap-4">
11
+ {posts.map((post) => (
12
+ <Link key={post.id} href={`/posts/${post.slug}`} className="rounded-md border border-slate-200 bg-white p-5">
13
+ <h2 className="font-semibold">{String(post.title)}</h2>
14
+ <p className="mt-2 text-sm text-slate-600">{String(post.excerpt)}</p>
15
+ </Link>
16
+ ))}
17
+ </div>
18
+ </main>
19
+ );
20
+ }
@@ -0,0 +1,9 @@
1
+ import { absoluteUrl } from "../../lib/seo";
2
+
3
+ export function GET() {
4
+ return new Response(`User-agent: *\nAllow: /\nSitemap: ${absoluteUrl("/sitemap.xml")}\n`, {
5
+ headers: {
6
+ "content-type": "text/plain"
7
+ }
8
+ });
9
+ }
@@ -0,0 +1,20 @@
1
+ import { listPublicRecords } from "../../lib/openadmin-client";
2
+ import { absoluteUrl, sitemapXml } from "../../lib/seo";
3
+
4
+ export async function GET() {
5
+ const posts = await listPublicRecords("posts");
6
+ const urls = [
7
+ { loc: absoluteUrl("/") },
8
+ { loc: absoluteUrl("/posts") },
9
+ ...posts.map((post) => ({
10
+ loc: absoluteUrl(`/posts/${post.slug ?? post.id}`),
11
+ lastmod: post.updatedAt
12
+ }))
13
+ ];
14
+
15
+ return new Response(sitemapXml(urls), {
16
+ headers: {
17
+ "content-type": "application/xml"
18
+ }
19
+ });
20
+ }
@@ -0,0 +1,22 @@
1
+ import type { PublicRecord, PublicResourceConfig } from "../lib/openadmin-client";
2
+
3
+ export function PublicFields({ resource, record }: { resource: PublicResourceConfig; record: PublicRecord }) {
4
+ const fields = Object.entries(resource.fields).filter(([, field]) => field.public);
5
+
6
+ return (
7
+ <dl className="grid gap-4">
8
+ {fields.map(([name, field]) => (
9
+ <div key={name} className="rounded-md border border-slate-200 bg-white p-4">
10
+ <dt className="text-sm font-medium text-slate-500">{field.label ?? name}</dt>
11
+ <dd className="mt-2 text-slate-950">{formatValue(record[name], field.type)}</dd>
12
+ </div>
13
+ ))}
14
+ </dl>
15
+ );
16
+ }
17
+
18
+ function formatValue(value: unknown, type: string): string {
19
+ if (value == null) return "";
20
+ if (type === "datetime" || type === "date") return new Date(String(value)).toLocaleDateString();
21
+ return String(value);
22
+ }
@@ -0,0 +1,82 @@
1
+ import type { ResourceSeoConfig } from "@openadminjs/core";
2
+
3
+ export type PublicFieldConfig = {
4
+ type: string;
5
+ label?: string;
6
+ public?: boolean;
7
+ seo?: "title" | "description" | "image" | "slug" | "canonical";
8
+ };
9
+
10
+ export type PublicResourceConfig = {
11
+ name: string;
12
+ label: string;
13
+ basePath: string;
14
+ titleField: string;
15
+ descriptionField?: string;
16
+ slugField: string;
17
+ /** Aligns with `defineResource` SEO block for hreflang, OG image, custom paths */
18
+ seo?: ResourceSeoConfig;
19
+ fields: Record<string, PublicFieldConfig>;
20
+ };
21
+
22
+ export type PublicRecord = Record<string, unknown> & {
23
+ id: string;
24
+ slug?: string;
25
+ title?: string;
26
+ description?: string;
27
+ updatedAt?: string;
28
+ };
29
+
30
+ export const publicResources: PublicResourceConfig[] = [
31
+ {
32
+ name: "posts",
33
+ label: "Posts",
34
+ basePath: "/posts",
35
+ titleField: "title",
36
+ descriptionField: "excerpt",
37
+ slugField: "slug",
38
+ seo: {
39
+ public: true,
40
+ slugField: "slug",
41
+ pathPattern: "/posts/:slug",
42
+ titleField: "title",
43
+ descriptionField: "excerpt"
44
+ },
45
+ fields: {
46
+ title: { type: "text", label: "Title", public: true, seo: "title" },
47
+ slug: { type: "slug", label: "Slug", public: false, seo: "slug" },
48
+ excerpt: { type: "textarea", label: "Excerpt", public: true, seo: "description" },
49
+ content: { type: "richtext", label: "Content", public: true },
50
+ status: { type: "badge", label: "Status", public: false },
51
+ updatedAt: { type: "datetime", label: "Updated", public: true }
52
+ }
53
+ }
54
+ ];
55
+
56
+ const demoPosts: PublicRecord[] = [
57
+ {
58
+ id: "welcome",
59
+ slug: "welcome-to-openadminjs",
60
+ title: "Welcome to OpenAdminJS",
61
+ excerpt: "Public resource pages can be generated from the same metadata as admin resources.",
62
+ content:
63
+ "OpenAdminJS keeps API, admin and public web concerns connected through resource metadata while still letting you write custom frontend pages.",
64
+ updatedAt: new Date("2026-04-29T00:00:00.000Z").toISOString()
65
+ }
66
+ ];
67
+
68
+ export function getPublicResource(name: string): PublicResourceConfig {
69
+ const resource = publicResources.find((item) => item.name === name);
70
+ if (!resource) throw new Error(`Unknown public resource: ${name}`);
71
+ return resource;
72
+ }
73
+
74
+ export async function listPublicRecords(resourceName: string): Promise<PublicRecord[]> {
75
+ if (resourceName === "posts") return demoPosts;
76
+ return [];
77
+ }
78
+
79
+ export async function getPublicRecord(resourceName: string, slug: string): Promise<PublicRecord | undefined> {
80
+ const records = await listPublicRecords(resourceName);
81
+ return records.find((record) => record.slug === slug || record.id === slug);
82
+ }
@@ -0,0 +1,41 @@
1
+ import { afterEach, describe, expect, it, vi } from "vitest";
2
+
3
+ describe("seo helpers", () => {
4
+ afterEach(() => {
5
+ vi.unstubAllEnvs();
6
+ vi.resetModules();
7
+ });
8
+
9
+ it("builds absolute URLs from NEXT_PUBLIC_SITE_URL", async () => {
10
+ vi.stubEnv("NEXT_PUBLIC_SITE_URL", "https://example.com");
11
+ const { absoluteUrl } = await import("./seo");
12
+ expect(absoluteUrl("/posts/hello")).toBe("https://example.com/posts/hello");
13
+ });
14
+
15
+ it("metadataForRecord fills canonical and OpenGraph", async () => {
16
+ vi.stubEnv("NEXT_PUBLIC_SITE_URL", "https://example.com");
17
+ const { metadataForRecord } = await import("./seo");
18
+ const meta = metadataForRecord(
19
+ {
20
+ name: "posts",
21
+ label: "Posts",
22
+ basePath: "/posts",
23
+ titleField: "title",
24
+ slugField: "slug",
25
+ fields: {}
26
+ },
27
+ { id: "1", title: "Hi", slug: "hi", description: "d" }
28
+ );
29
+ expect(meta.title).toBe("Hi");
30
+ expect(meta.alternates?.canonical).toBe("https://example.com/posts/hi");
31
+ expect(meta.openGraph?.url).toBe("https://example.com/posts/hi");
32
+ });
33
+
34
+ it("sitemapXml renders url entries", async () => {
35
+ const { sitemapXml } = await import("./seo");
36
+ const xml = sitemapXml([{ loc: "https://example.com/a", lastmod: "2024-01-01" }]);
37
+ expect(xml).toContain("<loc>https://example.com/a</loc>");
38
+ expect(xml).toContain("<lastmod>2024-01-01</lastmod>");
39
+ expect(xml).toContain("<urlset");
40
+ });
41
+ });
@@ -0,0 +1,53 @@
1
+ import { buildSeoPagePayload } from "@openadminjs/core";
2
+ import type { Metadata } from "next";
3
+ import type { PublicRecord, PublicResourceConfig } from "./openadmin-client";
4
+
5
+ const siteUrl = process.env.NEXT_PUBLIC_SITE_URL ?? "http://localhost:3001";
6
+
7
+ export function absoluteUrl(path: string): string {
8
+ return new URL(path, siteUrl).toString();
9
+ }
10
+
11
+ export function metadataForRecord(resource: PublicResourceConfig, record: PublicRecord): Metadata {
12
+ const payload = buildSeoPagePayload({
13
+ siteUrl,
14
+ basePath: resource.basePath,
15
+ seo: resource.seo,
16
+ record: record as Record<string, unknown>,
17
+ resourceLabel: resource.label
18
+ });
19
+
20
+ const ogImages = payload.openGraph.images?.map((img) => img.url).filter(Boolean);
21
+
22
+ return {
23
+ title: payload.title,
24
+ description: payload.description,
25
+ alternates: {
26
+ canonical: payload.canonicalUrl,
27
+ ...(payload.alternates?.languages ? { languages: payload.alternates.languages } : {})
28
+ },
29
+ openGraph: {
30
+ title: payload.openGraph.title,
31
+ description: payload.openGraph.description,
32
+ url: payload.openGraph.url,
33
+ type: payload.openGraph.type as "article",
34
+ ...(ogImages?.length ? { images: ogImages } : {})
35
+ },
36
+ twitter: {
37
+ card: "summary_large_image",
38
+ title: payload.title,
39
+ description: payload.description,
40
+ ...(ogImages?.[0] ? { images: [ogImages[0]] } : {})
41
+ }
42
+ };
43
+ }
44
+
45
+ export function sitemapXml(urls: Array<{ loc: string; lastmod?: string }>): string {
46
+ const items = urls
47
+ .map((url) => {
48
+ const lastmod = url.lastmod ? `<lastmod>${url.lastmod}</lastmod>` : "";
49
+ return `<url><loc>${url.loc}</loc>${lastmod}</url>`;
50
+ })
51
+ .join("");
52
+ return `<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${items}</urlset>`;
53
+ }
@@ -0,0 +1,6 @@
1
+ /// <reference types="next" />
2
+ /// <reference types="next/image-types/global" />
3
+ /// <reference path="./.next/types/routes.d.ts" />
4
+
5
+ // NOTE: This file should not be edited
6
+ // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
@@ -0,0 +1,5 @@
1
+ export default {
2
+ eslint: {
3
+ ignoreDuringBuilds: true
4
+ }
5
+ };
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@openadminjs/web",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "next dev --port 3001",
8
+ "build": "next build",
9
+ "start": "next start --port 3001",
10
+ "lint": "tsc -p tsconfig.json --noEmit",
11
+ "typecheck": "tsc -p tsconfig.json --noEmit",
12
+ "test": "vitest run"
13
+ },
14
+ "dependencies": {
15
+ "@openadminjs/core": "workspace:*",
16
+ "next": "^15.1.0",
17
+ "react": "^19.0.0",
18
+ "react-dom": "^19.0.0"
19
+ },
20
+ "devDependencies": {
21
+ "@types/node": "^22.10.2",
22
+ "@types/react": "^19.0.1",
23
+ "@types/react-dom": "^19.0.2",
24
+ "autoprefixer": "^10.4.20",
25
+ "postcss": "^8.4.49",
26
+ "tailwindcss": "^3.4.17",
27
+ "typescript": "^5.7.2",
28
+ "vitest": "^2.1.8"
29
+ }
30
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {}
5
+ }
6
+ };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 512 512" role="img" aria-label="OpenAdminJS"><image xlink:href="openadminjs-icon-new.png" href="openadminjs-icon-new.png" width="512" height="512" preserveAspectRatio="xMidYMid meet"/></svg>
@@ -0,0 +1,21 @@
1
+ import type { Config } from "tailwindcss";
2
+
3
+ const config: Config = {
4
+ content: ["./app/**/*.{ts,tsx}", "./components/**/*.{ts,tsx}", "./lib/**/*.{ts,tsx}"],
5
+ theme: {
6
+ extend: {
7
+ colors: {
8
+ brand: {
9
+ DEFAULT: "#059669",
10
+ hover: "#047857",
11
+ soft: "#ECFDF5",
12
+ border: "#A7F3D0",
13
+ accent: "#34D399"
14
+ }
15
+ }
16
+ }
17
+ },
18
+ plugins: []
19
+ };
20
+
21
+ export default config;
@@ -0,0 +1,7 @@
1
+ export type Metadata = {
2
+ title?: string | string[];
3
+ description?: string;
4
+ alternates?: { canonical?: string };
5
+ openGraph?: { title?: string; description?: string; url?: string; type?: string };
6
+ twitter?: { card?: string; title?: string; description?: string };
7
+ };
@@ -0,0 +1,23 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "jsx": "preserve",
5
+ "noEmit": true,
6
+ "plugins": [
7
+ {
8
+ "name": "next"
9
+ }
10
+ ],
11
+ "allowJs": true,
12
+ "incremental": true
13
+ },
14
+ "include": [
15
+ "next-env.d.ts",
16
+ "**/*.ts",
17
+ "**/*.tsx",
18
+ ".next/types/**/*.ts"
19
+ ],
20
+ "exclude": [
21
+ "node_modules"
22
+ ]
23
+ }
@@ -0,0 +1,19 @@
1
+ import { dirname, resolve } from "node:path";
2
+ import { fileURLToPath } from "node:url";
3
+ import { defineConfig } from "vitest/config";
4
+
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ const repoRoot = resolve(__dirname, "../..");
7
+
8
+ export default defineConfig({
9
+ test: {
10
+ environment: "node"
11
+ },
12
+ resolve: {
13
+ alias: {
14
+ next: resolve(__dirname, "test/next-stub.ts"),
15
+ "@openadminjs/core": resolve(repoRoot, "packages/core/src/index.ts"),
16
+ "@openadminjs/resource": resolve(repoRoot, "packages/resource/src/index.ts")
17
+ }
18
+ }
19
+ });
@@ -0,0 +1,7 @@
1
+ # Security Checklist
2
+
3
+ - Set strong JWT secrets.
4
+ - Use explicit production CORS.
5
+ - Change demo credentials.
6
+ - Validate upload MIME type, extension and size.
7
+ - Run `openadminjs security check`.
@@ -0,0 +1,11 @@
1
+ export default [
2
+ {
3
+ ignores: ["dist/**", ".next/**", "node_modules/**"]
4
+ },
5
+ {
6
+ files: ["**/*.{ts,tsx}"],
7
+ rules: {
8
+ "no-console": "off"
9
+ }
10
+ }
11
+ ];
@@ -0,0 +1,80 @@
1
+ # Examples
2
+
3
+ Each folder is a **small reference package**: Prisma fragments you can merge into your app, `defineResource` modules for the API admin layer, and a typed export you can mirror in `registry.ts`. They are **not** full standalone servers — create an app with the CLI, then copy or adapt the snippets.
4
+
5
+ From the repo root, typecheck or test all example packages:
6
+
7
+ ```bash
8
+ pnpm install
9
+ pnpm --filter "./examples/*" typecheck
10
+ pnpm --filter "./examples/*" test
11
+ ```
12
+
13
+ | Example | Focus |
14
+ | -------- | ------ |
15
+ | [basic-admin](./basic-admin/) | Minimal stack: users, roles, posts, files, audit, settings |
16
+ | [blog-admin](./blog-admin/) | Editorial: posts, categories, authors, publish workflow |
17
+ | [crm-admin](./crm-admin/) | Sales: contacts, companies, deals, activities |
18
+ | [ecommerce-admin](./ecommerce-admin/) | Catalog: products, variants, orders, inventory |
19
+ | [marketplace-admin](./marketplace-admin/) | Two-sided: listings, sellers, payouts, disputes |
20
+ | [support-admin](./support-admin/) | Ops: tickets, SLAs, canned replies, assignments |
21
+
22
+ ## Publishing packages to npm (maintainers)
23
+
24
+ These steps apply when you publish the single public package from this repo (`openadminjs`), not the whole monorepo root (the root is `private` and is not meant to be published as one package).
25
+
26
+ ### 1. Prerequisites
27
+
28
+ - [npm](https://docs.npmjs.com/) account with publish rights.
29
+ - One-time login: `npm login`
30
+ - Built artifacts: from the repo root, run `pnpm --filter openadminjs build` (or `pnpm build`).
31
+
32
+ ### 2. Package manifest
33
+
34
+ In the package you publish (e.g. `packages/cli/package.json`):
35
+
36
+ - Ensure **`"private": true` is not set** on that package (templates may be private; the CLI package should be publishable).
37
+ - Prefer a **`"files"`** field so only `dist/` (and README) are packed, for example: `"files": ["dist", "README.md"]`.
38
+ - For scoped public packages, add:
39
+
40
+ ```json
41
+ "publishConfig": {
42
+ "access": "public"
43
+ }
44
+ ```
45
+
46
+ For `openadminjs` (unscoped), public publish is the default; keeping `publishConfig.access=public` is still explicit and recommended.
47
+
48
+ ### 3. Dry run
49
+
50
+ From the package directory:
51
+
52
+ ```bash
53
+ cd packages/cli
54
+ npm pack
55
+ ```
56
+
57
+ Inspect the generated `.tgz` (or use `npm publish --dry-run`) to confirm contents.
58
+
59
+ ### 4. Publish
60
+
61
+ ```bash
62
+ cd packages/cli
63
+ npm publish
64
+ ```
65
+
66
+ First publish of a scoped package usually needs public access (see `publishConfig` above), or once: `npm publish --access public`.
67
+
68
+ **Version bumps:** edit `version` in that package’s `package.json`, commit, then publish again. Follow [semver](https://semver.org/).
69
+
70
+ **pnpm:** you can use `pnpm publish` from the package folder instead of `npm publish`; behavior is similar for registry upload.
71
+
72
+ ### 5. CI (optional)
73
+
74
+ Use an automation token (`NPM_TOKEN`) in GitHub Actions with `npm publish` in a release workflow, only on tagged releases, with provenance if you use npm’s OIDC integration.
75
+
76
+ ---
77
+
78
+ If you only want to **install** OpenAdminJS tooling from npm (not publish), use:
79
+
80
+ `npm install -g openadminjs` then `openadminjs create`.
@@ -0,0 +1,24 @@
1
+ # Basic Admin
2
+
3
+ Minimal generated OpenAdminJS project with users, roles, posts, files, audit logs and settings. Use as the default starting point before specializing the schema.
4
+
5
+ **Suggested resources:** `User`, `Role`, `Post`, `File`, `AuditLog`, `Setting`.
6
+
7
+ ## Code in this folder
8
+
9
+ | Path | Purpose |
10
+ |------|---------|
11
+ | `prisma/models.fragment.prisma` | `Lead` model — append to your app `schema.prisma`, then migrate. |
12
+ | `src/resources/lead.resource.ts` | Resource definition — copy into `apps/api/src/resources/`. |
13
+ | `src/index.ts` | `basicExampleResources` — merge into `apps/api/src/resources/registry.ts`. |
14
+
15
+ ### Merge into your app
16
+
17
+ 1. Run `openadminjs create` (or use your existing app).
18
+ 2. Append `prisma/models.fragment.prisma` to `prisma/schema.prisma`.
19
+ 3. Copy `src/resources/*.ts` into `apps/api/src/resources/`.
20
+ 4. Import resources in `registry.ts` and add them to the `resources` array (see `basicExampleResources` in `src/index.ts`).
21
+ 5. Register matching permissions in your seed / RBAC layer (`leads.read`, …).
22
+ 6. `pnpm db:migrate` (or your migrate command).
23
+
24
+ This package is part of the monorepo so `pnpm exec tsc` can typecheck snippets against `@openadminjs/core`; it is not a standalone runnable server.
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "@openadminjs/example-basic",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "description": "Reference code: one extra Lead model on top of a generated OpenAdminJS app.",
7
+ "scripts": {
8
+ "typecheck": "tsc -p tsconfig.json --noEmit",
9
+ "lint": "tsc -p tsconfig.json --noEmit",
10
+ "test": "vitest run"
11
+ },
12
+ "devDependencies": {
13
+ "@openadminjs/core": "workspace:*",
14
+ "typescript": "^5.7.2",
15
+ "vitest": "^2.1.8"
16
+ }
17
+ }
@@ -0,0 +1,12 @@
1
+ // Append these models to apps/*/prisma/schema.prisma (below datasource), then run prisma migrate.
2
+
3
+ model Lead {
4
+ id String @id @default(cuid())
5
+ email String?
6
+ name String?
7
+ company String?
8
+ status String @default("new")
9
+ notes String?
10
+ createdAt DateTime @default(now())
11
+ updatedAt DateTime @updatedAt
12
+ }
@@ -0,0 +1,8 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { basicExampleResources } from "./index";
3
+
4
+ describe("basicExampleResources", () => {
5
+ it("includes leads resource", () => {
6
+ expect(basicExampleResources.map((r) => r.name)).toContain("leads");
7
+ });
8
+ });
@@ -0,0 +1,5 @@
1
+ import type { ResourceConfig } from "@openadminjs/core";
2
+ import lead from "./resources/lead.resource";
3
+
4
+ /** Copy resources into `apps/api/src/resources/` and merge this array into `registry.ts`. */
5
+ export const basicExampleResources = [lead] satisfies ResourceConfig[];