@seip/bluebird-js 0.0.1 → 0.1.0
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.
- package/.env_example +53 -53
- package/AGENTS.md +426 -403
- package/LICENSE +1 -1
- package/README.md +292 -285
- package/app/routes/api.js +50 -50
- package/app/routes/web.js +55 -53
- package/app/views/about.js +63 -0
- package/app/views/dashboard.js +147 -0
- package/app/views/index.js +80 -0
- package/app/views/layouts/main/view.js +81 -0
- package/app/views/legal/terms.html +19 -0
- package/app/views/login.js +80 -0
- package/core/app.d.ts +18 -18
- package/core/app.js +684 -644
- package/core/auth.d.ts +13 -13
- package/core/auth.js +326 -326
- package/core/cache.d.ts +17 -17
- package/core/cache.js +475 -475
- package/core/cli/doctor.js +287 -287
- package/core/cli/ecosystem.js +162 -162
- package/core/cli/init.js +779 -779
- package/core/cli/migrate.js +541 -541
- package/core/cli/model.js +66 -66
- package/core/cli/nginx.js +199 -199
- package/core/cli/route.js +120 -120
- package/core/cli/view.js +55 -36
- package/core/config.d.ts +3 -3
- package/core/config.js +111 -111
- package/core/csrf.d.ts +3 -3
- package/core/csrf.js +114 -114
- package/core/database.d.ts +15 -15
- package/core/database.js +636 -636
- package/core/debug.d.ts +3 -3
- package/core/debug.js +249 -249
- package/core/hash.d.ts +3 -3
- package/core/hash.js +194 -194
- package/core/html.d.ts +42 -0
- package/core/html.js +217 -0
- package/core/index.d.ts +1176 -1071
- package/core/logger.d.ts +3 -3
- package/core/logger.js +127 -124
- package/core/middleware.d.ts +3 -3
- package/core/middleware.js +28 -28
- package/core/model.d.ts +19 -19
- package/core/model.js +600 -600
- package/core/queue.d.ts +13 -13
- package/core/queue.js +172 -172
- package/core/ratelimit.d.ts +3 -3
- package/core/ratelimit.js +145 -145
- package/core/redis.d.ts +21 -21
- package/core/redis.js +230 -230
- package/core/render-cache.js +212 -0
- package/core/render.d.ts +3 -3
- package/core/render.js +199 -555
- package/core/router.d.ts +3 -3
- package/core/router.js +171 -171
- package/core/seo.d.ts +3 -3
- package/core/seo.js +106 -106
- package/core/swagger.d.ts +3 -3
- package/core/swagger.js +60 -60
- package/core/upload.d.ts +13 -13
- package/core/upload.js +102 -102
- package/core/util/colors.js +82 -82
- package/core/validate.d.ts +15 -15
- package/core/validate.js +364 -364
- package/core/view-loader.js +162 -0
- package/core/vite.d.ts +3 -3
- package/core/vite.js +145 -145
- package/core/ws.d.ts +13 -13
- package/core/ws.js +245 -245
- package/index.js +18 -18
- package/jsconfig.json +15 -15
- package/package.json +85 -86
- package/production.md +273 -273
- package/public/css/bluebird.min.css +1 -1
- package/public/js/bluebird-client.js +1780 -1662
- package/public/js/bluebird.min.js +1072 -1072
- package/app/views/about.html +0 -161
- package/app/views/dashboard.html +0 -140
- package/app/views/index.html +0 -150
- package/app/views/login.html +0 -144
package/app/routes/api.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import Router from "@seip/bluebird-js/core/router.js";
|
|
2
|
-
import Validator from "@seip/bluebird-js/core/validate.js";
|
|
3
|
-
import Cache from "@seip/bluebird-js/core/cache.js";
|
|
4
|
-
import Auth from "@seip/bluebird-js/core/auth.js";
|
|
5
|
-
|
|
6
|
-
const routerApi = new Router("/api");
|
|
7
|
-
|
|
8
|
-
routerApi.get("/", (req, res) => {
|
|
9
|
-
res.json({ api: true, message: "Blue Bird API", time: Date.now() });
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
routerApi.get("/users", (req, res) => {
|
|
13
|
-
const users = [
|
|
14
|
-
{ name: "John Doe", email: "john.doe@example.com" },
|
|
15
|
-
{ name: "Jane Doe", email: "jane.doe@example.com" },
|
|
16
|
-
];
|
|
17
|
-
res.json(users);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
const loginSchema = {
|
|
21
|
-
email: { required: true, email: true },
|
|
22
|
-
password: { required: true, min: 6 },
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const loginValidator = new Validator(loginSchema, "en");
|
|
26
|
-
|
|
27
|
-
routerApi.post("/login", loginValidator.middleware(), (req, res) => {
|
|
28
|
-
res.json({ message: "Login successful", body: req.body });
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
routerApi.get("/cache", Cache.middleware(60), async (req, res) => {
|
|
32
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
33
|
-
res.json({ message: "Cache successful" });
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
routerApi.get("/auth_generate", async (req, res) => {
|
|
37
|
-
const token = await Auth.login(res, { id: 1, name: "John Doe" }, "auth");
|
|
38
|
-
res.json({ message: "Auth successful", token });
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
routerApi.get("/auth_logout", async (req, res) => {
|
|
42
|
-
await Auth.logout(res, "auth", {}, req);
|
|
43
|
-
res.json({ message: "Logged out" });
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
routerApi.get("/auth_verify", Auth.protect(), (req, res) => {
|
|
47
|
-
res.json({ message: "Auth successful", user: req.user });
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
export default routerApi;
|
|
1
|
+
import Router from "@seip/bluebird-js/core/router.js";
|
|
2
|
+
import Validator from "@seip/bluebird-js/core/validate.js";
|
|
3
|
+
import Cache from "@seip/bluebird-js/core/cache.js";
|
|
4
|
+
import Auth from "@seip/bluebird-js/core/auth.js";
|
|
5
|
+
|
|
6
|
+
const routerApi = new Router("/api");
|
|
7
|
+
|
|
8
|
+
routerApi.get("/", (req, res) => {
|
|
9
|
+
res.json({ api: true, message: "Blue Bird API", time: Date.now() });
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
routerApi.get("/users", (req, res) => {
|
|
13
|
+
const users = [
|
|
14
|
+
{ name: "John Doe", email: "john.doe@example.com" },
|
|
15
|
+
{ name: "Jane Doe", email: "jane.doe@example.com" },
|
|
16
|
+
];
|
|
17
|
+
res.json(users);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const loginSchema = {
|
|
21
|
+
email: { required: true, email: true },
|
|
22
|
+
password: { required: true, min: 6 },
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const loginValidator = new Validator(loginSchema, "en");
|
|
26
|
+
|
|
27
|
+
routerApi.post("/login", loginValidator.middleware(), (req, res) => {
|
|
28
|
+
res.json({ message: "Login successful", body: req.body });
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
routerApi.get("/cache", Cache.middleware(60), async (req, res) => {
|
|
32
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
33
|
+
res.json({ message: "Cache successful" });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
routerApi.get("/auth_generate", async (req, res) => {
|
|
37
|
+
const token = await Auth.login(res, { id: 1, name: "John Doe" }, "auth");
|
|
38
|
+
res.json({ message: "Auth successful", token });
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
routerApi.get("/auth_logout", async (req, res) => {
|
|
42
|
+
await Auth.logout(res, "auth", {}, req);
|
|
43
|
+
res.json({ message: "Logged out" });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
routerApi.get("/auth_verify", Auth.protect(), (req, res) => {
|
|
47
|
+
res.json({ message: "Auth successful", user: req.user });
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export default routerApi;
|
package/app/routes/web.js
CHANGED
|
@@ -1,53 +1,55 @@
|
|
|
1
|
-
import Router from "@seip/bluebird-js/core/router.js";
|
|
2
|
-
import Render from "@seip/bluebird-js/core/render.js";
|
|
3
|
-
import Auth from "@seip/bluebird-js/core/auth.js";
|
|
4
|
-
|
|
5
|
-
const routerWeb = new Router("/", { seo: true });
|
|
6
|
-
|
|
7
|
-
routerWeb.get("/", Render.cache(300), Render.view("index"));
|
|
8
|
-
|
|
9
|
-
routerWeb.get("/about", Render.cache(300), Render.view("about"));
|
|
10
|
-
|
|
11
|
-
routerWeb.get("/
|
|
12
|
-
|
|
13
|
-
routerWeb.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
req.headers["
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
import Router from "@seip/bluebird-js/core/router.js";
|
|
2
|
+
import Render from "@seip/bluebird-js/core/render.js";
|
|
3
|
+
import Auth from "@seip/bluebird-js/core/auth.js";
|
|
4
|
+
|
|
5
|
+
const routerWeb = new Router("/", { seo: true });
|
|
6
|
+
|
|
7
|
+
routerWeb.get("/", Render.cache(300), Render.view("index"));
|
|
8
|
+
|
|
9
|
+
routerWeb.get("/about", Render.cache(300), Render.view("about"));
|
|
10
|
+
|
|
11
|
+
routerWeb.get("/terms", (req, res) => Render.html(res, "legal/terms.html", { ttl: 86400 }));
|
|
12
|
+
|
|
13
|
+
routerWeb.get("/login", Render.view("login"));
|
|
14
|
+
|
|
15
|
+
routerWeb.post("/login", async (req, res) => {
|
|
16
|
+
const email = req.body?.email || "alex@example.com";
|
|
17
|
+
const rawPrefix = email.split("@")[0] || "alex";
|
|
18
|
+
const name = req.body?.name || (rawPrefix.charAt(0).toUpperCase() + rawPrefix.slice(1));
|
|
19
|
+
|
|
20
|
+
const user = {
|
|
21
|
+
id: 1,
|
|
22
|
+
name,
|
|
23
|
+
email,
|
|
24
|
+
role: "admin",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
await Auth.login(res, user);
|
|
28
|
+
return res.redirect("/dashboard");
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
routerWeb.get("/logout", async (req, res) => {
|
|
32
|
+
if (
|
|
33
|
+
req.headers["x-bluebird-prefetch"] ||
|
|
34
|
+
req.headers.purpose === "prefetch" ||
|
|
35
|
+
req.headers["sec-purpose"] === "prefetch"
|
|
36
|
+
) {
|
|
37
|
+
return res.status(204).end();
|
|
38
|
+
}
|
|
39
|
+
await Auth.logout(res);
|
|
40
|
+
return res.redirect("/login");
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
routerWeb.post("/logout", async (req, res) => {
|
|
44
|
+
await Auth.logout(res);
|
|
45
|
+
return res.redirect("/login");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
routerWeb.get("/dashboard", Auth.protect({ redirect: "/login" }), async (req, res) => {
|
|
49
|
+
await Render.send(res, "dashboard", {
|
|
50
|
+
title: "Dashboard — Blue Bird",
|
|
51
|
+
user: req.user,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export default routerWeb;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { html } from "@seip/bluebird-js/core/html.js";
|
|
2
|
+
|
|
3
|
+
export const layout = "main";
|
|
4
|
+
|
|
5
|
+
export const head = () => ({
|
|
6
|
+
title: "About Us — Blue Bird Framework",
|
|
7
|
+
description: "Learn about the architecture and design philosophy of Blue Bird.",
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* About page view module.
|
|
12
|
+
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
13
|
+
*/
|
|
14
|
+
export default function AboutView() {
|
|
15
|
+
return html`
|
|
16
|
+
<section class="hero">
|
|
17
|
+
<h1 class="mt-3 text-gradient font-bold">About Blue Bird</h1>
|
|
18
|
+
<p class="lead">Built for performance, simplicity, and raw speed.</p>
|
|
19
|
+
</section>
|
|
20
|
+
|
|
21
|
+
<article class="mt-6">
|
|
22
|
+
<header>
|
|
23
|
+
<h2 class="text-gradient-blue font-semibold">Our Philosophy</h2>
|
|
24
|
+
</header>
|
|
25
|
+
<p>
|
|
26
|
+
Blue Bird was born out of a desire for a clean, performance-first approach to web development. We
|
|
27
|
+
believe in harnessing the raw power of Express.js and modern Node.js ESM, stripping away unnecessary bloat, and
|
|
28
|
+
providing developers with a robust foundation that just works.
|
|
29
|
+
</p>
|
|
30
|
+
<p>
|
|
31
|
+
By combining server-rendered pure JavaScript HTML modules with vanilla client scripts and native browser View Transitions,
|
|
32
|
+
Blue Bird eliminates heavy compilation pipelines and excessive memory usage.
|
|
33
|
+
</p>
|
|
34
|
+
</article>
|
|
35
|
+
|
|
36
|
+
<div class="px-4 py-4 mb-4">
|
|
37
|
+
<h2 class="text-gradient-blue font-semibold">Why Blue Bird?</h2>
|
|
38
|
+
|
|
39
|
+
<div class="grid cols-2 gap-4">
|
|
40
|
+
<div>
|
|
41
|
+
<details open>
|
|
42
|
+
<summary>Production Ready</summary>
|
|
43
|
+
<p>Seamless transition from development to production with PM2 clustering, systemd, and high performance multi-level caching.</p>
|
|
44
|
+
</details>
|
|
45
|
+
<details open>
|
|
46
|
+
<summary>Military Grade Security</summary>
|
|
47
|
+
<p>Built-in AES-256-GCM JWT encryption, secure HttpOnly cookie sessions, security headers, and rate limiting.</p>
|
|
48
|
+
</details>
|
|
49
|
+
</div>
|
|
50
|
+
<div>
|
|
51
|
+
<details open>
|
|
52
|
+
<summary>Multi-Tier Caching</summary>
|
|
53
|
+
<p>In-memory LRU, Redis clustering, and persistent file caching for maximum requests per second with minimum CPU usage.</p>
|
|
54
|
+
</details>
|
|
55
|
+
<details open>
|
|
56
|
+
<summary>Pure Modern JavaScript</summary>
|
|
57
|
+
<p>No heavy build steps or complex toolchains. Modern ESM templates and inline vanilla scripts executed cleanly in the browser.</p>
|
|
58
|
+
</details>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { html, script } from "@seip/bluebird-js/core/html.js";
|
|
2
|
+
|
|
3
|
+
export const layout = "main";
|
|
4
|
+
|
|
5
|
+
export const head = (data) => ({
|
|
6
|
+
title: `Dashboard — ${data.user?.name || "Member"}`,
|
|
7
|
+
description: "Protected member dashboard for Blue Bird framework.",
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Dashboard page view module.
|
|
12
|
+
* @param {Object} props
|
|
13
|
+
* @param {Object} props.user
|
|
14
|
+
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
15
|
+
*/
|
|
16
|
+
export default function DashboardView({ user = {} }) {
|
|
17
|
+
const initialCount = 7;
|
|
18
|
+
|
|
19
|
+
return html`
|
|
20
|
+
<section class="hero">
|
|
21
|
+
<h1 class="mt-3 text-gradient font-bold">Protected Dashboard</h1>
|
|
22
|
+
<p class="lead">You are securely authenticated via <strong>Auth.protect()</strong> middleware.</p>
|
|
23
|
+
</section>
|
|
24
|
+
|
|
25
|
+
<div class="mt-6">
|
|
26
|
+
<div class="alert alert-success mb-6">
|
|
27
|
+
<div>
|
|
28
|
+
<strong class="alert-title">Active Protected Session</strong>
|
|
29
|
+
<p class="alert-description">
|
|
30
|
+
This route was rendered on-demand with fresh session data via <code>Render.send(res, "dashboard", ...)</code>, bypassing view caching completely.
|
|
31
|
+
</p>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
<article class="card">
|
|
36
|
+
<header class="card-header">
|
|
37
|
+
<div class="flex items-center justify-between">
|
|
38
|
+
<div>
|
|
39
|
+
<h3 class="card-title">User Profile</h3>
|
|
40
|
+
<p class="card-description">Decoded JWT payload stored in <code>req.user</code>.</p>
|
|
41
|
+
</div>
|
|
42
|
+
<span class="badge badge-success badge-glow">Active Session</span>
|
|
43
|
+
</div>
|
|
44
|
+
</header>
|
|
45
|
+
|
|
46
|
+
<div class="grid cols-2 gap-4 mt-4">
|
|
47
|
+
<div class="card bg-secondary">
|
|
48
|
+
<small class="text-muted uppercase font-bold tracking-wider">User Name</small>
|
|
49
|
+
<h4 class="font-bold text-lg mt-1">${user.name || "Anonymous"}</h4>
|
|
50
|
+
</div>
|
|
51
|
+
<div class="card bg-secondary">
|
|
52
|
+
<small class="text-muted uppercase font-bold tracking-wider">Email Address</small>
|
|
53
|
+
<h4 class="font-bold text-lg mt-1">${user.email || "user@example.com"}</h4>
|
|
54
|
+
</div>
|
|
55
|
+
<div class="card bg-secondary">
|
|
56
|
+
<small class="text-muted uppercase font-bold tracking-wider">Account Role</small>
|
|
57
|
+
<p class="mt-1"><span class="badge badge-primary">${user.role || "user"}</span></p>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="card bg-secondary">
|
|
60
|
+
<small class="text-muted uppercase font-bold tracking-wider">Session Identifier</small>
|
|
61
|
+
<p class="mt-1 font-mono text-xs"><code>${user._sessionId || "sess_active"}</code></p>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<footer class="card-footer mt-6">
|
|
66
|
+
<a href="/logout" data-no-prefetch="true" role="button" class="destructive">Sign Out →</a>
|
|
67
|
+
<div class="flex items-center gap-2">
|
|
68
|
+
<a href="/about" role="button" class="outline">Test Transition to /about</a>
|
|
69
|
+
<a href="/" role="button" class="outline">Test Transition to /</a>
|
|
70
|
+
</div>
|
|
71
|
+
</footer>
|
|
72
|
+
</article>
|
|
73
|
+
|
|
74
|
+
<article class="card mt-6">
|
|
75
|
+
<header class="card-header">
|
|
76
|
+
<div class="flex items-center justify-between">
|
|
77
|
+
<div>
|
|
78
|
+
<h3 class="card-title">Vanilla Interactive Controls</h3>
|
|
79
|
+
<p class="card-description">Simple native inline script with zero framework overhead.</p>
|
|
80
|
+
</div>
|
|
81
|
+
<span class="badge badge-primary pulse-badge">Live Interactive</span>
|
|
82
|
+
</div>
|
|
83
|
+
</header>
|
|
84
|
+
|
|
85
|
+
<div class="mt-4">
|
|
86
|
+
<p class="text-sm">Click the buttons below to interact without page reloads:</p>
|
|
87
|
+
|
|
88
|
+
<div class="flex items-center gap-4 mt-3">
|
|
89
|
+
<button id="btnDec" type="button" class="btn-sm outline">− Decrement</button>
|
|
90
|
+
<span id="counterVal" class="font-mono text-2xl font-bold px-3 py-1 bg-secondary rounded">${initialCount}</span>
|
|
91
|
+
<button id="btnInc" type="button" class="btn-sm outline">+ Increment</button>
|
|
92
|
+
<button id="btnReset" type="button" class="btn-sm destructive">Reset</button>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div class="mt-6">
|
|
96
|
+
<label for="filterQuery" class="text-sm font-semibold">Live Input Demo:</label>
|
|
97
|
+
<input type="text" id="filterQuery" placeholder="Type here to test live vanilla event handling..." class="mt-2" />
|
|
98
|
+
<p id="summaryText" class="text-sm text-muted mt-2">Type in the field above to test live event listening.</p>
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
</article>
|
|
102
|
+
|
|
103
|
+
<script>
|
|
104
|
+
let count = ${initialCount};
|
|
105
|
+
const valEl = document.getElementById("counterVal");
|
|
106
|
+
const incBtn = document.getElementById("btnInc");
|
|
107
|
+
const decBtn = document.getElementById("btnDec");
|
|
108
|
+
const resetBtn = document.getElementById("btnReset");
|
|
109
|
+
const queryInput = document.getElementById("filterQuery");
|
|
110
|
+
const summaryEl = document.getElementById("summaryText");
|
|
111
|
+
|
|
112
|
+
const update = () => { if (valEl) valEl.textContent = String(count); };
|
|
113
|
+
incBtn?.addEventListener("click", () => { count++; update(); });
|
|
114
|
+
decBtn?.addEventListener("click", () => { if (count > 0) count--; update(); });
|
|
115
|
+
resetBtn?.addEventListener("click", () => { count = 0; update(); });
|
|
116
|
+
|
|
117
|
+
queryInput?.addEventListener("input", (e) => {
|
|
118
|
+
if (summaryEl) {
|
|
119
|
+
summaryEl.textContent = e.target.value
|
|
120
|
+
? "Active input: " + e.target.value
|
|
121
|
+
: "Type in the field above to test live event listening.";
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<article class="mt-6">
|
|
127
|
+
<header>
|
|
128
|
+
<h4 class="font-bold">Transition & Middleware Diagnostics</h4>
|
|
129
|
+
</header>
|
|
130
|
+
<div class="grid cols-3 gap-4 mt-4">
|
|
131
|
+
<div class="card">
|
|
132
|
+
<h5 class="font-bold mb-1">Stateful Navigation</h5>
|
|
133
|
+
<p class="text-sm">Click links between Home, About, and Dashboard. Notice how the View Transitions API animates without page refreshes while preserving session cookies.</p>
|
|
134
|
+
</div>
|
|
135
|
+
<div class="card">
|
|
136
|
+
<h5 class="font-bold mb-1">Zero Cache On Dashboard</h5>
|
|
137
|
+
<p class="text-sm">Response header <code>X-Bluebird-Cache: MISS</code> is returned, verifying that user-sensitive data is never statically cached.</p>
|
|
138
|
+
</div>
|
|
139
|
+
<div class="card">
|
|
140
|
+
<h5 class="font-bold mb-1">Automatic Revocation</h5>
|
|
141
|
+
<p class="text-sm">Clicking "Sign Out" revokes the session in memory/Redis and clears the HttpOnly cookie, blocking subsequent dashboard visits.</p>
|
|
142
|
+
</div>
|
|
143
|
+
</div>
|
|
144
|
+
</article>
|
|
145
|
+
</div>
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { html } from "@seip/bluebird-js/core/html.js";
|
|
2
|
+
|
|
3
|
+
export const layout = "main";
|
|
4
|
+
|
|
5
|
+
export const head = () => ({
|
|
6
|
+
title: "Blue Bird Framework — High Performance Web Framework",
|
|
7
|
+
description: "Fast, structured, and opinionated Express.js framework for visual elegance and performance.",
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Home page view module.
|
|
12
|
+
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
13
|
+
*/
|
|
14
|
+
export default function IndexView() {
|
|
15
|
+
return html`
|
|
16
|
+
<section class="hero">
|
|
17
|
+
<h1 class="mt-3 text-gradient font-bold">Hello, Developer!</h1>
|
|
18
|
+
<p class="lead">
|
|
19
|
+
Blue Bird is a fast, structured, and opinionated Express.js framework for developers who want
|
|
20
|
+
visual elegance and performance with raw HTML and modern JavaScript.
|
|
21
|
+
</p>
|
|
22
|
+
<div class="hero-actions">
|
|
23
|
+
<a href="/about" role="button">About Us →</a>
|
|
24
|
+
<a href="https://github.com/seip25/bluebird-js" target="_blank" role="button" class="outline">GitHub</a>
|
|
25
|
+
</div>
|
|
26
|
+
</section>
|
|
27
|
+
|
|
28
|
+
<div class="mt-8">
|
|
29
|
+
<div class="grid cols-3 gap-4">
|
|
30
|
+
<article class="hover-glow">
|
|
31
|
+
<header>
|
|
32
|
+
<span class="badge badge-primary mb-2">Rendering</span>
|
|
33
|
+
<h3 class="text-gradient-blue">Zero-Build JS Views</h3>
|
|
34
|
+
</header>
|
|
35
|
+
<p>Direct tagged template literal rendering (html\`...\`) with automatic XSS escaping, nested layouts, and multi-tier caching.</p>
|
|
36
|
+
</article>
|
|
37
|
+
|
|
38
|
+
<article class="hover-glow">
|
|
39
|
+
<header>
|
|
40
|
+
<span class="badge badge-primary mb-2">Performance</span>
|
|
41
|
+
<h3 class="text-gradient-blue">Multi-Tier Caching</h3>
|
|
42
|
+
</header>
|
|
43
|
+
<p>Configurable TTL caching. Rendered pages and fragments are stored in L1 RAM LRU, L2 Redis, or L3 persistent file cache.</p>
|
|
44
|
+
</article>
|
|
45
|
+
|
|
46
|
+
<article class="hover-glow">
|
|
47
|
+
<header>
|
|
48
|
+
<span class="badge badge-primary mb-2">Security</span>
|
|
49
|
+
<h3 class="text-gradient-blue">JWT & Route Security</h3>
|
|
50
|
+
</header>
|
|
51
|
+
<p>Secure cookie management, GCM-encrypted JWT tokens, custom security headers, and route rate limiting built-in.</p>
|
|
52
|
+
</article>
|
|
53
|
+
|
|
54
|
+
<article class="hover-glow">
|
|
55
|
+
<header>
|
|
56
|
+
<span class="badge badge-primary mb-2">Database</span>
|
|
57
|
+
<h3 class="text-gradient-blue">Unified DB Layer</h3>
|
|
58
|
+
</header>
|
|
59
|
+
<p>Built-in support for SQLite (native node:sqlite with WAL), MySQL, and PostgreSQL with connection pooling and caching.</p>
|
|
60
|
+
</article>
|
|
61
|
+
|
|
62
|
+
<article class="hover-glow">
|
|
63
|
+
<header>
|
|
64
|
+
<span class="badge badge-primary mb-2">DevOps</span>
|
|
65
|
+
<h3 class="text-gradient-blue">Production Ready</h3>
|
|
66
|
+
</header>
|
|
67
|
+
<p>Production cluster orchestration with PM2, native health checks, and smooth View Transitions SPA navigation.</p>
|
|
68
|
+
</article>
|
|
69
|
+
|
|
70
|
+
<article class="hover-glow">
|
|
71
|
+
<header>
|
|
72
|
+
<span class="badge badge-primary mb-2">Design</span>
|
|
73
|
+
<h3 class="text-gradient-blue">Pure Semantic CSS</h3>
|
|
74
|
+
</header>
|
|
75
|
+
<p>Clean semantic markup styled by <a href="https://seip25.github.io/Blue-bird-css/" target="_blank">Blue Bird CSS</a> with zero node compile steps.</p>
|
|
76
|
+
</article>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { html } from "@seip/bluebird-js/core/html.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Shared application layout for Bluebird.js.
|
|
5
|
+
* Provides the global HTML shell, header navigation, aside menu, and footer.
|
|
6
|
+
*
|
|
7
|
+
* @param {Object} context
|
|
8
|
+
* @param {import('@seip/bluebird-js/core/html.js').SafeHtml} context.body - Main content rendered by the view.
|
|
9
|
+
* @param {Object} context.head - Head metadata (title, description, canonical, etc.).
|
|
10
|
+
* @param {Object} context.ctx - Request context ({ req, res, user, locals }).
|
|
11
|
+
* @param {Object} context.data - View data props.
|
|
12
|
+
* @returns {import('@seip/bluebird-js/core/html.js').SafeHtml}
|
|
13
|
+
*/
|
|
14
|
+
export default function MainLayout({ body, head = {}, ctx = {} }) {
|
|
15
|
+
const currentPath = ctx.req?.path || "/";
|
|
16
|
+
const user = ctx.user || ctx.req?.user;
|
|
17
|
+
|
|
18
|
+
const isActive = (path) =>
|
|
19
|
+
currentPath === path ? "active badge badge-glow px-3 py-3" : "";
|
|
20
|
+
|
|
21
|
+
return html`<!DOCTYPE html>
|
|
22
|
+
<html lang="en" data-theme="dark">
|
|
23
|
+
<head>
|
|
24
|
+
<meta charset="UTF-8" />
|
|
25
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
26
|
+
<title>${head.title || "Blue Bird Framework"}</title>
|
|
27
|
+
<link rel="canonical" href="${head.canonical || "https://seip25.github.io/Blue-bird/"}" />
|
|
28
|
+
<meta name="description" content="${head.description || "Blue Bird is a fast, structured, and opinionated Express.js framework for developers who want visual elegance and performance with raw HTML and CSS."}" />
|
|
29
|
+
<meta name="keywords" content="${head.keywords || "Blue Bird, Express.js, Node.js, Semantic CSS, Performance, Nginx, Redis"}" />
|
|
30
|
+
<meta name="author" content="Seip25" />
|
|
31
|
+
<link rel="icon" href="/images/favicon.ico" />
|
|
32
|
+
<link rel="stylesheet" href="/css/bluebird.min.css" />
|
|
33
|
+
<script src="/js/bluebird-client.js" defer></script>
|
|
34
|
+
</head>
|
|
35
|
+
<body data-layout="main">
|
|
36
|
+
<header>
|
|
37
|
+
<nav>
|
|
38
|
+
<a href="/" class="flex items-center gap-2">
|
|
39
|
+
<svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="text-blue">
|
|
40
|
+
<path d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />
|
|
41
|
+
</svg>
|
|
42
|
+
<strong class="text-xl text-gradient">Blue Bird</strong>
|
|
43
|
+
</a>
|
|
44
|
+
</nav>
|
|
45
|
+
</header>
|
|
46
|
+
|
|
47
|
+
<main data-bb-outlet="true">
|
|
48
|
+
<aside>
|
|
49
|
+
<h4>Menu</h4>
|
|
50
|
+
<a href="/" class="${isActive("/")}">Home</a>
|
|
51
|
+
<a href="/about" class="${isActive("/about")}">About</a>
|
|
52
|
+
<a href="/login" class="${isActive("/login")}">Login</a>
|
|
53
|
+
<a href="/dashboard" class="${isActive("/dashboard")}">Dashboard</a>
|
|
54
|
+
<a href="https://seip25.github.io/Blue-bird" target="_blank">Blue bird</a>
|
|
55
|
+
<a href="https://seip25.github.io/Blue-bird-css/" target="_blank">Blue Bird CSS</a>
|
|
56
|
+
${user
|
|
57
|
+
? html`<a href="/logout" data-no-prefetch="true" role="button" class="btn-sm destructive mt-4">Sign Out</a>`
|
|
58
|
+
: html`<a href="https://github.com/seip25/bluebird-js" target="_blank" role="button" class="btn-sm outline">GitHub</a>`}
|
|
59
|
+
</aside>
|
|
60
|
+
|
|
61
|
+
<div class="page-content">
|
|
62
|
+
${body}
|
|
63
|
+
</div>
|
|
64
|
+
</main>
|
|
65
|
+
|
|
66
|
+
<footer>
|
|
67
|
+
<div class="footer-content">
|
|
68
|
+
<p>Powered by <strong class="text-gradient">Blue Bird Framework</strong>
|
|
69
|
+
</p>
|
|
70
|
+
<div class="lang-switcher">
|
|
71
|
+
<a href="/" class="lang-link">Home</a>
|
|
72
|
+
<a href="/about" class="lang-link">About</a>
|
|
73
|
+
<a href="/login" class="lang-link">Login</a>
|
|
74
|
+
<a href="/dashboard" class="lang-link">Dashboard</a>
|
|
75
|
+
<a href="https://github.com/seip25/bluebird-js" target="_blank" class="github-star mt-2">★ GitHub</a>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</footer>
|
|
79
|
+
</body>
|
|
80
|
+
</html>`;
|
|
81
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en" data-theme="dark">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>Terms of Service — Blue Bird</title>
|
|
6
|
+
<link rel="stylesheet" href="/css/bluebird.min.css">
|
|
7
|
+
</head>
|
|
8
|
+
<body class="p-8">
|
|
9
|
+
<article class="card">
|
|
10
|
+
<header>
|
|
11
|
+
<h1 class="text-gradient">Terms of Service</h1>
|
|
12
|
+
<p class="text-muted">Served directly as raw, unparsed HTML via Render.html().</p>
|
|
13
|
+
</header>
|
|
14
|
+
<div class="mt-4">
|
|
15
|
+
<p>This static document demonstrates zero-overhead static HTML serving without template interpolation or server computation.</p>
|
|
16
|
+
</div>
|
|
17
|
+
</article>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|