@seip/bluebird-js 0.1.7 → 0.2.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 (151) hide show
  1. package/AGENTS.md +727 -620
  2. package/README.md +670 -607
  3. package/app/models/user.js +19 -0
  4. package/app/resources/html/home.html +137 -0
  5. package/app/resources/html/layouts/main.html +55 -0
  6. package/app/resources/html/notFound.html +14 -0
  7. package/app/resources/html/table.html +15 -0
  8. package/app/resources/html/terms.html +46 -0
  9. package/app/resources/index.html +27 -0
  10. package/app/resources/layouts/AppLayout.jsx +92 -0
  11. package/app/resources/main.jsx +18 -0
  12. package/app/resources/pages/Dashboard.jsx +93 -0
  13. package/app/resources/pages/Home.jsx +140 -0
  14. package/app/resources/pages/Login.jsx +35 -0
  15. package/app/resources/pages/NotFound.jsx +16 -0
  16. package/app/resources/pages/Register.jsx +55 -0
  17. package/app/resources/pages/TableDemo.jsx +85 -0
  18. package/app/resources/routes.jsx +59 -0
  19. package/app/resources/spa.js +73 -0
  20. package/app/resources/styles.css +9 -0
  21. package/app/routes/api.js +129 -50
  22. package/app/routes/auth.js +209 -0
  23. package/app/routes/web.js +89 -47
  24. package/core/ai.js +30 -10
  25. package/core/app.d.ts +2 -18
  26. package/core/app.js +987 -801
  27. package/core/auth.d.ts +2 -13
  28. package/core/auth.js +444 -326
  29. package/core/cli/build.js +37 -0
  30. package/core/cli/dev.js +155 -0
  31. package/core/cli/doctor.js +37 -2
  32. package/core/cli/export.js +191 -0
  33. package/core/cli/init.js +91 -322
  34. package/core/cli/nginx.js +1 -1
  35. package/core/cli/templates.js +139 -0
  36. package/core/cli/view.js +98 -161
  37. package/core/config.js +44 -2
  38. package/core/csrf.js +156 -24
  39. package/core/database.js +1184 -1131
  40. package/core/debug.js +1 -1
  41. package/core/html.js +8 -1
  42. package/core/index.d.ts +126 -310
  43. package/core/paths.js +55 -0
  44. package/core/ratelimit.js +10 -1
  45. package/core/react/client/api.js +239 -0
  46. package/core/react/client/auth.js +236 -0
  47. package/core/react/client/components.js +1321 -0
  48. package/core/react/client/datatable.js +595 -0
  49. package/core/react/client/i18n.js +440 -0
  50. package/core/react/client/index.d.ts +314 -0
  51. package/core/react/client/index.js +50 -0
  52. package/core/react/client/router.js +26 -0
  53. package/core/react/client/theme.css +512 -0
  54. package/core/render-cache.js +250 -212
  55. package/core/render.d.ts +25 -21
  56. package/core/render.js +738 -736
  57. package/core/router.d.ts +2 -3
  58. package/core/router.js +171 -171
  59. package/core/seo.js +10 -0
  60. package/core/spa.js +599 -0
  61. package/core/view-loader.js +155 -613
  62. package/core/vite-plugin.d.ts +18 -0
  63. package/core/vite-plugin.js +162 -0
  64. package/core/vite.js +250 -145
  65. package/index.js +22 -18
  66. package/jsconfig.json +5 -3
  67. package/package.json +114 -92
  68. package/production.md +8 -3
  69. package/public/js/bluebird.js +1886 -0
  70. package/templates/_auth/app/database.js +19 -0
  71. package/templates/_auth/app/models/user.js +22 -0
  72. package/templates/_auth/app/routes/auth-router.js +304 -0
  73. package/templates/_base/app/resources/html/layouts/main.html +55 -0
  74. package/templates/_base/app/resources/html/notFound.html +14 -0
  75. package/templates/_base/app/resources/index.html +27 -0
  76. package/templates/_base/app/resources/styles.css +9 -0
  77. package/templates/api/app/models/note.js +18 -0
  78. package/templates/api/app/routes/api.js +82 -0
  79. package/templates/api/app/routes/auth.js +11 -0
  80. package/templates/api/index.js +19 -0
  81. package/templates/api/template.json +13 -0
  82. package/templates/auth/app/mail.js +11 -0
  83. package/templates/auth/app/models/password_reset.js +18 -0
  84. package/templates/auth/app/resources/html/home.html +21 -0
  85. package/templates/auth/app/resources/html/partials/nav.html +2 -0
  86. package/templates/auth/app/resources/layouts/AppLayout.jsx +60 -0
  87. package/templates/auth/app/resources/main.jsx +18 -0
  88. package/templates/auth/app/resources/pages/Dashboard.jsx +51 -0
  89. package/templates/auth/app/resources/pages/ForgotPassword.jsx +34 -0
  90. package/templates/auth/app/resources/pages/Login.jsx +36 -0
  91. package/templates/auth/app/resources/pages/NotFound.jsx +16 -0
  92. package/templates/auth/app/resources/pages/Profile.jsx +99 -0
  93. package/templates/auth/app/resources/pages/Register.jsx +50 -0
  94. package/templates/auth/app/resources/pages/ResetPassword.jsx +50 -0
  95. package/templates/auth/app/resources/routes.jsx +54 -0
  96. package/templates/auth/app/resources/spa.js +29 -0
  97. package/templates/auth/app/routes/api.js +17 -0
  98. package/templates/auth/app/routes/auth.js +13 -0
  99. package/templates/auth/app/routes/web.js +21 -0
  100. package/templates/auth/index.js +19 -0
  101. package/templates/auth/template.json +15 -0
  102. package/templates/blank/app/models/.gitkeep +0 -0
  103. package/templates/blank/app/resources/html/home.html +27 -0
  104. package/templates/blank/app/resources/html/partials/nav.html +1 -0
  105. package/templates/blank/app/resources/main.jsx +16 -0
  106. package/templates/blank/app/resources/pages/Home.jsx +42 -0
  107. package/templates/blank/app/resources/pages/NotFound.jsx +27 -0
  108. package/templates/blank/app/resources/routes.jsx +15 -0
  109. package/templates/blank/app/resources/spa.js +24 -0
  110. package/templates/blank/app/routes/api.js +11 -0
  111. package/templates/blank/app/routes/web.js +21 -0
  112. package/templates/blank/index.js +13 -0
  113. package/templates/blank/template.json +12 -0
  114. package/templates/blog/app/lib/blog.js +149 -0
  115. package/templates/blog/app/models/post.js +22 -0
  116. package/templates/blog/app/resources/html/home.html +28 -0
  117. package/templates/blog/app/resources/html/not-found.html +5 -0
  118. package/templates/blog/app/resources/html/partials/nav.html +2 -0
  119. package/templates/blog/app/resources/html/partials/post-card.html +9 -0
  120. package/templates/blog/app/resources/html/post.html +8 -0
  121. package/templates/blog/app/resources/layouts/AdminLayout.jsx +54 -0
  122. package/templates/blog/app/resources/main.jsx +18 -0
  123. package/templates/blog/app/resources/pages/Login.jsx +31 -0
  124. package/templates/blog/app/resources/pages/NotFound.jsx +16 -0
  125. package/templates/blog/app/resources/pages/PostEditor.jsx +51 -0
  126. package/templates/blog/app/resources/pages/Posts.jsx +83 -0
  127. package/templates/blog/app/resources/pages/Register.jsx +43 -0
  128. package/templates/blog/app/resources/routes.jsx +51 -0
  129. package/templates/blog/app/resources/spa.js +25 -0
  130. package/templates/blog/app/resources/styles.css +40 -0
  131. package/templates/blog/app/routes/api.js +77 -0
  132. package/templates/blog/app/routes/auth.js +10 -0
  133. package/templates/blog/app/routes/web.js +114 -0
  134. package/templates/blog/index.js +21 -0
  135. package/templates/blog/template.json +14 -0
  136. package/vite.config.js +11 -0
  137. package/app/views/components/Header.jsx +0 -42
  138. package/app/views/components/LiveCounter.jsx +0 -67
  139. package/app/views/layouts/main/view.jsx +0 -201
  140. package/app/views/legal/terms.html +0 -29
  141. package/app/views/pages/about.jsx +0 -98
  142. package/app/views/pages/dashboard.jsx +0 -278
  143. package/app/views/pages/index.jsx +0 -123
  144. package/app/views/pages/login.jsx +0 -141
  145. package/core/actions.d.ts +0 -4
  146. package/core/actions.js +0 -355
  147. package/core/jsx.d.ts +0 -38
  148. package/core/jsx.js +0 -1597
  149. package/core/vite.d.ts +0 -3
  150. package/public/js/bluebird-client.js +0 -3265
  151. package/public/js/tailwind.js +0 -8
