@nuraly/lumenjs 0.1.3 → 0.1.4

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 (333) hide show
  1. package/README.md +62 -282
  2. package/dist/auth/config.d.ts +23 -0
  3. package/dist/auth/config.js +115 -0
  4. package/dist/auth/guard.d.ts +12 -0
  5. package/dist/auth/guard.js +28 -0
  6. package/dist/auth/index.d.ts +3 -0
  7. package/dist/auth/index.js +1 -0
  8. package/dist/auth/middleware.d.ts +23 -0
  9. package/dist/auth/middleware.js +89 -0
  10. package/dist/auth/native-auth.d.ts +73 -0
  11. package/dist/auth/native-auth.js +293 -0
  12. package/dist/auth/oidc-client.d.ts +17 -0
  13. package/dist/auth/oidc-client.js +123 -0
  14. package/dist/auth/providers/google.d.ts +23 -0
  15. package/dist/auth/providers/google.js +25 -0
  16. package/dist/auth/providers/index.d.ts +2 -0
  17. package/dist/auth/providers/index.js +1 -0
  18. package/dist/auth/routes/login.d.ts +8 -0
  19. package/dist/auth/routes/login.js +98 -0
  20. package/dist/auth/routes/logout.d.ts +4 -0
  21. package/dist/auth/routes/logout.js +79 -0
  22. package/dist/auth/routes/oidc-callback.d.ts +3 -0
  23. package/dist/auth/routes/oidc-callback.js +70 -0
  24. package/dist/auth/routes/password.d.ts +5 -0
  25. package/dist/auth/routes/password.js +149 -0
  26. package/dist/auth/routes/signup.d.ts +3 -0
  27. package/dist/auth/routes/signup.js +81 -0
  28. package/dist/auth/routes/token.d.ts +4 -0
  29. package/dist/auth/routes/token.js +70 -0
  30. package/dist/auth/routes/utils.d.ts +7 -0
  31. package/dist/auth/routes/utils.js +35 -0
  32. package/dist/auth/routes/verify.d.ts +3 -0
  33. package/dist/auth/routes/verify.js +26 -0
  34. package/dist/auth/routes.d.ts +8 -0
  35. package/dist/auth/routes.js +110 -0
  36. package/dist/auth/session.d.ts +8 -0
  37. package/dist/auth/session.js +54 -0
  38. package/dist/auth/token.d.ts +33 -0
  39. package/dist/auth/token.js +90 -0
  40. package/dist/auth/types.d.ts +156 -0
  41. package/dist/auth/types.js +2 -0
  42. package/dist/build/build-client.d.ts +15 -0
  43. package/dist/build/build-client.js +45 -0
  44. package/dist/build/build-prerender.d.ts +11 -0
  45. package/dist/build/build-prerender.js +159 -0
  46. package/dist/build/build-server.d.ts +17 -0
  47. package/dist/build/build-server.js +98 -0
  48. package/dist/build/build.js +48 -120
  49. package/dist/build/scan.d.ts +17 -0
  50. package/dist/build/scan.js +76 -6
  51. package/dist/build/serve-api.js +8 -2
  52. package/dist/build/serve-loaders.d.ts +4 -4
  53. package/dist/build/serve-loaders.js +26 -18
  54. package/dist/build/serve-ssr.js +38 -11
  55. package/dist/build/serve-static.js +3 -3
  56. package/dist/build/serve.js +218 -15
  57. package/dist/cli.js +37 -6
  58. package/dist/communication/encryption.d.ts +35 -0
  59. package/dist/communication/encryption.js +90 -0
  60. package/dist/communication/handlers/context.d.ts +27 -0
  61. package/dist/communication/handlers/context.js +1 -0
  62. package/dist/communication/handlers/conversation.d.ts +24 -0
  63. package/dist/communication/handlers/conversation.js +113 -0
  64. package/dist/communication/handlers/file-upload.d.ts +17 -0
  65. package/dist/communication/handlers/file-upload.js +62 -0
  66. package/dist/communication/handlers/messaging.d.ts +30 -0
  67. package/dist/communication/handlers/messaging.js +237 -0
  68. package/dist/communication/handlers/presence.d.ts +15 -0
  69. package/dist/communication/handlers/presence.js +76 -0
  70. package/dist/communication/handlers.d.ts +5 -0
  71. package/dist/communication/handlers.js +5 -0
  72. package/dist/communication/index.d.ts +9 -0
  73. package/dist/communication/index.js +7 -0
  74. package/dist/communication/link-preview.d.ts +18 -0
  75. package/dist/communication/link-preview.js +115 -0
  76. package/dist/communication/schema.d.ts +10 -0
  77. package/dist/communication/schema.js +101 -0
  78. package/dist/communication/server.d.ts +86 -0
  79. package/dist/communication/server.js +212 -0
  80. package/dist/communication/signaling.d.ts +43 -0
  81. package/dist/communication/signaling.js +271 -0
  82. package/dist/communication/store.d.ts +71 -0
  83. package/dist/communication/store.js +289 -0
  84. package/dist/communication/types.d.ts +454 -0
  85. package/dist/communication/types.js +1 -0
  86. package/dist/create.d.ts +1 -0
  87. package/dist/create.js +55 -0
  88. package/dist/db/auto-migrate.d.ts +3 -0
  89. package/dist/db/auto-migrate.js +100 -0
  90. package/dist/db/client.d.ts +3 -0
  91. package/dist/db/client.js +18 -0
  92. package/dist/db/index.d.ts +17 -13
  93. package/dist/db/index.js +205 -26
  94. package/dist/db/seed.d.ts +12 -0
  95. package/dist/db/seed.js +88 -0
  96. package/dist/db/table.d.ts +10 -0
  97. package/dist/db/table.js +12 -0
  98. package/dist/dev-server/config.d.ts +11 -0
  99. package/dist/dev-server/config.js +23 -20
  100. package/dist/dev-server/index-html.d.ts +3 -0
  101. package/dist/dev-server/index-html.js +18 -6
  102. package/dist/dev-server/nuralyui-aliases.d.ts +0 -4
  103. package/dist/dev-server/nuralyui-aliases.js +115 -94
  104. package/dist/dev-server/plugins/vite-plugin-api-routes.js +29 -5
  105. package/dist/dev-server/plugins/vite-plugin-auth.d.ts +6 -0
  106. package/dist/dev-server/plugins/vite-plugin-auth.js +223 -0
  107. package/dist/dev-server/plugins/vite-plugin-auto-define.d.ts +16 -0
  108. package/dist/dev-server/plugins/vite-plugin-auto-define.js +111 -0
  109. package/dist/dev-server/plugins/vite-plugin-communication.d.ts +6 -0
  110. package/dist/dev-server/plugins/vite-plugin-communication.js +205 -0
  111. package/dist/dev-server/plugins/vite-plugin-editor-api.d.ts +6 -0
  112. package/dist/dev-server/plugins/vite-plugin-editor-api.js +318 -0
  113. package/dist/dev-server/plugins/vite-plugin-i18n.js +69 -2
  114. package/dist/dev-server/plugins/vite-plugin-lit-dedup.d.ts +6 -0
  115. package/dist/dev-server/plugins/vite-plugin-lit-dedup.js +78 -34
  116. package/dist/dev-server/plugins/vite-plugin-lit-hmr.js +44 -2
  117. package/dist/dev-server/plugins/vite-plugin-llms.d.ts +2 -0
  118. package/dist/dev-server/plugins/vite-plugin-llms.js +92 -0
  119. package/dist/dev-server/plugins/vite-plugin-loaders.js +146 -13
  120. package/dist/dev-server/plugins/vite-plugin-routes.js +15 -5
  121. package/dist/dev-server/plugins/vite-plugin-socketio.d.ts +2 -0
  122. package/dist/dev-server/plugins/vite-plugin-socketio.js +51 -0
  123. package/dist/dev-server/plugins/vite-plugin-source-annotator.d.ts +2 -0
  124. package/dist/dev-server/plugins/vite-plugin-source-annotator.js +26 -3
  125. package/dist/dev-server/plugins/vite-plugin-storage.d.ts +10 -0
  126. package/dist/dev-server/plugins/vite-plugin-storage.js +126 -0
  127. package/dist/dev-server/plugins/vite-plugin-virtual-modules.js +111 -2
  128. package/dist/dev-server/server.js +127 -13
  129. package/dist/dev-server/ssr-render.d.ts +2 -1
  130. package/dist/dev-server/ssr-render.js +107 -48
  131. package/dist/editor/ai/backend.d.ts +20 -0
  132. package/dist/editor/ai/backend.js +104 -0
  133. package/dist/editor/ai/claude-code-client.d.ts +20 -0
  134. package/dist/editor/ai/claude-code-client.js +145 -0
  135. package/dist/editor/ai/opencode-client.d.ts +14 -0
  136. package/dist/editor/ai/opencode-client.js +125 -0
  137. package/dist/editor/ai/snapshot-store.d.ts +22 -0
  138. package/dist/editor/ai/snapshot-store.js +35 -0
  139. package/dist/editor/ai/types.d.ts +30 -0
  140. package/dist/editor/ai/types.js +136 -0
  141. package/dist/editor/ai-chat-panel.d.ts +13 -0
  142. package/dist/editor/ai-chat-panel.js +587 -0
  143. package/dist/editor/ai-markdown.d.ts +10 -0
  144. package/dist/editor/ai-markdown.js +70 -0
  145. package/dist/editor/ai-project-panel.d.ts +11 -0
  146. package/dist/editor/ai-project-panel.js +332 -0
  147. package/dist/editor/ast-modification.d.ts +11 -0
  148. package/dist/editor/ast-modification.js +1 -0
  149. package/dist/editor/ast-service.d.ts +30 -0
  150. package/dist/editor/ast-service.js +180 -0
  151. package/dist/editor/css-rules.d.ts +54 -0
  152. package/dist/editor/css-rules.js +423 -0
  153. package/dist/editor/editor-api-client.d.ts +51 -0
  154. package/dist/editor/editor-api-client.js +162 -0
  155. package/dist/editor/editor-bridge.d.ts +1 -0
  156. package/dist/editor/editor-bridge.js +17 -8
  157. package/dist/editor/editor-toolbar.d.ts +14 -0
  158. package/dist/editor/editor-toolbar.js +115 -0
  159. package/dist/editor/file-editor.d.ts +9 -0
  160. package/dist/editor/file-editor.js +236 -0
  161. package/dist/editor/file-service.d.ts +16 -0
  162. package/dist/editor/file-service.js +52 -0
  163. package/dist/editor/i18n-key-gen.d.ts +1 -0
  164. package/dist/editor/i18n-key-gen.js +7 -0
  165. package/dist/editor/inline-text-edit.d.ts +5 -0
  166. package/dist/editor/inline-text-edit.js +173 -92
  167. package/dist/editor/overlay-events.d.ts +5 -0
  168. package/dist/editor/overlay-events.js +364 -0
  169. package/dist/editor/overlay-hmr.d.ts +2 -0
  170. package/dist/editor/overlay-hmr.js +75 -0
  171. package/dist/editor/overlay-selection.d.ts +29 -0
  172. package/dist/editor/overlay-selection.js +148 -0
  173. package/dist/editor/overlay-utils.d.ts +12 -0
  174. package/dist/editor/overlay-utils.js +59 -0
  175. package/dist/editor/properties-panel-persist.d.ts +14 -0
  176. package/dist/editor/properties-panel-persist.js +70 -0
  177. package/dist/editor/properties-panel-rows.d.ts +10 -0
  178. package/dist/editor/properties-panel-rows.js +349 -0
  179. package/dist/editor/properties-panel-styles.d.ts +4 -0
  180. package/dist/editor/properties-panel-styles.js +174 -0
  181. package/dist/editor/properties-panel.d.ts +4 -0
  182. package/dist/editor/properties-panel.js +148 -0
  183. package/dist/editor/property-registry.d.ts +16 -0
  184. package/dist/editor/property-registry.js +303 -0
  185. package/dist/editor/standalone-file-panel.d.ts +0 -0
  186. package/dist/editor/standalone-file-panel.js +1 -0
  187. package/dist/editor/standalone-overlay-dom.d.ts +0 -0
  188. package/dist/editor/standalone-overlay-dom.js +1 -0
  189. package/dist/editor/standalone-overlay-styles.d.ts +0 -0
  190. package/dist/editor/standalone-overlay-styles.js +1 -0
  191. package/dist/editor/standalone-overlay.d.ts +1 -0
  192. package/dist/editor/standalone-overlay.js +76 -0
  193. package/dist/editor/syntax-highlighter.d.ts +4 -0
  194. package/dist/editor/syntax-highlighter.js +81 -0
  195. package/dist/editor/text-toolbar.d.ts +11 -0
  196. package/dist/editor/text-toolbar.js +327 -0
  197. package/dist/editor/toolbar-styles.d.ts +4 -0
  198. package/dist/editor/toolbar-styles.js +198 -0
  199. package/dist/email/index.d.ts +32 -0
  200. package/dist/email/index.js +154 -0
  201. package/dist/email/providers/resend.d.ts +2 -0
  202. package/dist/email/providers/resend.js +24 -0
  203. package/dist/email/providers/sendgrid.d.ts +2 -0
  204. package/dist/email/providers/sendgrid.js +31 -0
  205. package/dist/email/providers/smtp.d.ts +13 -0
  206. package/dist/email/providers/smtp.js +125 -0
  207. package/dist/email/template-engine.d.ts +18 -0
  208. package/dist/email/template-engine.js +116 -0
  209. package/dist/email/templates/base.d.ts +9 -0
  210. package/dist/email/templates/base.js +65 -0
  211. package/dist/email/templates/password-reset.d.ts +5 -0
  212. package/dist/email/templates/password-reset.js +15 -0
  213. package/dist/email/templates/verify-email.d.ts +5 -0
  214. package/dist/email/templates/verify-email.js +15 -0
  215. package/dist/email/templates/welcome.d.ts +5 -0
  216. package/dist/email/templates/welcome.js +13 -0
  217. package/dist/email/types.d.ts +49 -0
  218. package/dist/email/types.js +1 -0
  219. package/dist/llms/generate.d.ts +46 -0
  220. package/dist/llms/generate.js +185 -0
  221. package/dist/permissions/guard.d.ts +28 -0
  222. package/dist/permissions/guard.js +30 -0
  223. package/dist/permissions/index.d.ts +6 -0
  224. package/dist/permissions/index.js +3 -0
  225. package/dist/permissions/service.d.ts +80 -0
  226. package/dist/permissions/service.js +210 -0
  227. package/dist/permissions/tables.d.ts +5 -0
  228. package/dist/permissions/tables.js +68 -0
  229. package/dist/permissions/types.d.ts +33 -0
  230. package/dist/permissions/types.js +1 -0
  231. package/dist/runtime/app-shell.js +163 -0
  232. package/dist/runtime/auth.d.ts +10 -0
  233. package/dist/runtime/auth.js +30 -0
  234. package/dist/runtime/communication.d.ts +137 -0
  235. package/dist/runtime/communication.js +228 -0
  236. package/dist/runtime/error-boundary.d.ts +23 -0
  237. package/dist/runtime/error-boundary.js +120 -0
  238. package/dist/runtime/i18n.d.ts +6 -1
  239. package/dist/runtime/i18n.js +42 -21
  240. package/dist/runtime/router-data.d.ts +3 -0
  241. package/dist/runtime/router-data.js +102 -17
  242. package/dist/runtime/router-hydration.js +25 -0
  243. package/dist/runtime/router.d.ts +16 -1
  244. package/dist/runtime/router.js +188 -42
  245. package/dist/runtime/socket-client.d.ts +2 -0
  246. package/dist/runtime/socket-client.js +30 -0
  247. package/dist/runtime/webrtc.d.ts +47 -0
  248. package/dist/runtime/webrtc.js +178 -0
  249. package/dist/shared/graceful-shutdown.d.ts +8 -0
  250. package/dist/shared/graceful-shutdown.js +36 -0
  251. package/dist/shared/health.d.ts +8 -0
  252. package/dist/shared/health.js +25 -0
  253. package/dist/shared/llms-txt.d.ts +31 -0
  254. package/dist/shared/llms-txt.js +85 -0
  255. package/dist/shared/logger.d.ts +32 -0
  256. package/dist/shared/logger.js +93 -0
  257. package/dist/shared/meta.d.ts +27 -0
  258. package/dist/shared/meta.js +71 -0
  259. package/dist/shared/middleware-runner.d.ts +9 -0
  260. package/dist/shared/middleware-runner.js +29 -0
  261. package/dist/shared/rate-limit.d.ts +18 -0
  262. package/dist/shared/rate-limit.js +71 -0
  263. package/dist/shared/request-id.d.ts +5 -0
  264. package/dist/shared/request-id.js +18 -0
  265. package/dist/shared/route-matching.js +16 -1
  266. package/dist/shared/security-headers.d.ts +18 -0
  267. package/dist/shared/security-headers.js +38 -0
  268. package/dist/shared/socket-io-setup.d.ts +11 -0
  269. package/dist/shared/socket-io-setup.js +51 -0
  270. package/dist/shared/types.d.ts +14 -0
  271. package/dist/shared/utils.d.ts +33 -7
  272. package/dist/shared/utils.js +164 -27
  273. package/dist/storage/adapters/local.d.ts +44 -0
  274. package/dist/storage/adapters/local.js +85 -0
  275. package/dist/storage/adapters/s3.d.ts +32 -0
  276. package/dist/storage/adapters/s3.js +116 -0
  277. package/dist/storage/adapters/types.d.ts +53 -0
  278. package/dist/storage/adapters/types.js +1 -0
  279. package/dist/storage/index.d.ts +76 -0
  280. package/dist/storage/index.js +83 -0
  281. package/package.json +19 -7
  282. package/templates/blog/api/posts.ts +4 -18
  283. package/templates/blog/data/migrations/001_init.sql +6 -5
  284. package/templates/blog/lumenjs.config.ts +3 -0
  285. package/templates/blog/package.json +14 -0
  286. package/templates/blog/pages/_layout.ts +25 -0
  287. package/templates/blog/pages/index.ts +48 -22
  288. package/templates/blog/pages/posts/[slug].ts +45 -20
  289. package/templates/blog/pages/tag/[tag].ts +44 -0
  290. package/templates/dashboard/api/stats.ts +8 -5
  291. package/templates/dashboard/lumenjs.config.ts +3 -0
  292. package/templates/dashboard/package.json +14 -0
  293. package/templates/dashboard/pages/_layout.ts +25 -0
  294. package/templates/dashboard/pages/index.ts +54 -23
  295. package/templates/dashboard/pages/settings/index.ts +29 -0
  296. package/templates/default/lumenjs.config.ts +3 -0
  297. package/templates/default/package.json +14 -0
  298. package/templates/default/pages/index.ts +24 -0
  299. package/templates/social/api/posts/[id].ts +14 -0
  300. package/templates/social/api/posts.ts +11 -0
  301. package/templates/social/api/profile/[username].ts +10 -0
  302. package/templates/social/api/upload.ts +19 -0
  303. package/templates/social/data/migrations/001_init.sql +78 -0
  304. package/templates/social/data/migrations/002_add_image_url.sql +1 -0
  305. package/templates/social/data/migrations/003_auth.sql +7 -0
  306. package/templates/social/docs/architecture.md +76 -0
  307. package/templates/social/docs/components.md +100 -0
  308. package/templates/social/docs/data.md +89 -0
  309. package/templates/social/docs/pages.md +96 -0
  310. package/templates/social/docs/theming.md +52 -0
  311. package/templates/social/lib/media.ts +130 -0
  312. package/templates/social/lumenjs.auth.ts +21 -0
  313. package/templates/social/lumenjs.config.ts +3 -0
  314. package/templates/social/package.json +5 -0
  315. package/templates/social/pages/_layout.ts +239 -0
  316. package/templates/social/pages/apps/[id].ts +173 -0
  317. package/templates/social/pages/apps/index.ts +116 -0
  318. package/templates/social/pages/auth/login.ts +92 -0
  319. package/templates/social/pages/bookmarks.ts +57 -0
  320. package/templates/social/pages/explore.ts +73 -0
  321. package/templates/social/pages/index.ts +351 -0
  322. package/templates/social/pages/messages.ts +298 -0
  323. package/templates/social/pages/new.ts +77 -0
  324. package/templates/social/pages/notifications.ts +73 -0
  325. package/templates/social/pages/post/[id].ts +124 -0
  326. package/templates/social/pages/profile/[username].ts +100 -0
  327. package/templates/social/pages/settings/accessibility.ts +153 -0
  328. package/templates/social/pages/settings/account.ts +260 -0
  329. package/templates/social/pages/settings/help.ts +141 -0
  330. package/templates/social/pages/settings/language.ts +103 -0
  331. package/templates/social/pages/settings/privacy.ts +183 -0
  332. package/templates/social/pages/settings/security.ts +133 -0
  333. package/templates/social/pages/settings.ts +185 -0
