@seip/bluebird-js 0.1.4 → 0.1.6

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/README.md CHANGED
@@ -1,425 +1,602 @@
1
- # Bluebird.js Framework
2
-
3
- **Performance-first Node.js API and web framework with native JavaScript ESM, built-in Tailwind CSS, Inter fonts, declarative UI components, JWT auth, BaseModel, smart migrations, and multi-level caching.**
4
-
5
- [![npm version](https://img.shields.io/npm/v/@seip/bluebird-js.svg)](https://www.npmjs.com/package/@seip/bluebird-js)
6
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
- [![Node.js Version](https://img.shields.io/badge/node-%3E%3D22.18.0-brightgreen.svg)](https://nodejs.org)
8
-
9
- ---
10
-
11
- ## Introduction
12
-
13
- Bluebird.js (`@seip/bluebird-js`) is a high-performance web and API framework built on Express (Node.js 22.18+). It provides native modern JavaScript ESM execution, built-in Tailwind CSS v4 runtime and Google Fonts (`Inter`), zero-build SSR with React/Next.js-style component tags, multi-driver caching (in-memory LRU by default with filesystem and Redis support), AES-256-GCM encrypted JWT authentication, BaseModel schema definitions with smart migrations, CSRF protection, background queues, and PM2 production clustering into a cohesive developer experience.
14
-
15
- ### Key Highlights
16
-
17
- - **Native Zero-Build React JSX SSR (`app/views/*.jsx`):** Compiles `.jsx` modules in memory via Node 22.18+ `module.registerHooks()` with zero temporary disk files and zero build steps.
18
- - **Declarative Auto-Routes from Views:** Export `const route`, `const cache`, `const middlewares`, `const layout`, and `const seo` directly from `app/views/*.jsx` to mount cached, protected web routes automatically (`noAutoDiscoverRoutes: true` in `new App()` to disable).
19
- - **Client Islands with Anti-Accordion Skeletons (`<Client>` / `<Island>`):** SSR by default (0 KB client JS), with `<Client>` boundaries that lock dimensions (`minHeight`, `minWidth`) and render a `skeleton` to prevent layout shift (CLS).
20
- - **Built-In Tailwind CSS & Inter Font:** Includes the official standalone Tailwind CSS runtime (`/js/tailwind.js`) and Google Fonts `Inter` by default with zero configuration or compilers.
21
- - **Smart Automatic Migrations:** CLI detects schema changes across `app/models/`, resolves foreign key dependencies topologically, generates consolidated `CREATE TABLE` / `ALTER TABLE ADD COLUMN` SQL files, and executes them with interactive terminal prompts.
22
- - **Lightweight BaseModel:** Static facade providing readable schemas, CRUD shortcuts, query operators (`IN`, `$gt`, `$like`), `count()`, `exists()`, `firstOrCreate()`, `updateOrCreate()`, smart relations without N+1 queries, soft deletes, and automatic query cache invalidation.
23
- - **Native SQLite & Desktop Mode (Electron/Tauri):** Uses Node's built-in `node:sqlite` driver with zero compilation overhead, plus first-class `desktop: true` mode (`app.runDesktop()`) for read-only `.asar` bundles.
24
- - **Comprehensive Client UI Kit:** Built-in `bluebird-client.js` with toasts, snackbars, drawers, command palette (`Ctrl+K`), responsive data tables, tabs, carousels, declarative forms (`data-bb-form`), and View Transitions SPA routing.
25
- - **Decoupled Caching:** High-speed in-memory LRU cache by default, persistent filesystem fallback, and modular Redis support via `core/redis.js`.
26
- - **CSRF, Rate Limiting & Security:** Native HMAC-SHA256 signed CSRF protection, built-in Rate Limiter (`rateLimit` in `App` or `App.rateLimit()`), automatic `/sitemap.xml` & `/robots.txt` generation, and secure HTTP headers.
27
- - **Production Ready:** Built-in PM2 clustering CLI (`npx bluebird-js make:ecosystem`), optimized Nginx generator (`npx bluebird-js nginx:conf`), and native runner (`npm start`).
28
-
29
- ---
30
-
31
- ## Quick Start
32
-
33
- ### 1. Requirements
34
-
35
- - Node.js 22.18.0 or higher
36
- - npm 10+
37
-
38
- ### 2. Installation and Initialization
39
-
40
- ```bash
41
- npm install @seip/bluebird-js
42
- npx bluebird-js
43
- ```
44
-
45
- The interactive CLI configures:
46
- - Project title and port settings
47
- - Database engine: `sqlite` (default, native zero-configuration), `mysql`, `postgres`, or `none`
48
- - Connection credentials and database paths
49
- - Automatic generation of `index.js`, `.env`, `jsconfig.json`, `app/`, and `public/`
50
-
51
- ### 3. Development Server
52
-
53
- ```bash
54
- npm run dev
55
- ```
56
-
57
- The server starts with Node's native file watcher (`--watch`) and loads `.env` automatically via `--env-file=.env`.
58
-
59
- ---
60
-
61
- ## Project Structure
62
-
63
- ```
64
- project/
65
- ├── index.js # Main application entrypoint
66
- ├── app/
67
- │ ├── models/ # BaseModel definitions
68
- │ │ ├── user.js # User model schema & methods
69
- │ │ └── post.js # Post model schema & relations
70
- │ ├── routes/ # Application routes
71
- │ │ ├── api.js # REST API routes
72
- │ │ └── web.js # HTML page routes
73
- │ ├── views/ # React JSX (.jsx) & JavaScript (.js) SSR views
74
- │ │ ├── components/ # Reusable JSX components (e.g. Header.jsx)
75
- │ │ ├── layouts/ # Shared page layouts (e.g. main/view.jsx)
76
- │ │ ├── index.jsx # Public home view (Auto-Route: /)
77
- │ │ ├── about.jsx # About page view (Auto-Route: /about)
78
- │ │ ├── login.jsx # Sign-in page view (Auto-Route: /login)
79
- │ │ └── dashboard.jsx # Protected dashboard view (Auto-Route: /dashboard)
80
- │ └── jobs/ # Background worker job handlers
81
- ├── public/ # Public static assets (CSS, JS, images, fonts)
82
- │ ├── js/
83
- │ │ ├── tailwind.js # Built-in Tailwind CSS runtime
84
- │ │ └── bluebird-client.js # Client UI kit, View Transitions & SPA router
85
- │ └── images/
86
- ├── core/ # Bluebird.js framework core
87
- ├── database/ # SQLite storage and SQL migrations
88
- │ └── migrations/ # Version-controlled SQL migrations
89
- ├── .env # Environment variables
90
- └── package.json
91
- ```
92
-
93
- ---
94
-
95
- ## Core Features & Usage Examples
96
-
97
- ### 1. Application Entrypoint (`index.js`)
98
-
99
- ```javascript
100
- import App from "@seip/bluebird-js/core/app.js";
101
- import routerApi from "./app/routes/api.js";
102
- import routerWeb from "./app/routes/web.js";
103
-
104
- const app = new App({
105
- routes: [routerWeb, routerApi],
106
- port: process.env.PORT || 3000,
107
- rateLimit: { max: 120, windowMs: 60000 },
108
- });
109
-
110
- app.run();
111
- ```
112
-
113
- For **Electron / Desktop** applications:
114
-
115
- ```javascript
116
- const app = new App({
117
- desktop: true,
118
- userDataPath: electronApp.getPath("userData"),
119
- routes: [routerWeb, routerApi],
120
- });
121
-
122
- const { url, lanUrl } = await app.runDesktop({ allowLan: true });
123
- mainWindow.loadURL(url);
124
- ```
125
-
126
- ---
127
-
128
- ### 2. BaseModel & Smart Automatic Migrations (`app/models/`)
129
-
130
- #### Defining a Model (`app/models/user.js`)
131
-
132
- ```javascript
133
- import Model from "@seip/bluebird-js/core/model.js";
134
-
135
- export default class User extends Model {
136
- static table = "users";
137
- static primaryKey = "id";
138
- static timestamps = true;
139
- static softDelete = true;
140
-
141
- static schema = {
142
- id: { type: "int", primary: true, auto: true },
143
- name: { type: "string", length: 150, required: true },
144
- email: { type: "string", length: 150, unique: true, required: true, email: true },
145
- password: { type: "string", length: 255, required: true, min: 8, hidden: true, hash: true },
146
- role: { type: "string", length: 20, default: "user", in: ["user", "admin"] },
147
- };
148
- }
149
- ```
150
-
151
- #### Foreign Key References (`app/models/post.js`)
152
-
153
- ```javascript
154
- import Model from "@seip/bluebird-js/core/model.js";
155
-
156
- export default class Post extends Model {
157
- static table = "posts";
158
- static schema = {
159
- id: { type: "int", primary: true, auto: true },
160
- title: { type: "string", length: 200, required: true },
161
- content: { type: "text" },
162
- author_id: { type: "int", references: "users.id", onDelete: "cascade" },
163
- };
164
- }
165
- ```
166
-
167
- #### Powerful Query Methods
168
-
169
- ```javascript
170
- const totalUsers = await User.count({ role: "user" });
171
- const userExists = await User.exists({ email: "alice@example.com" });
172
-
173
- const activeUsers = await User.all({
174
- where: {
175
- id: [1, 2, 3],
176
- role: { $ne: "banned" },
177
- views: { $gt: 100 },
178
- },
179
- });
180
-
181
- const user = await User.firstOrCreate(
182
- { email: "john@example.com" },
183
- { name: "John Doe", role: "user" }
184
- );
185
-
186
- const updated = await User.updateOrCreate(
187
- { email: "john@example.com" },
188
- { name: "Johnathan Doe" }
189
- );
190
- ```
191
-
192
- #### Smart Automatic Migrations CLI
193
-
194
- When you create or modify models, simply run:
195
-
196
- ```bash
197
- npx bluebird-js make:migration
198
- ```
199
-
200
- Bluebird inspects your models in `app/models/`, connects to your database, sorts tables by foreign key dependencies topologically, and detects all missing tables and columns (`CREATE TABLE` and `ALTER TABLE ADD COLUMN`). It generates a consolidated SQL migration file and asks:
201
-
202
- ```
203
- [INFO] Detected database schema changes:
204
- + CREATE TABLE: users
205
- + CREATE TABLE: posts
206
- [OK] Migration created: database/migrations/20261022_120000_auto_migration.sql
207
- ? Do you want to execute pending migrations now? (Y/n):
208
- ```
209
-
210
- To run migrations directly without prompts (ideal for CI/CD):
211
- ```bash
212
- npx bluebird-js migrate --yes
213
- ```
214
-
215
- ---
216
-
217
- ### 3. React JSX SSR, Declarative Auto-Routes & `<Client>` Skeletons
218
-
219
- #### Default Tailwind CSS & Inter Typography
220
-
221
- The default layout (`app/views/layouts/main/view.jsx`) comes pre-wired with Google Fonts `Inter` and the standalone Tailwind CSS v4 runtime (`/js/tailwind.js`). You can write pure Tailwind utility classes immediately without running Vite, PostCSS, or Tailwind CLI.
222
-
223
- #### Native `.jsx` Views & Declarative Auto-Routes
224
-
225
- Bluebird compiles `.jsx` files in memory using Node's native module hooks (`core/jsx.js`)—no external bundler or disk temp files required. Even better, any view inside `app/views/` (excluding `layouts/`, `components/`, `partials/`, `islands/`, and `/api`) can export its own route configuration (`route`, `cache`, `middlewares`, `layout`, `seo`) and `App` mounts it automatically on startup (pass `noAutoDiscoverRoutes: true` to `new App()` if you prefer manual registration only):
226
-
227
- ```jsx
228
- // app/views/components/Header.jsx
229
- export default function Header({ title, user, count = 0 }) {
230
- return (
231
- <header className="flex items-center justify-between p-6 border-b border-slate-800">
232
- <div>
233
- <h1 className="text-2xl font-bold text-slate-100">{title}</h1>
234
- <p className="text-sm text-slate-400">Welcome back, {user?.name || "Guest"}</p>
235
- </div>
236
- <span className="px-3 py-1 rounded-full text-xs font-semibold bg-sky-500/10 text-sky-400 border border-sky-500/20">
237
- Notifications: {count}
238
- </span>
239
- </header>
240
- );
241
- }
242
- ```
243
-
244
- ```jsx
245
- // app/views/dashboard.jsx
246
- import Auth from "@seip/bluebird-js/core/auth.js";
247
- import Actions from "@seip/bluebird-js/core/actions.js";
248
- import { Client } from "@seip/bluebird-js/core/jsx.js";
249
- import Header from "./components/Header.jsx";
250
- import LiveCounter from "./components/LiveCounter.js";
251
-
252
- export const route = "/dashboard";
253
- export const layout = "main";
254
- export const middlewares = [Auth.protect({ redirect: "/login" })];
255
- export const seo = false;
256
- export const head = (data) => ({ title: `Dashboard — ${data.user?.name || "Member"}` });
257
-
258
- // Server Actions: automatic CSRF, 16KB maxBytes guard, prototype pollution filter & Validator schema
259
- export const actions = {
260
- syncCount: Actions.define(
261
- {
262
- maxBytes: "16kb",
263
- schema: { count: { required: true, number: true } },
264
- },
265
- async ({ body, user }) => {
266
- return { syncedCount: Number(body.count), updatedBy: user?.email };
267
- }
268
- ),
269
- };
270
-
271
- export default async function DashboardView({ user, syncedCount = 7 }) {
272
- return (
273
- <>
274
- <Header title="Protected Dashboard" user={user} count={syncedCount} />
275
-
276
- <div className="space-y-6 mt-6">
277
- {/* Reusable imported Client component with persistent state & anti-CLS skeleton */}
278
- <Client
279
- component={LiveCounter}
280
- props={{ initial: syncedCount }}
281
- persistent={true}
282
- minHeight={56}
283
- skeleton={
284
- <div className="h-14 rounded-xl bg-slate-900 animate-pulse flex items-center px-4 text-xs text-slate-400">
285
- Loading interactive widget...
286
- </div>
287
- }
288
- />
289
- </div>
290
- </>
291
- );
292
- }
293
- ```
294
-
295
- ---
296
-
297
- ### 4. Built-in Client UI Kit (`public/js/bluebird-client.js`)
298
-
299
- Bluebird includes a lightweight, dependency-free client UI toolkit with Tailwind CSS styles built right into `public/js/bluebird-client.js`:
300
-
301
- #### Toasts & Snackbars
302
-
303
- ```javascript
304
- toast({
305
- title: "Profile Updated",
306
- description: "Your settings have been saved successfully.",
307
- type: "success",
308
- position: "top-right",
309
- duration: 4000,
310
- });
311
-
312
- snackbar({ message: "Network connection restored", type: "info" });
313
- ```
314
-
315
- Or trigger them declaratively via HTML attributes:
316
- ```html
317
- <button data-toast="Settings saved successfully!" data-toast-type="success">Save</button>
318
- <button data-snackbar="Item deleted" data-snackbar-type="error">Delete</button>
319
- ```
320
-
321
- #### Drawers & Mobile Navigation
322
-
323
- ```html
324
- <button data-drawer-target="cartDrawer">Open Cart</button>
325
-
326
- <div id="cartDrawer" class="hidden fixed top-0 right-0 h-full w-80 bg-slate-900 p-6 z-50">
327
- <button data-drawer-close="cartDrawer" class="text-slate-400">&times;</button>
328
- <h3>Shopping Cart</h3>
329
- </div>
330
- ```
331
-
332
- #### Responsive Data Table (`ResponsiveDataTable`)
333
-
334
- Transforms tables dynamically into touch-friendly cards on mobile devices:
335
-
336
- ```javascript
337
- new ResponsiveDataTable("usersTableContainer", {
338
- columns: [
339
- { key: "id", label: "ID", sortable: true },
340
- { key: "name", label: "Name", sortable: true },
341
- { key: "email", label: "Email" },
342
- { key: "role", label: "Role" },
343
- ],
344
- data: usersList,
345
- searchable: true,
346
- pagination: true,
347
- pageSize: 10,
348
- onEdit: (row) => editUser(row.id),
349
- onDelete: (row) => deleteUser(row.id),
350
- });
351
- ```
352
-
353
- #### Declarative SPA Forms (`data-bb-form`)
354
-
355
- ```html
356
- <form action="/api/profile" method="POST" data-bb-form="true">
357
- <input type="text" name="name" required />
358
- <button type="submit">Update</button>
359
- </form>
360
- ```
361
- Submissions are automatically handled via `fetch`, CSRF tokens are injected, and toasts/redirects are handled seamlessly via View Transitions.
362
-
363
- #### Declarative DOM Helpers
364
-
365
- - `data-copy="Text to copy"`: Copies text to clipboard on click.
366
- - `data-confirm="Are you sure?"`: Confirms before link navigation or button click.
367
- - `data-toggle="theme"`: Switches between dark and light modes and updates the `dark` class on `<html>`.
368
- - `data-password-toggle="passwordFieldId"`: Toggles password visibility.
369
- - `data-filter-target="tableId"`: Live filters rows or cards matching input value.
370
-
371
- ---
372
-
373
- ### 5. Multi-Driver Caching (`core/cache.js`)
374
-
375
- ```javascript
376
- import Cache from "@seip/bluebird-js/core/cache.js";
377
-
378
- await Cache.set("metrics", { activeUsers: 450 }, 60, { driver: "memory" });
379
- const metrics = await Cache.get("metrics", { driver: "memory" });
380
-
381
- await Cache.set("report", htmlContent, 300, { driver: "file" });
382
- ```
383
-
384
- ---
385
-
386
- ### 6. Desktop Applications (Electron & Desktop Mode)
387
-
388
- Bluebird.js runs natively embedded inside **Electron** applications with ultra-fast boot (<200ms) and minimal RAM consumption (~25–40 MB vs ~300 MB with Nextron):
389
-
390
- - **Automatic Writable Paths:** Routes SQLite database, `logs/`, `app/cache/`, and file uploads (`Upload.storage()`) to `Config.userDataDir()` (`app.getPath("userData")`) to avoid read-only errors inside `.asar` archives.
391
- - **Dynamic Port & LAN / QR Access:** Binds to dynamic port `0` and generates LAN URLs (`allowLan: true`) for companion mobile/QR code access.
392
- - **Clean WAL Shutdown:** `await app.close()` truncates SQLite WAL and frees file locks cleanly on Windows/Mac/Linux.
393
-
394
- ```bash
395
- npx bluebird-js add electron
396
- ```
397
-
398
- ---
399
-
400
- ## Developer Tooling CLI
401
-
402
- ```bash
403
- npx bluebird-js doctor # Diagnostic audit and HTTP smoke tests
404
- npx bluebird-js make:model <Name> # Generates BaseModel class
405
- npx bluebird-js make:route <name> [--auth] # Scaffolds REST route
406
- npx bluebird-js make:view <name> [--ejs] # Scaffolds HTML/EJS template
407
- npx bluebird-js make:migration [name] # Smart auto-migration from app/models/
408
- npx bluebird-js make:migration --model <Model> # Generates migration for specific Model
409
- npx bluebird-js migrate [--yes] # Executes pending migrations
410
- npx bluebird-js migrate:status # Displays applied migration batches
411
- npx bluebird-js migrate:rollback # Reverts latest migration batch
412
- npx bluebird-js make:seed <name> # Creates database seed file
413
- npx bluebird-js seed # Executes database seeds
414
- npx bluebird-js nginx:conf [domain] [port] [root] # Generates Nginx reverse proxy configuration
415
- npx bluebird-js make:ecosystem [--start] # Generates PM2 clustering config
416
- npx bluebird-js add electron # Scaffolds Electron desktop app & desktop.js
417
- npx bluebird-js add react-islands # Scaffolds React Islands, Vite & Client Router
418
- npx bluebird-js add <module> # Installs optional on-demand package
419
- ```
420
-
421
- ---
422
-
423
- ## License
424
-
425
- MIT License. Copyright (c) 2026 Seip25.
1
+ # Bluebird.js Framework
2
+
3
+ **Performance-first Node.js API and web framework with native JavaScript ESM, built-in Tailwind CSS, Inter fonts, declarative UI components, JWT auth, BaseModel, smart migrations, and multi-level caching.**
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@seip/bluebird-js.svg)](https://www.npmjs.com/package/@seip/bluebird-js)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
7
+ [![Node.js Version](https://img.shields.io/badge/node-%3E%3D22.18.0-brightgreen.svg)](https://nodejs.org)
8
+
9
+ ---
10
+
11
+ ## Introduction
12
+
13
+ Bluebird.js (`@seip/bluebird-js`) is a high-performance web and API framework built on Express (Node.js 22.18+). It provides native modern JavaScript ESM execution, built-in Tailwind CSS v4 runtime and Google Fonts (`Inter`), zero-build SSR with React/Next.js-style component tags, multi-driver caching (in-memory LRU by default with filesystem and Redis support), AES-256-GCM encrypted JWT authentication, BaseModel schema definitions with smart migrations, CSRF protection, background queues, and PM2 production clustering into a cohesive developer experience.
14
+
15
+ ### Key Highlights
16
+
17
+ - **Native Zero-Build React JSX & TSX SSR (`app/views/*.jsx`, `*.tsx`):** Compiles `.jsx` and TypeScript `.tsx` modules in memory via Node 22.18+ `module.registerHooks()` with zero temporary disk files, automatic TypeScript type stripping, and zero build steps.
18
+ - **`<ErrorBoundary>` & Dynamic `<Head>` Hoisting:** Native JSX error boundary (`<ErrorBoundary fallback={...}>`) protects against subtree SSR errors, while `<Head>`, `<Title>`, and `<Meta>` automatically hoist metadata into the page head.
19
+ - **Streaming SSR with `<Suspense>` & Instant Caching:** Chunked progressive rendering (`Render.stream()`) with fallback skeletons and seamless deferred template swapping, automatically caching assembled output for instant cache HITs.
20
+ - **Client Components with `useAction` & `useActionState`:** Micro-reactive client runtime with standard hooks (`useState`, `useEffect`, `useAction`, `useActionState`, `html` tagged templates), plus anti-CLS layout locking (`minHeight`, `minWidth`) and automatic button/form pending states.
21
+ - **Declarative Auto-Routes from Views:** Export `const route`, `const cache`, `const middlewares`, `const layout`, and `const seo` directly from `app/views/*.jsx` or `*.tsx` to mount cached, protected web routes automatically (`noAutoDiscoverRoutes: true` in `new App()` to disable).
22
+ - **Built-In Tailwind CSS & Inter Font:** Includes the official standalone Tailwind CSS runtime (`/js/tailwind.js`) and Google Fonts `Inter` by default with zero configuration or compilers.
23
+ - **Smart Automatic Migrations:** CLI detects schema changes across `app/models/`, resolves foreign key dependencies topologically, generates consolidated `CREATE TABLE` / `ALTER TABLE ADD COLUMN` SQL files, and executes them with interactive terminal prompts.
24
+ - **Lightweight BaseModel:** Static facade providing readable schemas, CRUD shortcuts, query operators (`IN`, `$gt`, `$like`), `count()`, `exists()`, `firstOrCreate()`, `updateOrCreate()`, smart relations without N+1 queries, soft deletes, and automatic query cache invalidation.
25
+ - **Native SQLite & Desktop Mode (Electron/Tauri):** Uses Node's built-in `node:sqlite` driver with zero compilation overhead, plus first-class `desktop: true` mode (`app.runDesktop()`) for read-only `.asar` bundles.
26
+ - **Comprehensive Client UI Kit:** Built-in `bluebird-client.js` with toasts, snackbars, drawers, command palette (`Ctrl+K`), responsive data tables, tabs, carousels, declarative forms (`data-bb-form`), and View Transitions SPA routing.
27
+ - **Decoupled Caching:** High-speed in-memory LRU cache by default, persistent filesystem fallback, and modular Redis support via `core/redis.js`.
28
+ - **Unified AI Client (`core/ai.js`):** Native zero-dependency client with DeepSeek default (`deepseek-flash`), Gemini 3.5/3.8, and OpenAI, featuring reversible PII data masking, 0ms prompt caching, sliding window rate limits ("Anti-Quiebra"), and JSON schema validation.
29
+ - **Atomic Database Backups & Verification:** WAL-safe, non-blocking online SQLite snapshots using `VACUUM INTO` and gzip compression, with automated retention rotation (`--keep 10`) and integrity-verified restore.
30
+ - **CSRF, Rate Limiting & Security:** Native HMAC-SHA256 signed CSRF protection, built-in Rate Limiter (`rateLimit` in `App` or `App.rateLimit()`), automatic `/sitemap.xml` & `/robots.txt` generation, and secure HTTP headers.
31
+ - **Production Ready:** Built-in PM2 clustering CLI (`npx bluebird-js make:ecosystem`), optimized Nginx generator (`npx bluebird-js nginx:conf`), and native runner (`npm start`).
32
+
33
+ ---
34
+
35
+ ## Quick Start
36
+
37
+ ### 1. Requirements
38
+
39
+ - Node.js 22.18.0 or higher
40
+ - npm 10+
41
+
42
+ ### 2. Installation and Initialization
43
+
44
+ ```bash
45
+ npm install @seip/bluebird-js
46
+ npx bluebird-js
47
+ ```
48
+
49
+ The interactive CLI configures:
50
+ - Project title and port settings
51
+ - Database engine: `sqlite` (default, native zero-configuration), `mysql`, `postgres`, or `none`
52
+ - Connection credentials and database paths
53
+ - Automatic generation of `index.js`, `.env`, `jsconfig.json`, `app/`, and `public/`
54
+
55
+ ### 3. Development Server
56
+
57
+ ```bash
58
+ npm run dev
59
+ ```
60
+
61
+ The server starts with Node's native file watcher (`--watch`) and loads `.env` automatically via `--env-file=.env`.
62
+
63
+ ---
64
+
65
+ ## Project Structure
66
+
67
+ ```
68
+ project/
69
+ ├── index.js # Main application entrypoint
70
+ ├── app/
71
+ │ ├── models/ # BaseModel definitions
72
+ │ │ ├── user.js # User model schema & methods
73
+ │ │ └── post.js # Post model schema & relations
74
+ │ ├── routes/ # Application routes
75
+ │ │ ├── api.js # REST API routes
76
+ │ │ └── web.js # HTML page routes
77
+ │ ├── views/ # React JSX (.jsx) & JavaScript (.js) SSR views
78
+ │ │ ├── components/ # Reusable JSX components (e.g. Header.jsx)
79
+ │ │ ├── layouts/ # Shared page layouts (e.g. main/view.jsx)
80
+ │ │ ├── index.jsx # Public home view (Auto-Route: /)
81
+ │ │ ├── about.jsx # About page view (Auto-Route: /about)
82
+ │ │ ├── login.jsx # Sign-in page view (Auto-Route: /login)
83
+ │ │ └── dashboard.jsx # Protected dashboard view (Auto-Route: /dashboard)
84
+ │ └── jobs/ # Background worker job handlers
85
+ ├── public/ # Public static assets (CSS, JS, images, fonts)
86
+ │ ├── js/
87
+ │ │ ├── tailwind.js # Built-in Tailwind CSS runtime
88
+ │ │ └── bluebird-client.js # Client UI kit, View Transitions & SPA router
89
+ │ └── images/
90
+ ├── core/ # Bluebird.js framework core
91
+ ├── database/ # SQLite storage and SQL migrations
92
+ │ └── migrations/ # Version-controlled SQL migrations
93
+ ├── .env # Environment variables
94
+ └── package.json
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Core Features & Usage Examples
100
+
101
+ ### 1. Application Entrypoint (`index.js`)
102
+
103
+ ```javascript
104
+ import App from "@seip/bluebird-js/core/app.js";
105
+ import routerApi from "./app/routes/api.js";
106
+ import routerWeb from "./app/routes/web.js";
107
+
108
+ const app = new App({
109
+ routes: [routerWeb, routerApi],
110
+ port: process.env.PORT || 3000,
111
+ rateLimit: { max: 120, windowMs: 60000 },
112
+ });
113
+
114
+ app.run();
115
+ ```
116
+
117
+ For **Electron / Desktop** applications:
118
+
119
+ ```javascript
120
+ const app = new App({
121
+ desktop: true,
122
+ userDataPath: electronApp.getPath("userData"),
123
+ routes: [routerWeb, routerApi],
124
+ });
125
+
126
+ const { url, lanUrl } = await app.runDesktop({ allowLan: true });
127
+ mainWindow.loadURL(url);
128
+ ```
129
+
130
+ ---
131
+
132
+ ### 2. BaseModel & Smart Automatic Migrations (`app/models/`)
133
+
134
+ #### Defining a Model (`app/models/user.js`)
135
+
136
+ ```javascript
137
+ import Model from "@seip/bluebird-js/core/model.js";
138
+
139
+ export default class User extends Model {
140
+ static table = "users";
141
+ static primaryKey = "id";
142
+ static timestamps = true;
143
+ static softDelete = true;
144
+
145
+ static schema = {
146
+ id: { type: "int", primary: true, auto: true },
147
+ name: { type: "string", length: 150, required: true },
148
+ email: { type: "string", length: 150, unique: true, required: true, email: true },
149
+ password: { type: "string", length: 255, required: true, min: 8, hidden: true, hash: true },
150
+ role: { type: "string", length: 20, default: "user", in: ["user", "admin"] },
151
+ };
152
+ }
153
+ ```
154
+
155
+ #### Foreign Key References (`app/models/post.js`)
156
+
157
+ ```javascript
158
+ import Model from "@seip/bluebird-js/core/model.js";
159
+
160
+ export default class Post extends Model {
161
+ static table = "posts";
162
+ static schema = {
163
+ id: { type: "int", primary: true, auto: true },
164
+ title: { type: "string", length: 200, required: true },
165
+ content: { type: "text" },
166
+ author_id: { type: "int", references: "users.id", onDelete: "cascade" },
167
+ };
168
+ }
169
+ ```
170
+
171
+ #### Powerful Query Methods
172
+
173
+ ```javascript
174
+ const totalUsers = await User.count({ role: "user" });
175
+ const userExists = await User.exists({ email: "alice@example.com" });
176
+
177
+ const activeUsers = await User.all({
178
+ where: {
179
+ id: [1, 2, 3],
180
+ role: { $ne: "banned" },
181
+ views: { $gt: 100 },
182
+ },
183
+ });
184
+
185
+ const user = await User.firstOrCreate(
186
+ { email: "john@example.com" },
187
+ { name: "John Doe", role: "user" }
188
+ );
189
+
190
+ const updated = await User.updateOrCreate(
191
+ { email: "john@example.com" },
192
+ { name: "Johnathan Doe" }
193
+ );
194
+ ```
195
+
196
+ #### Smart Automatic Migrations CLI
197
+
198
+ When you create or modify models, simply run:
199
+
200
+ ```bash
201
+ npx bluebird-js make:migration
202
+ ```
203
+
204
+ Bluebird inspects your models in `app/models/`, connects to your database, sorts tables by foreign key dependencies topologically, and detects all missing tables and columns (`CREATE TABLE` and `ALTER TABLE ADD COLUMN`). It generates a consolidated SQL migration file and asks:
205
+
206
+ ```
207
+ [INFO] Detected database schema changes:
208
+ + CREATE TABLE: users
209
+ + CREATE TABLE: posts
210
+ [OK] Migration created: database/migrations/20261022_120000_auto_migration.sql
211
+ ? Do you want to execute pending migrations now? (Y/n):
212
+ ```
213
+
214
+ To run migrations directly without prompts (ideal for CI/CD):
215
+ ```bash
216
+ npx bluebird-js migrate --yes
217
+ ```
218
+
219
+ ---
220
+
221
+ ### 3. React JSX SSR, Declarative Auto-Routes & `<Client>` Skeletons
222
+
223
+ #### Default Tailwind CSS & Inter Typography
224
+
225
+ The default layout (`app/views/layouts/main/view.jsx`) comes pre-wired with Google Fonts `Inter` and the standalone Tailwind CSS v4 runtime (`/js/tailwind.js`). You can write pure Tailwind utility classes immediately without running Vite, PostCSS, or Tailwind CLI.
226
+
227
+ #### Native `.jsx` Views & Declarative Auto-Routes
228
+
229
+ Bluebird compiles `.jsx` files in memory using Node's native module hooks (`core/jsx.js`)—no external bundler or disk temp files required. Even better, any view inside `app/views/` (excluding `layouts/`, `components/`, `partials/`, `islands/`, and `/api`) can export its own route configuration (`route`, `cache`, `middlewares`, `layout`, `seo`) and `App` mounts it automatically on startup (pass `noAutoDiscoverRoutes: true` to `new App()` if you prefer manual registration only):
230
+
231
+ ```jsx
232
+ // app/views/components/Header.jsx
233
+ export default function Header({ title, user, count = 0 }) {
234
+ return (
235
+ <header className="flex items-center justify-between p-6 border-b border-slate-800">
236
+ <div>
237
+ <h1 className="text-2xl font-bold text-slate-100">{title}</h1>
238
+ <p className="text-sm text-slate-400">Welcome back, {user?.name || "Guest"}</p>
239
+ </div>
240
+ <span className="px-3 py-1 rounded-full text-xs font-semibold bg-sky-500/10 text-sky-400 border border-sky-500/20">
241
+ Notifications: {count}
242
+ </span>
243
+ </header>
244
+ );
245
+ }
246
+ ```
247
+
248
+ ```jsx
249
+ // app/views/dashboard.jsx
250
+ import Auth from "@seip/bluebird-js/core/auth.js";
251
+ import Actions from "@seip/bluebird-js/core/actions.js";
252
+ import { Client } from "@seip/bluebird-js/core/jsx.js";
253
+ import Header from "./components/Header.jsx";
254
+ import LiveCounter from "./components/LiveCounter.js";
255
+
256
+ export const route = "/dashboard";
257
+ export const layout = "main";
258
+ export const middlewares = [Auth.protect({ redirect: "/login" })];
259
+ export const seo = false;
260
+ export const head = (data) => ({ title: `Dashboard — ${data.user?.name || "Member"}` });
261
+
262
+ // Server Actions: automatic CSRF, 16KB maxBytes guard, prototype pollution filter & Validator schema
263
+ export const actions = {
264
+ syncCount: Actions.define(
265
+ {
266
+ maxBytes: "16kb",
267
+ schema: { count: { required: true, number: true } },
268
+ },
269
+ async ({ body, user }) => {
270
+ return { syncedCount: Number(body.count), updatedBy: user?.email };
271
+ }
272
+ ),
273
+ };
274
+
275
+ export default async function DashboardView({ user, syncedCount = 7 }) {
276
+ return (
277
+ <>
278
+ <Header title="Protected Dashboard" user={user} count={syncedCount} />
279
+
280
+ <div className="space-y-6 mt-6">
281
+ {/* Reusable imported Client component with persistent state & anti-CLS skeleton */}
282
+ <Client
283
+ component={LiveCounter}
284
+ props={{ initial: syncedCount }}
285
+ persistent={true}
286
+ minHeight={56}
287
+ skeleton={
288
+ <div className="h-14 rounded-xl bg-slate-900 animate-pulse flex items-center px-4 text-xs text-slate-400">
289
+ Loading interactive widget...
290
+ </div>
291
+ }
292
+ />
293
+ </div>
294
+ </>
295
+ );
296
+ }
297
+ ```
298
+
299
+ #### Reactive Client Components & `useAction` (`LiveCounter.jsx`)
300
+
301
+ Client components run in the browser using Bluebird's micro-reactive runtime with hooks (`useState`, `useEffect`, `useAction`, `useActionState`, `useRef`, `html` tagged templates). You can invoke Server Actions or standard API endpoints and handle native DOM events with standard `event.preventDefault()`:
302
+
303
+ ```jsx
304
+ // app/views/components/LiveCounter.jsx
305
+ import { useState, useEffect, useAction } from "@seip/bluebird-js/core/jsx.js";
306
+ import { html } from "@seip/bluebird-js/core/html.js";
307
+
308
+ export default function LiveCounter({ initial = 7, label = "Client Counter" }) {
309
+ const [count, setCount] = useState(Number(initial) || 0);
310
+ const [sync, isPending] = useAction("syncCount", {
311
+ onSuccess(res) {
312
+ window.toast?.({ title: "Synced", description: res.data.message });
313
+ },
314
+ });
315
+
316
+ const actualizarDashboard = (event) => {
317
+ event.preventDefault(); // Native DOM event support
318
+ sync({ count }); // Dispatches Server Action with pending states
319
+ };
320
+
321
+ return html`
322
+ <div class="h-14 rounded-xl border border-slate-800 bg-slate-950/90 px-4 flex items-center justify-between">
323
+ <span class="text-xs text-slate-300">${label}: <strong class="text-sky-400 font-mono">${count}</strong></span>
324
+ <div class="flex items-center gap-2">
325
+ <button type="button" onClick=${() => setCount(count + 1)} class="px-2.5 py-1 bg-sky-500 rounded text-xs font-bold text-slate-950">+1</button>
326
+ <button type="button" onClick=${actualizarDashboard} disabled=${isPending} class="px-2.5 py-1 bg-emerald-500/15 border border-emerald-500/30 rounded text-xs text-emerald-300">
327
+ ${isPending ? "Syncing..." : "Sync Server Action"}
328
+ </button>
329
+ </div>
330
+ </div>
331
+ `;
332
+ }
333
+ ```
334
+
335
+ #### `<ErrorBoundary>` & Dynamic `<Head>` Hoisting
336
+
337
+ Catch rendering errors during SSR in subtrees and hoist metadata directly into the document `<head>`:
338
+
339
+ ```jsx
340
+ import { ErrorBoundary, Head, Title, Meta } from "@seip/bluebird-js/core/jsx.js";
341
+
342
+ export default function ProfilePage({ user }) {
343
+ return (
344
+ <>
345
+ <Head>
346
+ <Title>Profile — {user.name}</Title>
347
+ <Meta name="robots" content="noindex,nofollow" />
348
+ </Head>
349
+
350
+ <ErrorBoundary fallback={(err) => <div className="p-4 bg-red-950 text-red-400 rounded-xl">Error: {err.message}</div>}>
351
+ <UserProfileWidget userId={user.id} />
352
+ </ErrorBoundary>
353
+ </>
354
+ );
355
+ }
356
+ ```
357
+
358
+ #### Streaming SSR with `<Suspense>` & Instant Cache HIT
359
+
360
+ Stream progressive chunked HTML responses with immediate skeletons. If route cache is enabled (`cache: 60`), cache misses stream progressively while caching the assembled final HTML, and subsequent requests are served as **instant Cache HITs** without streaming overhead:
361
+
362
+ ```jsx
363
+ import { Suspense } from "@seip/bluebird-js/core/jsx.js";
364
+
365
+ export const cache = 60; // Subsequent hits served instantly from RAM LRU
366
+
367
+ export default function FeedPage() {
368
+ return (
369
+ <div>
370
+ <h1>Live Activity</h1>
371
+ <Suspense fallback={<div className="h-40 animate-pulse bg-slate-900 rounded-xl">Loading feed...</div>}>
372
+ <AsyncFeedList />
373
+ </Suspense>
374
+ </div>
375
+ );
376
+ }
377
+ ```
378
+
379
+ #### Zero-Build TypeScript & TSX Support (`.tsx`, `.ts`)
380
+
381
+ Write views and components directly in TypeScript. Bluebird strips type annotations natively in memory using Node's native module customization hooks with zero build steps and zero disk temp files:
382
+
383
+ ```tsx
384
+ // app/views/components/UserCard.tsx
385
+ interface UserProps {
386
+ id: number;
387
+ name: string;
388
+ role: "admin" | "member";
389
+ }
390
+
391
+ export default function UserCard({ id, name, role }: UserProps): any {
392
+ return (
393
+ <div className="user-card" data-id={id}>
394
+ <strong>{name}</strong> <span>({role})</span>
395
+ </div>
396
+ );
397
+ }
398
+ ```
399
+
400
+ ---
401
+
402
+ ### 4. Built-in Client UI Kit (`public/js/bluebird-client.js`)
403
+
404
+ Bluebird includes a lightweight, dependency-free client UI toolkit with Tailwind CSS styles built right into `public/js/bluebird-client.js`:
405
+
406
+ #### Toasts & Snackbars
407
+
408
+ ```javascript
409
+ toast({
410
+ title: "Profile Updated",
411
+ description: "Your settings have been saved successfully.",
412
+ type: "success",
413
+ position: "top-right",
414
+ duration: 4000,
415
+ });
416
+
417
+ snackbar({ message: "Network connection restored", type: "info" });
418
+ ```
419
+
420
+ Or trigger them declaratively via HTML attributes:
421
+ ```html
422
+ <button data-toast="Settings saved successfully!" data-toast-type="success">Save</button>
423
+ <button data-snackbar="Item deleted" data-snackbar-type="error">Delete</button>
424
+ ```
425
+
426
+ #### Drawers & Mobile Navigation
427
+
428
+ ```html
429
+ <button data-drawer-target="cartDrawer">Open Cart</button>
430
+
431
+ <div id="cartDrawer" class="hidden fixed top-0 right-0 h-full w-80 bg-slate-900 p-6 z-50">
432
+ <button data-drawer-close="cartDrawer" class="text-slate-400">&times;</button>
433
+ <h3>Shopping Cart</h3>
434
+ </div>
435
+ ```
436
+
437
+ #### Responsive Data Table (`ResponsiveDataTable`)
438
+
439
+ Transforms tables dynamically into touch-friendly cards on mobile devices:
440
+
441
+ ```javascript
442
+ new ResponsiveDataTable("usersTableContainer", {
443
+ columns: [
444
+ { key: "id", label: "ID", sortable: true },
445
+ { key: "name", label: "Name", sortable: true },
446
+ { key: "email", label: "Email" },
447
+ { key: "role", label: "Role" },
448
+ ],
449
+ data: usersList,
450
+ searchable: true,
451
+ pagination: true,
452
+ pageSize: 10,
453
+ onEdit: (row) => editUser(row.id),
454
+ onDelete: (row) => deleteUser(row.id),
455
+ });
456
+ ```
457
+
458
+ #### Declarative SPA Forms (`data-bb-form`)
459
+
460
+ ```html
461
+ <form action="/api/profile" method="POST" data-bb-form="true">
462
+ <input type="text" name="name" required />
463
+ <button type="submit">Update</button>
464
+ </form>
465
+ ```
466
+ Submissions are automatically handled via `fetch`, CSRF tokens are injected, and toasts/redirects are handled seamlessly via View Transitions.
467
+
468
+ #### Declarative DOM Helpers
469
+
470
+ - `data-copy="Text to copy"`: Copies text to clipboard on click.
471
+ - `data-confirm="Are you sure?"`: Confirms before link navigation or button click.
472
+ - `data-toggle="theme"`: Switches between dark and light modes and updates the `dark` class on `<html>`.
473
+ - `data-password-toggle="passwordFieldId"`: Toggles password visibility.
474
+ - `data-filter-target="tableId"`: Live filters rows or cards matching input value.
475
+
476
+ ---
477
+
478
+ ### 5. Multi-Driver Caching (`core/cache.js`)
479
+
480
+ ```javascript
481
+ import Cache from "@seip/bluebird-js/core/cache.js";
482
+
483
+ await Cache.set("metrics", { activeUsers: 450 }, 60, { driver: "memory" });
484
+ const metrics = await Cache.get("metrics", { driver: "memory" });
485
+
486
+ await Cache.set("report", htmlContent, 300, { driver: "file" });
487
+ ```
488
+
489
+ ---
490
+
491
+ ### 6. Desktop Applications (Electron & Desktop Mode)
492
+
493
+ Bluebird.js runs natively embedded inside **Electron** applications with ultra-fast boot (<200ms) and minimal RAM consumption (~25–40 MB vs ~300 MB with Nextron):
494
+
495
+ - **Automatic Writable Paths:** Routes SQLite database, `logs/`, `app/cache/`, and file uploads (`Upload.storage()`) to `Config.userDataDir()` (`app.getPath("userData")`) to avoid read-only errors inside `.asar` archives.
496
+ - **Dynamic Port & LAN / QR Access:** Binds to dynamic port `0` and generates LAN URLs (`allowLan: true`) for companion mobile/QR code access.
497
+ - **Clean WAL Shutdown:** `await app.close()` truncates SQLite WAL and frees file locks cleanly on Windows/Mac/Linux.
498
+
499
+ ```bash
500
+ npx bluebird-js add electron
501
+ ```
502
+
503
+ ---
504
+
505
+ ### 7. Unified AI Client (`core/ai.js`)
506
+
507
+ Native zero-dependency AI client supporting **DeepSeek (default)**, **Google Gemini**, and **OpenAI** with reversible PII data masking, 0ms prompt caching, sliding window rate limits, and JSON schema validation:
508
+
509
+ - **DeepSeek by Default (`deepseek-flash`):** Default endpoint `https://api.deepseek.com`, served by DeepSeek-V4.1-Flash-1017 (legacy names `deepseek-v4-flash`, `deepseek-chat` supported). Optional thinking mode (`thinking: { type: "enabled" }`, `reasoningEffort: "high"`).
510
+ - **Google Gemini & OpenAI:** Built-in REST connectors for `gemini-3.5-flash`, `gemini-3.8-flash`, `gemini-2.5-flash`, `gpt-4o-mini`, and custom endpoints via `baseURL`.
511
+ - **Accurate Real IP Detection (`getClientIp`):** Resolves real visitor IPs across Cloudflare (`cf-connecting-ip`, `true-client-ip`), Nginx (`x-real-ip`), proxy chains (`x-forwarded-for`), and cleans IPv6 mappings.
512
+ - **Reversible PII Masking:** Replaces sensitive user keys (`name`, `email`, `dni`, etc.) with anonymous tokens (`[name_01]`, `[email_01]`) before transmission, restoring original values in responses.
513
+ - **0ms Prompt Cache Hit:** Computes cache hashes on *anonymized* prompts so multiple users querying identical prompt templates trigger an immediate $0 / 0ms Cache Hit.
514
+ - **Rate Limit Protection ("Anti-Quiebra"):** Configurable per-minute/per-day sliding windows (e.g. `{ minute: 6, day: 30 }`), returning clean HTTP 429 errors via `ai.protect()` middleware before depleting API budget.
515
+
516
+ ```javascript
517
+ import AI, { ai } from "@seip/bluebird-js/core/ai.js";
518
+
519
+ const supportAi = new AI({
520
+ provider: "deepseek", // "deepseek" (default) | "gemini" | "openai" | "custom"
521
+ model: "deepseek-flash",
522
+ rateLimit: { minute: 6, day: 30 }, // Sliding window rate limit
523
+ cacheTtl: 3600, // Cache responses for 1 hour
524
+ });
525
+
526
+ routerApi.post("/support/reply", supportAi.protect(), async (req, res) => {
527
+ const result = await supportAi.ask("Draft a courteous support reply for this user:", {
528
+ data: {
529
+ name: "Maria Garcia",
530
+ email: "maria@example.com",
531
+ dni: "45123987",
532
+ issue: "I would like to update my billing details",
533
+ },
534
+ sensitiveKeys: ["name", "email", "dni"], // Masked before leaving server!
535
+ request: req, // Automatic IP rate limiting
536
+ json: true,
537
+ });
538
+
539
+ // result.text is returned fully restored with 'Maria Garcia' and 'maria@example.com'!
540
+ res.ok(result);
541
+ });
542
+
543
+ // Real-time streaming directly to client response via Server-Sent Events (SSE)
544
+ routerApi.post("/support/stream", async (req, res) => {
545
+ await supportAi.pipe(res, req.body.message, { sse: true, request: req });
546
+ });
547
+
548
+ // Or iterate chunks manually via async generator
549
+ for await (const chunk of supportAi.askStream("Explain quantum computing in simple terms")) {
550
+ process.stdout.write(chunk.text);
551
+ }
552
+ ```
553
+
554
+ ---
555
+
556
+ ### 8. Atomic Database Backups & Verification (`core/database.js`)
557
+
558
+ WAL-safe, non-blocking snapshots for SQLite using `VACUUM INTO` and gzip compression, with automated retention rotation and integrity-verified restore:
559
+
560
+ ```javascript
561
+ import Database from "@seip/bluebird-js/core/database.js";
562
+
563
+ // Atomic, WAL-safe gzip backup with retention rotation (keeps latest 10)
564
+ const backup = await Database.backup({ out: "database/backups", keep: 10, compress: true });
565
+
566
+ // Integrity-verified restore with pre-restore safety snapshot
567
+ await Database.restore("database/backups/backup-sqlite-2026-11-03_170000_123.db.gz", {
568
+ safetyBackup: true,
569
+ verify: true,
570
+ });
571
+ ```
572
+
573
+ ---
574
+
575
+ ## Developer Tooling CLI
576
+
577
+ ```bash
578
+ npx bluebird-js doctor # Diagnostic audit and HTTP smoke tests
579
+ npx bluebird-js make:model <Name> # Generates BaseModel class
580
+ npx bluebird-js make:route <name> [--auth] # Scaffolds REST route
581
+ npx bluebird-js make:view <name> [--ejs] # Scaffolds HTML/EJS template
582
+ npx bluebird-js make:migration [name] # Smart auto-migration from app/models/
583
+ npx bluebird-js make:migration --model <Model> # Generates migration for specific Model
584
+ npx bluebird-js migrate [--yes] # Executes pending migrations
585
+ npx bluebird-js migrate:status # Displays applied migration batches
586
+ npx bluebird-js migrate:rollback # Reverts latest migration batch
587
+ npx bluebird-js make:seed <name> # Creates database seed file
588
+ npx bluebird-js seed # Executes database seeds
589
+ npx bluebird-js db:backup [--keep 10] [--out dir] # Compressed WAL-safe database backup with retention rotation
590
+ npx bluebird-js db:restore <file> [--yes] # Safe database restore with pre-backup & integrity check
591
+ npx bluebird-js nginx:conf [domain] [port] [root] # Generates Nginx reverse proxy configuration
592
+ npx bluebird-js make:ecosystem [--start] # Generates PM2 clustering config
593
+ npx bluebird-js add electron # Scaffolds Electron desktop app & desktop.js
594
+ npx bluebird-js add react-islands # Scaffolds React Islands, Vite & Client Router
595
+ npx bluebird-js add <module> # Installs optional on-demand package
596
+ ```
597
+
598
+ ---
599
+
600
+ ## License
601
+
602
+ MIT License. Copyright (c) 2026 Seip25.