@@ -1,201 +0,0 @@
1
- /**
2
- * Shared application layout for Bluebird.js written in React JSX.
3
- * Provides the global HTML shell, header navigation, aside menu, and footer.
4
- *
5
- * @param {Object} context
6
- * @param {any} context.body - Main content rendered by the view.
7
- * @param {Object} [context.head={}] - Head metadata (title, description, canonical, etc.).
8
- * @param {Object} [context.ctx={}] - Request context ({ req, res, user, locals }).
9
- */
10
- export default function MainLayout({ body, head = {}, ctx = {} }) {
11
- const currentPath = ctx.req?.path || "/";
12
- const user = ctx.user || ctx.req?.user;
13
-
14
- const isActive = (path) =>
15
- currentPath === path
16
- ? "bg-sky-500/15 text-sky-400 border border-sky-500/30 font-semibold"
17
- : "text-slate-400 hover:text-slate-100 hover:bg-slate-800/60";
18
-
19
- const tailwindThemeCss = `
20
- @custom-variant dark (&:where(.dark, .dark *, [data-theme="dark"], [data-theme="dark"] *));
21
- @theme {
22
- --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
23
- }
24
- `;
25
-
26
- return (
27
- <html lang="en" className="dark" data-theme="dark">
28
- <head>
29
- <meta charSet="UTF-8" />
30
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
31
- <title>{head.title || "Blue Bird Framework"}</title>
32
- <link rel="canonical" href={head.canonical || "https://seip25.github.io/bluebird-js/"} />
33
- <meta
34
- name="description"
35
- content={
36
- head.description ||
37
- "Blue Bird is a fast, structured, and opinionated Express.js framework for developers who want visual elegance and performance with React SSR and modern JavaScript."
38
- }
39
- />
40
- <meta
41
- name="keywords"
42
- content={
43
- head.keywords ||
44
- "Blue Bird, Express.js, Node.js, React SSR, Partial Rendering, Performance, Nginx, Redis"
45
- }
46
- />
47
- <meta name="author" content="Seip25" />
48
- <link rel="icon" href="/images/favicon.ico" />
49
- <link rel="preconnect" href="https://fonts.googleapis.com" />
50
- <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="anonymous" />
51
- <link
52
- href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap"
53
- rel="stylesheet"
54
- />
55
- <script src="/js/tailwind.js"></script>
56
- <style type="text/tailwindcss">{tailwindThemeCss}</style>
57
- <script src="/js/bluebird-client.js" defer></script>
58
- </head>
59
- <body
60
- data-layout="main"
61
- className="min-h-screen flex flex-col bg-slate-950 text-slate-100 font-sans antialiased selection:bg-sky-500/30"
62
- >
63
- <header className="border-b border-slate-800/80 bg-slate-950/80 backdrop-blur-md sticky top-0 z-30 px-6 py-4">
64
- <nav className="flex items-center justify-between max-w-7xl mx-auto">
65
- <a
66
- href="/"
67
- className="flex items-center gap-2.5 text-slate-100 hover:text-sky-400 transition-colors"
68
- >
69
- <svg
70
- width="28"
71
- height="28"
72
- viewBox="0 0 24 24"
73
- fill="none"
74
- stroke="currentColor"
75
- strokeWidth="2"
76
- strokeLinecap="round"
77
- strokeLinejoin="round"
78
- className="text-sky-400"
79
- >
80
- <path d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />
81
- </svg>
82
- <strong className="text-xl font-bold bg-gradient-to-r from-sky-400 via-blue-500 to-indigo-400 bg-clip-text text-transparent">
83
- Blue Bird
84
- </strong>
85
- </a>
86
- <div className="flex items-center gap-3">
87
- <a
88
- href="https://github.com/seip25/bluebird-js"
89
- target="_blank"
90
- className="px-3 py-1.5 rounded-lg border border-slate-700/80 bg-slate-900/60 text-xs font-medium text-slate-300 hover:text-white hover:bg-slate-800 transition-all flex items-center gap-1.5"
91
- >
92
- <span>★</span> GitHub
93
- </a>
94
- </div>
95
- </nav>
96
- </header>
97
-
98
- <main
99
- data-bb-outlet="true"
100
- className="flex-1 max-w-7xl w-full mx-auto px-4 md:px-6 py-8 flex flex-col md:flex-row gap-8"
101
- >
102
- <aside className="w-full md:w-60 shrink-0 flex flex-col gap-1.5 p-4 rounded-2xl border border-slate-800/80 bg-slate-900/40 h-fit">
103
- <h4 className="px-3 py-1 text-xs font-bold uppercase tracking-wider text-slate-400 mb-1">
104
- Menu
105
- </h4>
106
- <a href="/" className={`px-3 py-2 rounded-lg text-sm transition-colors ${isActive("/")}`}>
107
- Home
108
- </a>
109
- <a
110
- href="/about"
111
- className={`px-3 py-2 rounded-lg text-sm transition-colors ${isActive("/about")}`}
112
- >
113
- About
114
- </a>
115
- <a
116
- href="/login"
117
- className={`px-3 py-2 rounded-lg text-sm transition-colors ${isActive("/login")}`}
118
- >
119
- Login
120
- </a>
121
- <a
122
- href="/dashboard"
123
- className={`px-3 py-2 rounded-lg text-sm transition-colors ${isActive("/dashboard")}`}
124
- >
125
- Dashboard
126
- </a>
127
- <div className="my-2 border-t border-slate-800/80"></div>
128
- <a
129
- href="https://seip25.github.io/bluebird-js"
130
- target="_blank"
131
- className="px-3 py-2 rounded-lg text-sm text-slate-400 hover:text-slate-100 hover:bg-slate-800/60 transition-colors"
132
- >
133
- Documentation
134
- </a>
135
- <a
136
- href="https://github.com/seip25/bluebird-js"
137
- target="_blank"
138
- className="px-3 py-2 rounded-lg text-sm text-slate-400 hover:text-slate-100 hover:bg-slate-800/60 transition-colors"
139
- >
140
- GitHub Repository
141
- </a>
142
- {user ? (
143
- <a
144
- href="/logout"
145
- data-no-prefetch="true"
146
- role="button"
147
- className="mt-3 px-3 py-2 text-center rounded-lg text-xs font-semibold bg-red-500/15 text-red-400 border border-red-500/30 hover:bg-red-500/25 transition-colors"
148
- >
149
- Sign Out
150
- </a>
151
- ) : (
152
- <a
153
- href="https://github.com/seip25/bluebird-js"
154
- target="_blank"
155
- role="button"
156
- className="mt-3 px-3 py-2 text-center rounded-lg text-xs font-semibold bg-slate-800 text-slate-200 border border-slate-700 hover:bg-slate-700 hover:text-white transition-colors"
157
- >
158
- Star on GitHub
159
- </a>
160
- )}
161
- </aside>
162
-
163
- <div className="page-content flex-1 min-w-0">{body}</div>
164
- </main>
165
-
166
- <footer className="border-t border-slate-800/80 bg-slate-950 py-8 px-6 mt-auto">
167
- <div className="max-w-7xl mx-auto flex flex-col md:flex-row items-center justify-between gap-4 text-xs text-slate-400">
168
- <p>
169
- Powered by{" "}
170
- <strong className="bg-gradient-to-r from-sky-400 to-indigo-400 bg-clip-text text-transparent font-semibold">
171
- Blue Bird Framework
172
- </strong>
173
- </p>
174
- <div className="flex items-center gap-4">
175
- <a href="/" className="hover:text-slate-200 transition-colors">
176
- Home
177
- </a>
178
- <a href="/about" className="hover:text-slate-200 transition-colors">
179
- About
180
- </a>
181
- <a href="/login" className="hover:text-slate-200 transition-colors">
182
- Login
183
- </a>
184
- <a href="/dashboard" className="hover:text-slate-200 transition-colors">
185
- Dashboard
186
- </a>
187
- <a
188
- href="https://github.com/seip25/bluebird-js"
189
- target="_blank"
190
- className="hover:text-sky-400 transition-colors"
191
- >
192
- ★ GitHub
193
- </a>
194
- </div>
195
- </div>
196
- </footer>
197
- </body>
198
- </html>
199
- );
200
- }
201
-
@@ -1,29 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en" class="dark" data-theme="dark">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Terms of Service — Blue Bird</title>
7
- <link rel="preconnect" href="https://fonts.googleapis.com">
8
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
9
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
10
- <script src="/js/tailwind.js"></script>
11
- <style type="text/tailwindcss">
12
- @custom-variant dark (&:where(.dark, .dark *, [data-theme="dark"], [data-theme="dark"] *));
13
- @theme {
14
- --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
15
- }
16
- </style>
17
- </head>
18
- <body class="min-h-screen bg-slate-950 text-slate-100 font-sans p-8 max-w-4xl mx-auto">
19
- <article class="rounded-2xl border border-slate-800 bg-slate-900/60 p-8 shadow-xl">
20
- <header class="border-b border-slate-800 pb-4 mb-6">
21
- <h1 class="text-3xl font-extrabold bg-gradient-to-r from-sky-400 to-indigo-400 bg-clip-text text-transparent">Terms of Service</h1>
22
- <p class="text-sm text-slate-400 mt-1">Served directly as raw, unparsed HTML via Render.html().</p>
23
- </header>
24
- <div>
25
- <p class="text-slate-300 leading-relaxed">This static document demonstrates zero-overhead static HTML serving without template interpolation or server computation.</p>
26
- </div>
27
- </article>
28
- </body>
29
- </html>
@@ -1,98 +0,0 @@
1
- export const route = "/about";
2
- export const cache = 300;
3
- export const layout = "main";
4
- export const seo = true;
5
-
6
- export const head = () => ({
7
- title: "About Us — Blue Bird Framework",
8
- description: "Learn about the architecture and design philosophy of Blue Bird.",
9
- });
10
-
11
- /**
12
- * About page React JSX view module.
13
- */
14
- export default function AboutView() {
15
- return (
16
- <>
17
- <section className="py-10 md:py-14 border-b border-slate-800/80">
18
- <h1 className="mt-3 text-3xl md:text-5xl font-extrabold tracking-tight bg-gradient-to-r from-sky-400 via-blue-500 to-indigo-400 bg-clip-text text-transparent">
19
- About Blue Bird
20
- </h1>
21
- <p className="mt-4 text-base md:text-lg text-slate-300 max-w-2xl leading-relaxed">
22
- Built for performance, simplicity, and raw speed with native React JSX SSR.
23
- </p>
24
- </section>
25
-
26
- <article className="mt-8 rounded-2xl border border-slate-800 bg-slate-900/60 p-6 md:p-8">
27
- <header>
28
- <h2 className="text-xl font-bold text-sky-400 mb-3">Our Philosophy</h2>
29
- </header>
30
- <p className="text-slate-300 leading-relaxed">
31
- Blue Bird was born out of a desire for a clean, performance-first approach to web development. We
32
- believe in harnessing the raw power of Express.js and modern Node.js ESM, stripping away unnecessary bloat, and
33
- providing developers with a robust foundation that just works.
34
- </p>
35
- <p className="text-slate-300 leading-relaxed mt-4">
36
- By combining server-rendered React JSX views with selective client hydration, anti-CLS skeletons, and native browser View Transitions,
37
- Blue Bird eliminates heavy compilation pipelines and excessive memory usage.
38
- </p>
39
- </article>
40
-
41
- <div className="mt-8">
42
- <h2 className="text-xl font-bold text-slate-100 mb-4">Why Blue Bird?</h2>
43
-
44
- <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
45
- <div className="space-y-4">
46
- <details
47
- className="rounded-xl border border-slate-800 bg-slate-900/50 p-4 open:border-slate-700 transition-colors"
48
- open
49
- >
50
- <summary className="font-semibold text-slate-200 cursor-pointer select-none">
51
- Production Ready
52
- </summary>
53
- <p className="mt-2 text-sm text-slate-400 leading-relaxed">
54
- Seamless transition from development to production with PM2 clustering, systemd, and high performance multi-level caching.
55
- </p>
56
- </details>
57
- <details
58
- className="rounded-xl border border-slate-800 bg-slate-900/50 p-4 open:border-slate-700 transition-colors"
59
- open
60
- >
61
- <summary className="font-semibold text-slate-200 cursor-pointer select-none">
62
- Military Grade Security
63
- </summary>
64
- <p className="mt-2 text-sm text-slate-400 leading-relaxed">
65
- Built-in AES-256-GCM JWT encryption, secure HttpOnly cookie sessions, security headers, and rate limiting.
66
- </p>
67
- </details>
68
- </div>
69
- <div className="space-y-4">
70
- <details
71
- className="rounded-xl border border-slate-800 bg-slate-900/50 p-4 open:border-slate-700 transition-colors"
72
- open
73
- >
74
- <summary className="font-semibold text-slate-200 cursor-pointer select-none">
75
- Multi-Tier Caching
76
- </summary>
77
- <p className="mt-2 text-sm text-slate-400 leading-relaxed">
78
- In-memory LRU, Redis clustering, and persistent file caching for maximum requests per second with minimum CPU usage.
79
- </p>
80
- </details>
81
- <details
82
- className="rounded-xl border border-slate-800 bg-slate-900/50 p-4 open:border-slate-700 transition-colors"
83
- open
84
- >
85
- <summary className="font-semibold text-slate-200 cursor-pointer select-none">
86
- React JSX SSR &amp; Auto-Routes
87
- </summary>
88
- <p className="mt-2 text-sm text-slate-400 leading-relaxed">
89
- Write clean JSX components with declarative route exports (<code>cache</code>, <code>middlewares</code>, <code>layout</code>) and zero build steps.
90
- </p>
91
- </details>
92
- </div>
93
- </div>
94
- </div>
95
- </>
96
- );
97
- }
98
-
@@ -1,278 +0,0 @@
1
- import Auth from "@seip/bluebird-js/core/auth.js";
2
- import { action } from "@seip/bluebird-js/core/actions.js";
3
- import { Script } from "@seip/bluebird-js/core/jsx.js";
4
- import Header from "../components/Header.jsx";
5
- import LiveCounter from "../components/LiveCounter.jsx";
6
-
7
- export const route = "/dashboard";
8
- export const layout = "main";
9
- export const middlewares = [Auth.protect({ redirect: "/login" })];
10
- export const seo = false;
11
-
12
- export const actions = {
13
- async syncCount({ body, user }) {
14
- return {
15
- synced: true,
16
- count: Number(body.count),
17
- message: `Counter (${body.count}) verified on server for ${user?.name || "Member"} with CSRF & payload guard!`,
18
- };
19
- },
20
- };
21
-
22
- export const head = (data) => ({
23
- title: `Dashboard — ${data.user?.name || "Member"}`,
24
- description: "Protected member dashboard for Blue Bird framework.",
25
- });
26
-
27
- /**
28
- * Dashboard page React JSX view module.
29
- * @param {Object} props
30
- * @param {Object} [props.user={}]
31
- */
32
- export default function DashboardView({ user = {} }) {
33
- const initialCount = 7;
34
-
35
- return (
36
- <>
37
- <Header title="Protected Dashboard" user={user} count={initialCount} />
38
-
39
- <div className="space-y-6">
40
- <div className="rounded-xl border border-emerald-500/30 bg-emerald-950/20 p-4 text-emerald-200 flex items-start gap-3">
41
- <span className="inline-flex items-center justify-center w-6 h-6 rounded-full bg-emerald-500/20 text-emerald-400 text-xs font-bold shrink-0 mt-0.5">
42
- ✓
43
- </span>
44
- <div>
45
- <strong className="font-semibold block text-emerald-100">
46
- Active Protected Session (React JSX SSR)
47
- </strong>
48
- <p className="text-sm text-emerald-300/80 mt-0.5 leading-relaxed">
49
- This route is declaratively configured via{" "}
50
- <code className="px-1.5 py-0.5 rounded bg-emerald-900/40 text-emerald-200 text-xs">
51
- export const middlewares = [Auth.protect({'{'} redirect: "/login" {'}'})]
52
- </code>{" "}
53
- inside <code>app/views/dashboard.jsx</code>.
54
- </p>
55
- </div>
56
- </div>
57
-
58
- <article className="rounded-2xl border border-slate-800 bg-slate-900/60 p-6 shadow-sm">
59
- <header className="flex items-center justify-between pb-4 border-b border-slate-800/80">
60
- <div>
61
- <h3 className="text-lg font-bold text-slate-100">User Profile</h3>
62
- <p className="text-xs text-slate-400 mt-0.5">
63
- Decoded JWT payload stored in <code className="text-sky-400">req.user</code>.
64
- </p>
65
- </div>
66
- <span className="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold bg-emerald-500/10 text-emerald-400 border border-emerald-500/20">
67
- Active Session
68
- </span>
69
- </header>
70
-
71
- <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 mt-5">
72
- <div className="rounded-xl border border-slate-800/80 bg-slate-950/60 p-4">
73
- <span className="text-[11px] uppercase font-bold tracking-wider text-slate-400 block">
74
- User Name
75
- </span>
76
- <div className="font-bold text-base text-slate-100 mt-1">
77
- {user.name || "Anonymous"}
78
- </div>
79
- </div>
80
- <div className="rounded-xl border border-slate-800/80 bg-slate-950/60 p-4">
81
- <span className="text-[11px] uppercase font-bold tracking-wider text-slate-400 block">
82
- Email Address
83
- </span>
84
- <div className="font-bold text-base text-slate-100 mt-1">
85
- {user.email || "user@example.com"}
86
- </div>
87
- </div>
88
- <div className="rounded-xl border border-slate-800/80 bg-slate-950/60 p-4">
89
- <span className="text-[11px] uppercase font-bold tracking-wider text-slate-400 block">
90
- Account Role
91
- </span>
92
- <div className="mt-1">
93
- <span className="inline-block px-2.5 py-0.5 rounded-md text-xs font-semibold bg-sky-500/15 text-sky-400 border border-sky-500/30">
94
- {user.role || "user"}
95
- </span>
96
- </div>
97
- </div>
98
- <div className="rounded-xl border border-slate-800/80 bg-slate-950/60 p-4">
99
- <span className="text-[11px] uppercase font-bold tracking-wider text-slate-400 block">
100
- Session Identifier
101
- </span>
102
- <div className="mt-1 font-mono text-xs text-slate-300 truncate">
103
- {user._sessionId || "sess_active"}
104
- </div>
105
- </div>
106
- </div>
107
-
108
- <footer className="flex flex-wrap items-center justify-between gap-3 pt-5 mt-5 border-t border-slate-800/80">
109
- <a
110
- href="/logout"
111
- data-no-prefetch="true"
112
- className="px-4 py-2 rounded-lg text-sm font-semibold text-red-400 bg-red-500/10 border border-red-500/20 hover:bg-red-500/20 transition-colors"
113
- >
114
- Sign Out &rarr;
115
- </a>
116
- <div className="flex items-center gap-2">
117
- <a
118
- href="/about"
119
- className="px-3.5 py-2 rounded-lg text-sm font-medium text-slate-300 bg-slate-800/80 border border-slate-700 hover:text-white hover:bg-slate-700 transition-colors"
120
- >
121
- Test Transition to /about
122
- </a>
123
- <a
124
- href="/"
125
- className="px-3.5 py-2 rounded-lg text-sm font-medium text-slate-300 bg-slate-800/80 border border-slate-700 hover:text-white hover:bg-slate-700 transition-colors"
126
- >
127
- Test Transition to /
128
- </a>
129
- </div>
130
- </footer>
131
- </article>
132
-
133
- <article className="rounded-2xl border border-slate-800 bg-slate-900/60 p-6 shadow-sm">
134
- <header className="flex items-center justify-between pb-4 border-b border-slate-800/80">
135
- <div>
136
- <h3 className="text-lg font-bold text-slate-100">Interactive Client Controls</h3>
137
- <p className="text-xs text-slate-400 mt-0.5">
138
- Native inline client script and <code>&lt;Client /&gt;</code> skeleton boundary with zero layout shift.
139
- </p>
140
- </div>
141
- <span className="inline-flex items-center px-2.5 py-1 rounded-full text-xs font-semibold bg-sky-500/10 text-sky-400 border border-sky-500/20">
142
- Live Interactive
143
- </span>
144
- </header>
145
-
146
- <div className="mt-5 space-y-5">
147
- <p className="text-sm text-slate-300">
148
- Click the buttons below to interact without page reloads:
149
- </p>
150
-
151
- <div className="flex items-center gap-3">
152
- <button
153
- id="btnDec"
154
- type="button"
155
- className="px-3.5 py-2 rounded-lg border border-slate-700 bg-slate-800 hover:bg-slate-700 text-slate-100 font-semibold text-sm transition-colors"
156
- >
157
- &minus; Decrement
158
- </button>
159
- <span
160
- id="counterVal"
161
- className="font-mono text-2xl font-bold px-4 py-1.5 bg-slate-950 border border-slate-800 text-sky-400 rounded-lg min-w-14 text-center"
162
- >
163
- {initialCount}
164
- </span>
165
- <button
166
- id="btnInc"
167
- type="button"
168
- className="px-3.5 py-2 rounded-lg border border-slate-700 bg-slate-800 hover:bg-slate-700 text-slate-100 font-semibold text-sm transition-colors"
169
- >
170
- &plus; Increment
171
- </button>
172
- <button
173
- id="btnReset"
174
- type="button"
175
- className="px-3.5 py-2 rounded-lg border border-red-500/30 bg-red-500/10 hover:bg-red-500/20 text-red-300 font-semibold text-sm transition-colors"
176
- >
177
- Reset
178
- </button>
179
- </div>
180
-
181
- <div className="pt-4 border-t border-slate-800/60">
182
- <label
183
- htmlFor="filterQuery"
184
- className="text-xs font-semibold uppercase tracking-wider text-slate-400 block mb-2"
185
- >
186
- Live Input Event Listener:
187
- </label>
188
- <input
189
- type="text"
190
- id="filterQuery"
191
- placeholder="Type here to test live event handling..."
192
- className="w-full max-w-lg rounded-lg border border-slate-700 bg-slate-950 px-3.5 py-2.5 text-sm text-slate-100 placeholder-slate-500 focus:border-sky-500 focus:outline-none focus:ring-2 focus:ring-sky-500/20 transition-all"
193
- />
194
- <p id="summaryText" className="text-xs text-slate-400 mt-2">
195
- Type in the field above to test live event listening.
196
- </p>
197
- </div>
198
-
199
- <div className="pt-4 border-t border-slate-800/60">
200
- <span className="text-xs font-semibold uppercase tracking-wider text-slate-400 block mb-2">
201
- Imported Client Component (<code>&lt;Client component=&#123;LiveCounter&#125; persistent /&gt;</code>) + Server Action:
202
- </span>
203
- <LiveCounter initial={7} />
204
- </div>
205
- </div>
206
- </article>
207
-
208
- <Script data={{ initialCount }} onPageLoad>
209
- {({ initialCount }) => {
210
- let count = initialCount;
211
- const valEl = document.getElementById("counterVal");
212
- const headerBadge = document.getElementById("header-counter-badge");
213
- const incBtn = document.getElementById("btnInc");
214
- const decBtn = document.getElementById("btnDec");
215
- const resetBtn = document.getElementById("btnReset");
216
- const queryInput = document.getElementById("filterQuery");
217
- const summaryEl = document.getElementById("summaryText");
218
-
219
- const update = () => {
220
- if (valEl) valEl.textContent = String(count);
221
- if (headerBadge) headerBadge.textContent = String(count);
222
- };
223
-
224
- incBtn?.addEventListener("click", () => {
225
- count++;
226
- update();
227
- });
228
- decBtn?.addEventListener("click", () => {
229
- if (count > 0) count--;
230
- update();
231
- });
232
- resetBtn?.addEventListener("click", () => {
233
- count = 0;
234
- update();
235
- });
236
-
237
- queryInput?.addEventListener("input", (e) => {
238
- if (summaryEl) {
239
- summaryEl.textContent = e.target.value
240
- ? `Active query: ${e.target.value}`
241
- : "Type in the field above to test live event listening.";
242
- }
243
- });
244
- }}
245
- </Script>
246
-
247
- <article className="rounded-2xl border border-slate-800 bg-slate-900/60 p-6 shadow-sm">
248
- <header className="pb-3 border-b border-slate-800/80">
249
- <h4 className="text-base font-bold text-slate-100">
250
- Transition &amp; Middleware Diagnostics
251
- </h4>
252
- </header>
253
- <div className="grid grid-cols-1 md:grid-cols-3 gap-4 mt-4">
254
- <div className="rounded-xl border border-slate-800 bg-slate-950/60 p-4">
255
- <h5 className="font-semibold text-sm text-slate-200 mb-1">Stateful Navigation</h5>
256
- <p className="text-xs text-slate-400 leading-relaxed">
257
- Click links between Home, About, and Dashboard. Notice how the View Transitions API animates without page refreshes while preserving session cookies.
258
- </p>
259
- </div>
260
- <div className="rounded-xl border border-slate-800 bg-slate-950/60 p-4">
261
- <h5 className="font-semibold text-sm text-slate-200 mb-1">Zero Cache On Dashboard</h5>
262
- <p className="text-xs text-slate-400 leading-relaxed">
263
- Response header <code className="text-sky-400">X-Bluebird-Cache: MISS</code> is returned, verifying that user-sensitive data is never statically cached.
264
- </p>
265
- </div>
266
- <div className="rounded-xl border border-slate-800 bg-slate-950/60 p-4">
267
- <h5 className="font-semibold text-sm text-slate-200 mb-1">Automatic Revocation</h5>
268
- <p className="text-xs text-slate-400 leading-relaxed">
269
- Clicking "Sign Out" revokes the session in memory/Redis and clears the HttpOnly cookie, blocking subsequent dashboard visits.
270
- </p>
271
- </div>
272
- </div>
273
- </article>
274
- </div>
275
- </>
276
- );
277
- }
278
-