@@ -1,41 +1,72 @@
1
1
  import { LitElement, html, css } from 'lit';
2
- import { customElement, property } from 'lit/decorators.js';
3
- import { useDb } from '@nuraly/lumenjs/db';
4
2
 
5
- export function loader() {
6
- const db = useDb();
7
- const stats = db.all('SELECT id, label, value, unit, updated_at FROM stats ORDER BY id');
8
- return { stats };
3
+ export async function loader() {
4
+ return {
5
+ stats: [
6
+ { label: 'Users', value: '1,234' },
7
+ { label: 'Revenue', value: '$12,345' },
8
+ { label: 'Orders', value: '567' },
9
+ { label: 'Conversion', value: '3.2%' },
10
+ ],
11
+ };
9
12
  }
10
13
 
11
- @customElement('page-dashboard')
12
- export class PageDashboard extends LitElement {
13
- @property({ type: Object }) data: any;
14
+ let tick = 0;
15
+
16
+ export function subscribe({ push }: { push: (data: any) => void }) {
17
+ const interval = setInterval(() => {
18
+ tick++;
19
+ push({
20
+ stats: [
21
+ { label: 'Users', value: (1234 + tick * 3).toLocaleString() },
22
+ { label: 'Revenue', value: '$' + (12345 + tick * 47).toLocaleString() },
23
+ { label: 'Orders', value: (567 + tick).toLocaleString() },
24
+ { label: 'Conversion', value: (3.2 + Math.sin(tick / 5) * 0.5).toFixed(1) + '%' },
25
+ ],
26
+ updatedAt: new Date().toISOString(),
27
+ });
28
+ }, 2000);
29
+ return () => clearInterval(interval);
30
+ }
31
+
32
+ export class PageIndex extends LitElement {
33
+ static properties = {
34
+ loaderData: { type: Object },
35
+ liveData: { type: Object },
36
+ };
37
+ loaderData: any = {};
38
+ liveData: any = null;
14
39
 
15
40
  static styles = css`
16
- :host { display: block; max-width: 960px; margin: 0 auto; padding: 2rem; font-family: system-ui, sans-serif; }
17
- h1 { font-size: 2rem; margin-bottom: 1.5rem; }
41
+ :host { display: block; }
42
+ h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
18
43
  .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
19
- .card { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 1.5rem; }
20
- .card .label { font-size: 0.875rem; color: #6b7280; margin-bottom: 0.25rem; }
21
- .card .value { font-size: 1.75rem; font-weight: 600; color: #111827; }
22
- .card .unit { font-size: 0.75rem; color: #9ca3af; margin-left: 0.25rem; }
44
+ .card { background: #fff; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.08); transition: box-shadow 0.2s; }
45
+ .card.live { box-shadow: 0 0 0 2px rgba(124,58,237,0.3), 0 1px 3px rgba(0,0,0,0.08); }
46
+ .card-label { font-size: 0.875rem; color: #64748b; }
47
+ .card-value { font-size: 1.75rem; font-weight: 700; margin-top: 0.25rem; }
48
+ .status { font-size: 0.75rem; color: #94a3b8; margin-top: 1.5rem; }
49
+ .status .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #22c55e; margin-right: 0.375rem; vertical-align: middle; }
23
50
  `;
24
51
 
25
52
  render() {
26
- const stats = this.data?.stats || [];
53
+ const stats = this.liveData?.stats || this.loaderData.stats || [];
54
+ const isLive = !!this.liveData;
27
55
  return html`
28
- <h1>Dashboard</h1>
56
+ <h1>Overview</h1>
29
57
  <div class="grid">
30
- ${stats.map((stat: any) => html`
31
- <div class="card">
32
- <div class="label">${stat.label}</div>
33
- <div class="value">
34
- ${stat.value}<span class="unit">${stat.unit}</span>
35
- </div>
58
+ ${stats.map((s: any) => html`
59
+ <div class="card ${isLive ? 'live' : ''}">
60
+ <div class="card-label">${s.label}</div>
61
+ <div class="card-value">${s.value}</div>
36
62
  </div>
37
63
  `)}
38
64
  </div>
65
+ ${isLive ? html`
66
+ <div class="status">
67
+ <span class="dot"></span>Live — updated ${this.liveData.updatedAt ? new Date(this.liveData.updatedAt).toLocaleTimeString() : ''}
68
+ </div>
69
+ ` : ''}
39
70
  `;
40
71
  }
41
72
  }
@@ -0,0 +1,29 @@
1
+ import { LitElement, html, css } from 'lit';
2
+
3
+ export class PageSettings extends LitElement {
4
+ static properties = { name: { type: String } };
5
+ name = '';
6
+
7
+ static styles = css`
8
+ :host { display: block; }
9
+ h1 { font-size: 1.5rem; margin-bottom: 1.5rem; }
10
+ .form-group { margin-bottom: 1rem; }
11
+ label { display: block; font-size: 0.875rem; color: #64748b; margin-bottom: 0.375rem; }
12
+ input { width: 100%; max-width: 400px; padding: 0.5rem 0.75rem; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 0.875rem; }
13
+ input:focus { outline: none; border-color: #7c3aed; box-shadow: 0 0 0 2px rgba(124,58,237,0.15); }
14
+ button { background: #7c3aed; color: #fff; border: none; padding: 0.5rem 1.25rem; border-radius: 6px; cursor: pointer; font-size: 0.875rem; }
15
+ button:hover { background: #6d28d9; }
16
+ `;
17
+
18
+ render() {
19
+ return html`
20
+ <h1>Settings</h1>
21
+ <div class="form-group">
22
+ <label>Display Name</label>
23
+ <input type="text" placeholder="Enter your name" .value=${this.name}
24
+ @input=${(e: Event) => this.name = (e.target as HTMLInputElement).value} />
25
+ </div>
26
+ <button @click=${() => alert(`Saved: ${this.name}`)}>Save</button>
27
+ `;
28
+ }
29
+ }
@@ -0,0 +1,3 @@
1
+ export default {
2
+ title: '{{PROJECT_NAME}}',
3
+ };
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "{{PROJECT_NAME}}",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "lumenjs dev",
7
+ "build": "lumenjs build",
8
+ "serve": "lumenjs serve"
9
+ },
10
+ "dependencies": {
11
+ "@nuraly/lumenjs": "^0.1.3",
12
+ "lit": "^3.1.0"
13
+ }
14
+ }
@@ -0,0 +1,24 @@
1
+ import { LitElement, html, css } from 'lit';
2
+
3
+ export async function loader() {
4
+ return { title: 'Welcome to LumenJS' };
5
+ }
6
+
7
+ export class PageIndex extends LitElement {
8
+ static properties = { loaderData: { type: Object } };
9
+ loaderData: any = {};
10
+
11
+ static styles = css`
12
+ :host { display: block; max-width: 640px; margin: 0 auto; padding: 2rem; font-family: system-ui; }
13
+ h1 { color: #7c3aed; margin-bottom: 0.5rem; }
14
+ p { color: #64748b; line-height: 1.6; }
15
+ a { color: #7c3aed; }
16
+ `;
17
+
18
+ render() {
19
+ return html`
20
+ <h1>${this.loaderData.title}</h1>
21
+ <p>Edit <code>pages/index.ts</code> to get started.</p>
22
+ `;
23
+ }
24
+ }
@@ -0,0 +1,14 @@
1
+ export function GET({ params }: { params: { id: string } }) {
2
+ return Response.json({
3
+ id: params.id,
4
+ username: 'sarah_dev',
5
+ display_name: 'Sarah Chen',
6
+ content: 'Sample post content',
7
+ likes: 42,
8
+ replies: [],
9
+ });
10
+ }
11
+
12
+ export function DELETE({ params }: { params: { id: string } }) {
13
+ return Response.json({ ok: true, deleted: params.id });
14
+ }
@@ -0,0 +1,11 @@
1
+ export function GET() {
2
+ return Response.json([
3
+ { id: 1, username: 'sarah_dev', display_name: 'Sarah Chen', content: 'Just shipped a new feature using LumenJS!', likes: 42, replies: 5, shares: 12 },
4
+ { id: 2, username: 'alex_design', display_name: 'Alex Rivera', content: 'Working on a new design system.', likes: 38, replies: 3, shares: 8 },
5
+ { id: 3, username: 'emma_data', display_name: 'Emma Williams', content: 'Trained a new model on customer feedback data.', likes: 67, replies: 8, shares: 21 },
6
+ ]);
7
+ }
8
+
9
+ export function POST() {
10
+ return Response.json({ ok: true, message: 'Post created (mock)' });
11
+ }
@@ -0,0 +1,10 @@
1
+ export function GET({ params }: { params: { username: string } }) {
2
+ return Response.json({
3
+ username: params.username,
4
+ display_name: params.username,
5
+ bio: 'User profile (mock)',
6
+ followers: 0,
7
+ following: 0,
8
+ posts: [],
9
+ });
10
+ }
@@ -0,0 +1,19 @@
1
+ import crypto from 'crypto';
2
+ import { compress } from '../lib/media.js';
3
+
4
+ export async function POST(req: any) {
5
+ const file = req.files?.[0];
6
+ if (!file) throw { status: 400, message: 'No file provided' };
7
+ if (!req.storage) throw { status: 503, message: 'Storage not configured' };
8
+
9
+ const { data, mimeType, ext } = await compress(file.data, file.contentType);
10
+ const key = `uploads/${crypto.randomUUID()}${ext}`;
11
+
12
+ const stored = await req.storage.put(data, {
13
+ key,
14
+ mimeType,
15
+ fileName: file.fileName,
16
+ });
17
+
18
+ return { url: stored.url, key: stored.key };
19
+ }
@@ -0,0 +1,78 @@
1
+ CREATE TABLE IF NOT EXISTS users (
2
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
3
+ username TEXT NOT NULL UNIQUE,
4
+ display_name TEXT NOT NULL,
5
+ avatar_url TEXT NOT NULL DEFAULT '',
6
+ bio TEXT NOT NULL DEFAULT '',
7
+ cover_url TEXT NOT NULL DEFAULT '',
8
+ followers_count INTEGER NOT NULL DEFAULT 0,
9
+ following_count INTEGER NOT NULL DEFAULT 0,
10
+ created_at TEXT NOT NULL DEFAULT (date('now'))
11
+ );
12
+
13
+ CREATE TABLE IF NOT EXISTS posts (
14
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
15
+ user_id INTEGER NOT NULL REFERENCES users(id),
16
+ content TEXT NOT NULL,
17
+ parent_id INTEGER REFERENCES posts(id),
18
+ likes_count INTEGER NOT NULL DEFAULT 0,
19
+ replies_count INTEGER NOT NULL DEFAULT 0,
20
+ shares_count INTEGER NOT NULL DEFAULT 0,
21
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
22
+ );
23
+
24
+ CREATE TABLE IF NOT EXISTS notifications (
25
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
26
+ user_id INTEGER NOT NULL REFERENCES users(id),
27
+ type TEXT NOT NULL,
28
+ actor_id INTEGER NOT NULL REFERENCES users(id),
29
+ post_id INTEGER REFERENCES posts(id),
30
+ read INTEGER NOT NULL DEFAULT 0,
31
+ created_at TEXT NOT NULL DEFAULT (datetime('now'))
32
+ );
33
+
34
+ CREATE TABLE IF NOT EXISTS trending (
35
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
36
+ hashtag TEXT NOT NULL UNIQUE,
37
+ post_count INTEGER NOT NULL DEFAULT 0
38
+ );
39
+
40
+ -- Seed users
41
+ INSERT INTO users (username, display_name, avatar_url, bio, followers_count, following_count, created_at) VALUES
42
+ ('sarah_dev', 'Sarah Chen', '🧑‍💻', 'Full-stack developer. Open source enthusiast. Building the future one commit at a time.', 1240, 385, '2024-06-15'),
43
+ ('alex_design', 'Alex Rivera', '🎨', 'UI/UX designer at heart. Pixels matter. Currently exploring design systems.', 890, 210, '2024-08-20'),
44
+ ('mike_ops', 'Mike Johnson', '🛠️', 'DevOps engineer. Infrastructure as code. Coffee as fuel.', 560, 420, '2024-09-10'),
45
+ ('emma_data', 'Emma Williams', '📊', 'Data scientist. ML enthusiast. Turning data into insights.', 2100, 150, '2024-03-05');
46
+
47
+ -- Seed posts
48
+ INSERT INTO posts (user_id, content, likes_count, replies_count, shares_count, created_at) VALUES
49
+ (1, 'Just shipped a new feature using LumenJS! The file-based routing makes everything so clean. No more route config files! 🚀', 42, 5, 12, '2025-03-21 14:30:00'),
50
+ (2, 'Working on a new design system. The key insight: consistency beats creativity when building at scale. Every component should feel like it belongs.', 38, 3, 8, '2025-03-21 12:15:00'),
51
+ (4, 'Trained a new model on customer feedback data. Accuracy went from 78% to 94% just by cleaning the input data. Garbage in, garbage out is real. 📈', 67, 8, 21, '2025-03-21 10:00:00'),
52
+ (3, 'Migrated our entire CI/CD pipeline to GitHub Actions. 40% faster builds and way easier to maintain. Should have done this months ago.', 29, 4, 6, '2025-03-20 18:45:00'),
53
+ (1, 'Hot take: TypeScript''s type system is a programming language in itself. And I love it. 💙', 85, 12, 15, '2025-03-20 16:20:00'),
54
+ (2, 'New blog post: "Why your loading states are making users anxious" — skeleton screens vs spinners vs progress bars. Link in bio!', 51, 7, 19, '2025-03-20 11:30:00'),
55
+ (4, 'PSA: If you''re using pandas, try polars. It''s not just faster — the API is actually more intuitive once you get used to it.', 93, 15, 34, '2025-03-19 20:00:00'),
56
+ (3, 'Docker tip: multi-stage builds reduced our image size from 1.2GB to 180MB. Always worth the extra 5 minutes of setup.', 44, 6, 11, '2025-03-19 15:30:00'),
57
+ (1, 'Weekend project: built a CLI tool that generates commit messages from diffs using Claude. It''s surprisingly good at understanding context.', 112, 18, 28, '2025-03-18 09:15:00'),
58
+ (2, 'The best design feedback I ever got: "Can my grandma use this?" Simple but powerful heuristic. 👵', 76, 9, 22, '2025-03-17 14:00:00');
59
+
60
+ -- Seed replies (parent_id references)
61
+ INSERT INTO posts (user_id, content, parent_id, likes_count, created_at) VALUES
62
+ (2, 'Love the file-based routing approach! How does it handle dynamic params?', 1, 8, '2025-03-21 14:45:00'),
63
+ (3, 'Totally agree on TypeScript. The conditional types are mind-bending though 😅', 5, 12, '2025-03-20 16:35:00'),
64
+ (4, 'Multi-stage builds are a game changer. We use them everywhere now.', 8, 5, '2025-03-19 15:45:00');
65
+
66
+ -- Seed notifications (for user 1 - sarah_dev)
67
+ INSERT INTO notifications (user_id, type, actor_id, post_id, created_at) VALUES
68
+ (1, 'like', 2, 1, '2025-03-21 14:35:00'),
69
+ (1, 'reply', 2, 1, '2025-03-21 14:45:00'),
70
+ (1, 'follow', 3, NULL, '2025-03-21 13:00:00'),
71
+ (1, 'like', 4, 5, '2025-03-20 16:25:00'),
72
+ (1, 'reply', 3, 5, '2025-03-20 16:35:00');
73
+
74
+ -- Seed trending
75
+ INSERT INTO trending (hashtag, post_count) VALUES
76
+ ('#WebComponents', 1250),
77
+ ('#TypeScript', 3400),
78
+ ('#DevOps', 890);
@@ -0,0 +1 @@
1
+ ALTER TABLE posts ADD COLUMN image_url TEXT NOT NULL DEFAULT '';
@@ -0,0 +1,7 @@
1
+ -- Add OAuth identity columns to users table
2
+ ALTER TABLE users ADD COLUMN oauth_provider TEXT;
3
+ ALTER TABLE users ADD COLUMN oauth_sub TEXT;
4
+ ALTER TABLE users ADD COLUMN email TEXT;
5
+
6
+ -- Prevent duplicate OAuth accounts
7
+ CREATE UNIQUE INDEX IF NOT EXISTS idx_users_oauth_sub ON users(oauth_provider, oauth_sub);
@@ -0,0 +1,76 @@
1
+ # Social Template — Architecture
2
+
3
+ A social networking super app template for LumenJS, inspired by Twitter, LinkedIn, and dev.to.
4
+
5
+ **Demo**: https://social.lumenjs.dev
6
+
7
+ ## Tech Stack
8
+
9
+ - **LumenJS** — file-based routing, SSR with Lit SSR, server loaders, API routes
10
+ - **Lit** — web components with Shadow DOM, reactive properties, CSS-in-JS
11
+ - **SQLite** — mock data via migrations (seeded on first run)
12
+ - **No frameworks** — pure Lit + native HTML elements, no Tailwind, no NuralyUI
13
+
14
+ ## Directory Structure
15
+
16
+ ```
17
+ templates/social/
18
+ ├── lumenjs.config.ts # App config (title only)
19
+ ├── package.json # Template metadata
20
+ ├── data/
21
+ │ └── migrations/
22
+ │ └── 001_init.sql # DB schema + seed data
23
+ ├── api/
24
+ │ ├── posts.ts # GET /api/posts, POST /api/posts
25
+ │ ├── posts/[id].ts # GET /api/posts/:id, DELETE
26
+ │ └── profile/[username].ts # GET /api/profile/:username
27
+ ├── pages/
28
+ │ ├── _layout.ts # App shell (sidebar, right panel, mobile nav, theming)
29
+ │ ├── index.ts # Feed with stories bar + widget cards
30
+ │ ├── explore.ts # Tags, suggested users, top posts
31
+ │ ├── notifications.ts # Notification list with type icons
32
+ │ ├── messages.ts # Conversations + chat detail
33
+ │ ├── bookmarks.ts # Saved posts list
34
+ │ ├── settings.ts # Settings with dark mode toggle
35
+ │ ├── new.ts # New post composer
36
+ │ ├── post/
37
+ │ │ └── [id].ts # Post detail with comments
38
+ │ ├── profile/
39
+ │ │ └── [username].ts # User profile with posts
40
+ │ └── apps/
41
+ │ ├── index.ts # App marketplace
42
+ │ └── [id].ts # Individual app view
43
+ └── docs/ # This documentation
44
+ ```
45
+
46
+ ## Pages & Routes
47
+
48
+ | Route | File | Description |
49
+ |-------|------|-------------|
50
+ | `/` | `pages/index.ts` | Feed with stories, posts, widget cards |
51
+ | `/explore` | `pages/explore.ts` | Tags, users, popular posts |
52
+ | `/notifications` | `pages/notifications.ts` | Activity notifications |
53
+ | `/messages` | `pages/messages.ts` | Chat conversations |
54
+ | `/bookmarks` | `pages/bookmarks.ts` | Saved posts |
55
+ | `/settings` | `pages/settings.ts` | Account & theme settings |
56
+ | `/new` | `pages/new.ts` | Create new post |
57
+ | `/post/:id` | `pages/post/[id].ts` | Single post with comments |
58
+ | `/profile/:username` | `pages/profile/[username].ts` | User profile |
59
+ | `/apps` | `pages/apps/index.ts` | App marketplace |
60
+ | `/apps/:id` | `pages/apps/[id].ts` | Individual app |
61
+
62
+ ## Layout Architecture
63
+
64
+ `_layout.ts` is the root layout wrapping all pages via `<slot>`.
65
+
66
+ **Desktop** (>860px): icon sidebar (68px) + main content (600px max) + right sidebar (350px)
67
+ **Tablet** (640-860px): sidebar + main content (right sidebar hidden)
68
+ **Mobile** (<640px): mobile top bar + full-width content + bottom nav bar + more menu sheet
69
+
70
+ ## Theming
71
+
72
+ Dark mode via CSS custom properties set on `document.documentElement`. Toggle in settings persists to `localStorage('theme')`. See `docs/theming.md`.
73
+
74
+ ## Data
75
+
76
+ All data is mock — hardcoded in loaders and API handlers. SQLite migration seeds initial data. See `docs/data.md`.
@@ -0,0 +1,100 @@
1
+ # Shared Patterns & Components
2
+
3
+ ## SVG Icon Library
4
+
5
+ All icons are inline SVG in Lit `html` tagged templates. Style: feather icons (stroke, no fill, 1.5 stroke-width, 22x22 default).
6
+
7
+ ### Layout icons (`_layout.ts`)
8
+ - `home` — house with chimney
9
+ - `explore` — magnifying glass (search)
10
+ - `bell` — notification bell
11
+ - `message` — envelope
12
+ - `user` — person silhouette
13
+ - `search` — small magnifying glass (16x16)
14
+ - `post` — pen/edit
15
+ - `bookmark` — bookmark flag
16
+ - `plus` — plus sign (24x24, 2 stroke-width)
17
+ - `settings` — gear/cog
18
+
19
+ ### Feed icons (`index.ts`)
20
+ - `comment` — chat bubble (17x17)
21
+ - `repost` — circular arrows (17x17)
22
+ - `heart` — heart outline (17x17)
23
+ - `share` — upload/share arrow (17x17)
24
+
25
+ ### Post detail icons (`post/[id].ts`)
26
+ - `heart`, `comment`, `bookmark` — 18x18 variants
27
+
28
+ ### Profile icon (`profile/[username].ts`)
29
+ - `location` — map pin (14x14)
30
+ - `briefcase` — work bag (14x14)
31
+ - `calendar` — calendar grid (14x14)
32
+ - Follow button: user-plus (18x18, 2 stroke-width)
33
+
34
+ ### Messages icons (`messages.ts`)
35
+ - `send`, `image`, `smile`, `check`, `checkDouble`, `phone`, `video`, `info`, `attach`, `mic`, `search`
36
+
37
+ ### Notifications icons (`notifications.ts`)
38
+ - `heart` — filled red (#e53935)
39
+ - `comment` — filled blue (#3b49df)
40
+ - `userPlus` — stroke green (#22c55e)
41
+
42
+ ### New post icons (`new.ts`)
43
+ - `image`, `video`, `smile`, `mapPin`, `globe`, `close`
44
+
45
+ ### Settings icons (`settings.ts`)
46
+ - `user`, `lock`, `bell`, `eye`, `palette`, `globe`, `shield`, `help`, `logout`, `chevron`
47
+
48
+ ## Post Card Pattern
49
+
50
+ Used in feed, profile, and bookmarks:
51
+ ```
52
+ <a class="post" href="/post/${id}">
53
+ <div class="post-avatar" style="background:${color}">
54
+ ${avatar ? <img> : initials}
55
+ </div>
56
+ <div class="post-body">
57
+ <div class="post-header">name + @handle + · + time</div>
58
+ <div class="post-content">text (3-line clamp)</div>
59
+ <div class="post-media">image or video (16:9)</div>
60
+ <div class="post-actions">comment + repost + heart + share</div>
61
+ </div>
62
+ </a>
63
+ ```
64
+
65
+ ## Widget Card Pattern
66
+
67
+ Used for poll, event, job in feed:
68
+ ```
69
+ <div class="widget-card">
70
+ <div class="widget-header">
71
+ avatar + name + time + badge (Poll/Event/Job)
72
+ </div>
73
+ <div class="...">custom widget body</div>
74
+ </div>
75
+ ```
76
+
77
+ ## Story Thumbnail
78
+
79
+ ```
80
+ <div class="story">
81
+ <div class="story-ring">
82
+ <div class="story-avatar-wrap">
83
+ <div class="story-avatar"><img></div>
84
+ (optional: story-plus for "You")
85
+ </div>
86
+ </div>
87
+ <span class="story-name">Name</span>
88
+ </div>
89
+ ```
90
+ 56x80px rounded rectangles with border. Click opens full-screen viewer.
91
+
92
+ ## Mobile Patterns
93
+
94
+ **Bottom bar**: 5 items — Home, Explore, + (purple FAB), Messages, More (three dots)
95
+
96
+ **More menu**: overlay + bottom sheet with drag handle + menu items (Profile, Bookmarks, Apps, Notifications, Settings)
97
+
98
+ **Mobile top bar**: avatar + "Home" text (link to /) + spacer + settings gear + bell + message icons
99
+
100
+ **Message mobile**: click conversation → `_showChat` state toggles `.chat-open` class → hides list, shows full-screen chat with back arrow
@@ -0,0 +1,89 @@
1
+ # Mock Data & API Routes
2
+
3
+ ## Mock Users
4
+
5
+ | Username | Display Name | Initials | Color | Avatar |
6
+ |----------|-------------|----------|-------|--------|
7
+ | `aymen` | Aymen Labidi | AL | `#7c3aed` | GitHub avatar (u/3775924) |
8
+ | `alex_design` | Alex Rivera | AR | `#e44d26` | Initials |
9
+ | `emma_data` | Emma Williams | EW | `#3572a5` | Initials |
10
+ | `mike_ops` | Mike Johnson | MJ | `#22c55e` | Initials |
11
+ | `lisa_pm` | Lisa Park | LP | `#a855f7` | Initials |
12
+ | `tom_arch` | Tom Brooks | TB | `#ef4444` | Initials |
13
+ | `nina_sec` | Nina Patel | NP | `#f59e0b` | Initials |
14
+
15
+ "aymen" is the current user (shown in compose avatars, sidebar, settings).
16
+
17
+ ## Mock Posts (Feed)
18
+
19
+ 6 posts in `index.ts` loader with IDs 1-6. Posts 1, 3 have images, post 4 has video, post 6 has image. Content is long (multi-line, triggers "See more" on post 1).
20
+
21
+ ## Stories
22
+
23
+ 7 stories in `index.ts` loader. Each has an Unsplash image (400x700 crop) and caption. Displayed as rectangular thumbnails.
24
+
25
+ ## Feed Widgets
26
+
27
+ 3 widgets inserted between posts by `position`:
28
+ - **Poll** (pos 2): "What framework do you use most in 2025?" — React 45%, LumenJS 35%, Vue 15%, Other 5% (142 votes)
29
+ - **Event** (pos 4): "DevOps Meetup 2025" — Apr 5, 2025, Online/Zoom, 48 attending
30
+ - **Job** (pos 6): DataFlow, Senior ML Engineer, Remote, $150k-$200k
31
+
32
+ ## Post Detail Data
33
+
34
+ `post/[id].ts` has 6 posts (IDs 1-6) with full content, tags, dates, read times. Posts 1 and 5 have comment threads.
35
+
36
+ ## Messages Data
37
+
38
+ 5 conversations in `messages.ts` with full chat histories:
39
+ 1. Alex Rivera — LumenJS discussion (9 messages, 2 unread)
40
+ 2. Emma Williams — polars benchmarks (6 messages)
41
+ 3. Mike Johnson — CI pipeline (5 messages)
42
+ 4. Lisa Park — roadmap sync (3 messages, 1 unread)
43
+ 5. Tom Brooks — architecture diagram (2 messages)
44
+
45
+ ## Notifications
46
+
47
+ 5 notifications for user "aymen": 2 likes, 2 comments, 1 follow.
48
+
49
+ ## Apps Marketplace
50
+
51
+ 12 apps with categories:
52
+ - Productivity: Calendar, Notes, Timer, Task Board
53
+ - Social: Poll Creator
54
+ - Entertainment: Weather, News Feed
55
+ - Finance: Stock Tracker, Budget Tracker
56
+ - Developer Tools: Translator, Code Snippets
57
+ - Health: Step Counter
58
+
59
+ 3 apps have real UI: poll (form), calendar (grid), notes (list).
60
+
61
+ ## Database Schema (`001_init.sql`)
62
+
63
+ ```sql
64
+ users (id, username, display_name, avatar_url, bio, cover_url, followers_count, following_count, created_at)
65
+ posts (id, user_id, content, parent_id, likes_count, replies_count, shares_count, created_at)
66
+ notifications (id, user_id, type, actor_id, post_id, read, created_at)
67
+ trending (id, hashtag, post_count)
68
+ ```
69
+
70
+ Seeded with 4 users, 10 posts + 3 replies, 5 notifications, 3 trending tags.
71
+
72
+ ## API Routes
73
+
74
+ | Method | Route | Response |
75
+ |--------|-------|----------|
76
+ | GET | `/api/posts` | Array of posts (id, username, display_name, content, likes, replies, shares) |
77
+ | POST | `/api/posts` | `{ ok: true, message: "Post created (mock)" }` |
78
+ | GET | `/api/posts/:id` | Single post with replies array |
79
+ | DELETE | `/api/posts/:id` | `{ ok: true, deleted: id }` |
80
+ | GET | `/api/profile/:username` | User profile with posts array |
81
+
82
+ All API routes return hardcoded mock data — not connected to SQLite. The migration exists for future use when persistence is implemented.
83
+
84
+ ## Adding New Mock Data
85
+
86
+ 1. Add to the `loader()` function in the relevant page file
87
+ 2. For new users: add to the `USERS` object in profile and post detail pages
88
+ 3. For new posts: add to both `index.ts` (feed) and `post/[id].ts` (detail) loaders
89
+ 4. For new apps: add to `apps/index.ts` loader + `APPS` object in `apps/[id].ts`