@seip/blue-bird 0.6.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 ADDED
@@ -0,0 +1,38 @@
1
+ # Server and Application Configuration
2
+ DEBUG=false
3
+ PORT=3000
4
+ HOST="localhost"
5
+ APP_URL="http://localhost"
6
+ STATIC_PATH="frontend/public"
7
+ VERSION="1.0.0"
8
+ BLUEBIRD_PROJECT_NAME="bluebird"
9
+
10
+ #Docker /Swagger config
11
+ TITLE="Blue-Bird"
12
+ DESCRIPTION="Description project"
13
+
14
+ # HTML Meta / SEO Configuration
15
+ TITLE_META="Blue Bird"
16
+ DESCRIPTION_META="Example description meta"
17
+ KEYWORDS_META="Example keywords meta"
18
+ AUTHOR_META="Blue Bird"
19
+ LANGMETA="en"
20
+
21
+ # Security Configuration
22
+ JWT_SECRET="JWT_SECRET"
23
+
24
+ # Database Configuration (Used only for local development outside Docker)
25
+ # SQLite (Default)
26
+ DATABASE_URL="file:./dev.db"
27
+
28
+ # MySQL (Uncomment to use MySQL locally or DEV)
29
+ # DATABASE_URL="mysql://root:root@localhost:3306/blue_bird"
30
+
31
+ # PostgreSQL (Uncomment to use PostgreSQL locally or DEV)
32
+ # DATABASE_URL="postgresql://root:root@localhost:5432/blue_bird?schema=public"
33
+
34
+ # Database / Docker Configuration
35
+ DB_NAME="blue_bird"
36
+ DB_USER="root"
37
+ DB_PASSWORD="root"
38
+ DB_PORT=3306
package/AGENTS.md ADDED
@@ -0,0 +1,276 @@
1
+ # Blue Bird Framework - AI Agent Guide
2
+
3
+ This document serves as the primary manual for any AI Agent interacting with the codebase. It details the architecture of Blue Bird, its internal modules, and how features should be written or modified.
4
+
5
+ ## 1. Core Architecture
6
+
7
+ Blue Bird is a framework built on **Express** for backend and **HTML/Tailwind CSS/JS** for frontend rendering. It saves developers from repetitive configuration, validation, security, JWT authentication, HTML rendering with caching, and automatic HTML minification and compression out of the box.
8
+
9
+ - **Backend (`backend/`)**: Initializes the server using `App` from `core/app.js` and invokes routing from `backend/routes/`.
10
+ - **Frontend (`frontend/`)**: Static HTML views (`.html`) and static assets. Static files go in `frontend/public/`.
11
+ - **Core (`core/`)**: The framework core. Contains wrapper classes such as `Router`, `Validator`, `Template`, `Auth`, `Cache`, etc. **DO NOT MODIFY** the core unless explicitly requested, as it could break other apps.
12
+
13
+ ## 2. Routing (Router)
14
+
15
+ Do not use Express' native router (`express.Router()`). Always use Blue Bird's `Router` wrapper.
16
+
17
+ ```javascript
18
+ import Router from "@seip/blue-bird/core/router.js";
19
+
20
+ const routerApi = new Router("/api");
21
+
22
+ routerApi.get("/users", (req, res) => {
23
+ res.json({ users: [] });
24
+ });
25
+
26
+ export default routerApi;
27
+ ```
28
+
29
+ **For the Frontend (HTML Rendering / SEO):**
30
+ Blue Bird renders HTML templates directly using its `Template` class.
31
+
32
+ ```javascript
33
+ import Router from "@seip/blue-bird/core/router.js";
34
+ import Template from "@seip/blue-bird/core/template.js";
35
+
36
+ const router = new Router("/", { seo: true });
37
+
38
+ router.get("/", (req, res) => {
39
+ return Template.render(res, "index", {
40
+ metaTags: {
41
+ titleMeta: "Home",
42
+ descriptionMeta: "Welcome to my site",
43
+ },
44
+ });
45
+ });
46
+
47
+ router.get("/about", (req, res) => {
48
+ return Template.render(res, "about", {
49
+ metaTags: {
50
+ titleMeta: "About Us",
51
+ descriptionMeta: "Learn more about us",
52
+ },
53
+ });
54
+ });
55
+ ```
56
+
57
+ **SEO (Sitemap & Robots.txt):**
58
+ When a `Router` is created with `{ seo: true }`, all `GET` routes registered on it are automatically included in the generated `/sitemap.xml` and `/robots.txt`.
59
+
60
+ ```javascript
61
+ const router = new Router("/", { seo: true });
62
+ ```
63
+
64
+ - **Automatic Sitemap:** Dynamic `sitemap.xml` with all routes from `seo: true` routers.
65
+ - **Robots.txt:** Auto-served pointing to the generated sitemap.
66
+
67
+ ## 3. HTML View Rendering (Template)
68
+
69
+ The `Template` class renders HTML files directly from the `frontend/` directory. It resolves placeholders in the HTML files (using double curly braces `{{variable}}`) populated by the options, metaTags, and application configurations.
70
+
71
+ ### Standard Placeholders
72
+
73
+ The renderer automatically replaces the following standard tags:
74
+
75
+ - `{{lang}}` or `{{langHtml}}`: Active language code (defaults to `"en"`).
76
+ - `{{title}}` or `{{titleMeta}}`: Page title.
77
+ - `{{canonicalUrl}}`: Canonical page link.
78
+ - `{{description}}` or `{{descriptionMeta}}`: Meta description text.
79
+ - `{{keywords}}` or `{{keywordsMeta}}`: Meta keywords.
80
+ - `{{author}}` or `{{authorMeta}}`: Meta author.
81
+ - `{{classBody}}`: CSS class for the body wrapper.
82
+ - `{{headOptions}}`: SEO Open Graph, Twitter cards, and hot reload scripts.
83
+ - `{{linkStyles}}`: Dynamic stylesheet `<link>` tags.
84
+ - `{{scriptsHead}}`: Script tags loaded in the `<head>`.
85
+ - `{{scriptsBody}}`: Script tags loaded in the `<body>`.
86
+
87
+ Additionally, any top-level key inside `options` or `metaTags` (e.g. `{{username}}`) will be dynamically replaced in the HTML template string.
88
+
89
+ ### Basic Rendering
90
+
91
+ ```javascript
92
+ import Template from "@seip/blue-bird/core/template.js";
93
+
94
+ router.get("/", (req, res) => {
95
+ return Template.render(res, "index", {
96
+ metaTags: {
97
+ titleMeta: "Home",
98
+ descriptionMeta: "Welcome",
99
+ keywordsMeta: "home, welcome",
100
+ authorMeta: "Blue Bird",
101
+ },
102
+ });
103
+ });
104
+ ```
105
+
106
+ ### Caching and Minification Options
107
+
108
+ ```javascript
109
+ Template.render(res, "index", {
110
+ cache: 60 /** Cache TTL in seconds. Default: 60 (only active when DEBUG=false) */,
111
+ minify: true /** Automatically compress whitespace and remove comments. Default: true */,
112
+ cacheKey: "home" /** Optional custom cache key */,
113
+ metaTags: { titleMeta: "Home" },
114
+ });
115
+ ```
116
+
117
+ **Cache behavior:**
118
+
119
+ - `DEBUG=true` → Cache is always bypassed (reads from disk every time).
120
+ - `DEBUG=false` + `cache` > 0 → Output HTML is cached in memory for the specified duration in seconds.
121
+ - `DEBUG=false` + `cache: false` (or 0) → Bypasses caching entirely.
122
+
123
+ ### Cache Management
124
+
125
+ ```javascript
126
+ import Template from "@seip/blue-bird/core/template.js";
127
+
128
+ Template.clearCache();
129
+ Template.clearCache("home");
130
+ Template.getCacheKeys();
131
+ ```
132
+
133
+ ### Hot Reload (Development)
134
+
135
+ When `DEBUG=true` in `.env`, Blue Bird automatically:
136
+
137
+ 1. Injects a hot-reload script into every rendered template.
138
+ 2. Watches `frontend/` for `.html`, `.css`, and `.js` file changes.
139
+ 3. Notifies connected browsers via Server-Sent Events (SSE) to reload.
140
+ 4. Clears the template cache on file changes.
141
+
142
+ No configuration needed — it works automatically in debug mode.
143
+
144
+ ## 4. Data Validation (Validator)
145
+
146
+ Incoming request data must be validated using `core/validate.js`, which automatically returns HTTP 400 JSON responses on error.
147
+
148
+ ```javascript
149
+ import Validator from "@seip/blue-bird/core/validate.js";
150
+
151
+ const userSchema = {
152
+ email: { required: true, email: true },
153
+ password: { required: true, min: 8 },
154
+ bio: { required: false },
155
+ };
156
+
157
+ const postSchema = {
158
+ contentHtml: { required: true, xss: false },
159
+ };
160
+
161
+ const validateUser = new Validator(userSchema, "en");
162
+
163
+ routerApi.post("/users", validateUser.middleware(), (req, res) => {
164
+ res.json({ success: true });
165
+ });
166
+ ```
167
+
168
+ ## 5. Authentication (Auth)
169
+
170
+ The system includes built-in JWT handling with AES-256-GCM encryption. The framework handles tokens via Cookies or the `Authorization` header.
171
+
172
+ ### Protecting Routes
173
+
174
+ Use `Auth.protect()` as a middleware to secure routes.
175
+
176
+ ```javascript
177
+ import Auth from "@seip/blue-bird/core/auth.js";
178
+
179
+ router.get("/profile", Auth.protect(), (req, res) => {
180
+ res.json({ user: req.user });
181
+ });
182
+
183
+ router.get("/dashboard", Auth.protect({ redirect: "/login" }), (req, res) => {
184
+ Template.render(res, "dashboard");
185
+ });
186
+
187
+ router.get(
188
+ "/admin",
189
+ Auth.protect({
190
+ cookieKey: "admin_session",
191
+ key: "admin",
192
+ }),
193
+ (req, res) => {
194
+ res.json({ admin: req.admin });
195
+ },
196
+ );
197
+ ```
198
+
199
+ ### Login and Logout
200
+
201
+ The `Auth` class provides helpers to handle session management via cookies.
202
+
203
+ ```javascript
204
+ router.post("/login", async (req, res) => {
205
+ const user = { id: 1, name: "John" };
206
+ await Auth.login(res, user);
207
+ res.json({ message: "Logged in" });
208
+ });
209
+
210
+ router.post("/logout", async (req, res) => {
211
+ await Auth.logout(res);
212
+ res.json({ message: "Logged out" });
213
+ });
214
+
215
+ await Auth.login(res, user, "my_session", {
216
+ expiresIn: "7d",
217
+ cookie: { httpOnly: true, secure: true },
218
+ });
219
+ ```
220
+
221
+ ## 6. Performance Caching (Cache)
222
+
223
+ If a route involves heavy processing or database queries, utilize the `Cache` middleware. It automatically caches both REST API JSON payloads (overriding `res.json`) and HTML/EJS rendered views (overriding `res.send`).
224
+
225
+ ```javascript
226
+ import Cache from "@seip/blue-bird/core/cache.js";
227
+
228
+ router.get("/stats", Cache.middleware(60), (req, res) => {
229
+ res.json({ ok: true });
230
+ });
231
+
232
+ router.get("/dashboard", Cache.middleware(120), (req, res) => {
233
+ Template.render(res, "dashboard");
234
+ });
235
+ ```
236
+
237
+ ## 7. Security (Helmet)
238
+
239
+ Helmet is **not applied globally** by default. Apply it per-router where needed:
240
+
241
+ ```javascript
242
+ import App from "@seip/blue-bird/core/app.js";
243
+
244
+ const webRouter = new Router("/web");
245
+ webRouter.use(App.helmet());
246
+ webRouter.use(App.helmet({ contentSecurityPolicy: false }));
247
+ ```
248
+
249
+ ## 8. Docker Compose CLI
250
+
251
+ Blue Bird features a built-in Docker Compose CLI wrapper to deploy and manage containerized development databases and production stacks.
252
+
253
+ ```bash
254
+ # Manage containers using blue-bird CLI
255
+ npx blue-bird docker start # Starts production app + mysql database
256
+ npx blue-bird docker start mysql # Starts MySQL container only (useful for local development)
257
+ npx blue-bird docker stop # Stops all running containers
258
+ npx blue-bird docker build # Builds/rebuilds application image
259
+ npx blue-bird docker ps # Shows status of active containers
260
+ npx blue-bird docker logs # Tails Node.js app container logs
261
+ npx blue-bird docker mysql # Runs interactive MySQL client terminal inside the container
262
+ npx blue-bird docker prune # Cleans unused volumes, dangling images, and BuildKit caches
263
+ ```
264
+
265
+ The container names and virtual networks are namespaced by the `TITLE` environment variable parsed from `.env` to prevent resource collisions on VPS hosts.
266
+
267
+ ## 9. AI Development Guidelines
268
+
269
+ 1. **Frontend**: Use static HTML templates inside `frontend/` (e.g. `.html` files). Standard static files belong in `frontend/public/`.
270
+ 2. **JSON Responses**: API endpoints should return standardized responses formatted as `{ message: "..." }` or `{ data: ... }`.
271
+ 3. **Magic Imports**: Stick to pure relative imports or well-configured aliases (imports natively resolve from `@seip/blue-bird/...` or relative directories like `../../`).
272
+ 4. **SEO**: Create routers with `{ seo: true }` to auto-include routes in sitemap.xml and robots.txt.
273
+ 5. **Caching & Minification**: Cache pages using `Template.render` options or route-level `Cache.middleware()`. All HTML outputs are automatically minified.
274
+ 6. **No inline comments**: Only use JSDoc for documentation.
275
+
276
+ _This file can be retrieved by intelligent agents reading its absolute physical path during reasoning._
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andres Paiva
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,311 @@
1
+ # Blue Bird Framework
2
+
3
+ **High-Performance Express Framework — Built for Speed, Caching, and Visual Excellence**
4
+
5
+ ![Blue Bird Logo](https://seip25.github.io/Blue-bird/blue-bird.png)
6
+
7
+ [![npm version](https://img.shields.io/npm/v/@seip/blue-bird.svg)](https://www.npmjs.com/package/@seip/blue-bird)
8
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ ---
11
+
12
+ ## 🌟 Introduction / Introducción
13
+
14
+ **Blue Bird** is a powerful, opinionated framework built on **Express**. It's designed to help developers build fast, scalable applications and APIs with everything pre-configured: data validation, security middlewares, GCM-encrypted JWT authentication, raw HTML template rendering with fast in-memory caching, automatic HTML minification, SEO management, hot-reload, and CLI/Docker developer workflows out of the box.
15
+
16
+ **Blue Bird** es un framework potente basado en **Express**. Está diseñado para ayudar a los desarrolladores a construir aplicaciones rápidas, APIs escalables y todo pre-configurado: validación de datos, middlewares de seguridad, autenticación JWT encriptada con GCM, renderizado de plantillas HTML crudo con caché ultra rápida en memoria, minificación HTML automática, gestión de SEO, hot-reload y flujos de trabajo con Docker y CLI integrados.
17
+
18
+ ---
19
+
20
+ ## 🚀 Key Features / Características Clave
21
+
22
+ - ⚡ **All-In-One**: Pre-configured Express server with JSON, URL encoding, Cookies, and CORS.
23
+ - 🚀 **Fast Rendering**: Raw HTML template rendering (`Template.render`) with in-memory caching (configurable TTL).
24
+ - 🧹 **Automatic Minification**: Compresses whitespace and strips HTML comments automatically in production.
25
+ - 🔐 **Premium Security**: AES-256-GCM encrypted JWT cookie auth, secure route filters, and built-in Helmet configurator.
26
+ - 📁 **File Uploads**: Easy Multer-based single/multiple file storage handling.
27
+ - 🔄 **SSE Hot Reload**: Automated browser hot-reloading in development (`DEBUG=true`) on file changes.
28
+ - 🐳 **Docker & PM2 Devops**: Pre-built Docker Compose/Dockerfile templates and CLI tools for zero-config dev and VPS production.
29
+
30
+ ---
31
+
32
+ ## 🛠️ Quick Start / Inicio Rápido
33
+
34
+ ### 1. Installation / Instalación
35
+
36
+ ```bash
37
+ npm install @seip/blue-bird
38
+ ```
39
+
40
+ ### 2. Initialize Project / Inicializar
41
+
42
+ ```bash
43
+ npx blue-bird
44
+ ```
45
+
46
+ _This copies the base structure: `backend`, `frontend`, `docker`, `docker-compose.yml`, `AGENTS.md`, and `.env`._
47
+
48
+ ### 3. Run Development Server / Modo Desarrollo
49
+
50
+ ```bash
51
+ npm run dev
52
+ ```
53
+
54
+ ---
55
+
56
+ ## 📁 Project Structure / Estructura del Proyecto
57
+
58
+ ```
59
+ project/
60
+ ├── backend/
61
+ │ ├── routes/ # Express route files
62
+ │ │ ├── api.js # REST API routes
63
+ │ │ └── frontend.js # Frontend HTML template routes
64
+ │ └── index.js # App startup and initialization
65
+ ├── frontend/
66
+ │ ├── templates/ # Raw HTML template pages (.html)
67
+ │ │ ├── index.html
68
+ │ │ └── about.html
69
+ │ └── public/ # Static assets (css, js, img, fonts)
70
+ │ └── js/
71
+ │ └── tailwind.js # Local Tailwind compiler
72
+ ├── docker/
73
+ │ └── Dockerfile # Optimized production multi-stage build file
74
+ ├── docker-compose.yml # Dev/Prod container configurations
75
+ ├── AGENTS.md # AI coding assistant guidebook
76
+ └── .env # App configuration (git-ignored)
77
+ ```
78
+
79
+ ---
80
+
81
+ ## 📖 Core Modules Documentation / Documentación de Módulos
82
+
83
+ ### 1. Routing & SEO (`Router`)
84
+
85
+ Do not use Express' native router. Always use Blue Bird's wrapper class:
86
+
87
+ ```javascript
88
+ import Router from "@seip/blue-bird/core/router.js";
89
+
90
+ const routerApi = new Router("/api");
91
+ routerApi.get("/users", (req, res) => {
92
+ res.json({ users: [] });
93
+ });
94
+ export default routerApi;
95
+ ```
96
+
97
+ **For the Frontend (HTML Rendering / SEO):**
98
+ Instantiate a router with `{ seo: true }`. All registered GET routes are automatically added to the dynamic sitemap at `/sitemap.xml` and `/robots.txt`.
99
+
100
+ ```javascript
101
+ const router = new Router("/", { seo: true });
102
+ router.get("/", (req, res) => {
103
+ return Template.render(res, "index", {
104
+ metaTags: {
105
+ titleMeta: "Home",
106
+ descriptionMeta: "Welcome to Blue Bird Framework",
107
+ },
108
+ });
109
+ });
110
+ ```
111
+
112
+ ---
113
+
114
+ ### 2. HTML Template Rendering (`Template`)
115
+
116
+ Renders raw HTML files from `frontend/templates/`. Replaces double-curly placeholders `{{variable}}` with matching values from options, metaTags, or system env.
117
+
118
+ #### Standard Placeholders
119
+
120
+ - `{{lang}}`: Selected/active language code.
121
+ - `{{title}}` or `{{titleMeta}}`: Page HTML title.
122
+ - `{{canonicalUrl}}`: Canonical page URL for crawlers.
123
+ - `{{description}}`: Meta description.
124
+ - `{{keywords}}`: Meta keywords.
125
+ - `{{author}}`: Meta author.
126
+
127
+ ```javascript
128
+ import Template from "@seip/blue-bird/core/template.js";
129
+
130
+ router.get("/about", (req, res) => {
131
+ return Template.render(res, "about", {
132
+ cache: 60, // Cache TTL in seconds (only when DEBUG=false)
133
+ minify: true, // Automatically minifies whitespace and strips comments
134
+ metaTags: {
135
+ titleMeta: "About Us",
136
+ descriptionMeta: "Learn more about us",
137
+ },
138
+ });
139
+ });
140
+ ```
141
+
142
+ #### Cache Controls
143
+
144
+ - `DEBUG=true` -> Cache is always bypassed.
145
+ - `DEBUG=false` -> Cached in-memory for TTL duration.
146
+ - Programmatic management:
147
+ ```javascript
148
+ Template.clearCache(); // Clear all cache
149
+ Template.clearCache("about"); // Clear specific cache key
150
+ Template.getCacheKeys(); // Returns active cache keys
151
+ ```
152
+
153
+ ---
154
+
155
+ ### 3. Data Validation (`Validator`)
156
+
157
+ Validates request payloads using a JSON schema. Returns structured `400 Bad Request` payloads automatically on schema failures.
158
+
159
+ ```javascript
160
+ import Validator from "@seip/blue-bird/core/validate.js";
161
+
162
+ const userSchema = {
163
+ email: { required: true, email: true },
164
+ password: { required: true, min: 8 },
165
+ bio: { required: false },
166
+ };
167
+
168
+ const validateUser = new Validator(userSchema, "en");
169
+
170
+ routerApi.post("/users", validateUser.middleware(), (req, res) => {
171
+ res.json({ success: true });
172
+ });
173
+ ```
174
+
175
+ ---
176
+
177
+ ### 4. JWT Authentication (`Auth`)
178
+
179
+ Secure user sessions using stateless AES-256-GCM encrypted JWTs stored in secure HTTP-Only cookies.
180
+
181
+ #### Protecting Routes
182
+
183
+ ```javascript
184
+ import Auth from "@seip/blue-bird/core/auth.js";
185
+
186
+ // Secure API endpoint (returns 401 on failure)
187
+ router.get("/profile", Auth.protect(), (req, res) => {
188
+ res.json({ user: req.user });
189
+ });
190
+
191
+ // Secure web page (redirects to /login on failure)
192
+ router.get("/dashboard", Auth.protect({ redirect: "/login" }), (req, res) => {
193
+ Template.render(res, "dashboard");
194
+ });
195
+ ```
196
+
197
+ #### Authentication Sessions
198
+
199
+ ```javascript
200
+ router.post("/login", async (req, res) => {
201
+ const user = { id: 1, name: "John Doe" };
202
+ await Auth.login(res, user);
203
+ res.json({ message: "Logged in successfully" });
204
+ });
205
+
206
+ router.post("/logout", async (req, res) => {
207
+ await Auth.logout(res);
208
+ res.json({ message: "Logged out" });
209
+ });
210
+ ```
211
+
212
+ ---
213
+
214
+ ### 5. Performance Cache Middleware (`Cache`)
215
+
216
+ Applies caching at the route handler level. Automatically caches JSON payloads (`res.json`) and rendered outputs (`res.send`).
217
+
218
+ ```javascript
219
+ import Cache from "@seip/blue-bird/core/cache.js";
220
+
221
+ // Cache endpoint for 60 seconds
222
+ router.get("/stats", Cache.middleware(60), (req, res) => {
223
+ res.json({ usersOnline: 42 });
224
+ });
225
+ ```
226
+
227
+ ---
228
+
229
+ ### 6. Security Headers (`Helmet`)
230
+
231
+ Apply security headers per-router. Preserves the framework's custom powered-by header by default:
232
+
233
+ ```javascript
234
+ import App from "@seip/blue-bird/core/app.js";
235
+
236
+ const webRouter = new Router("/web");
237
+ webRouter.use(App.helmet());
238
+ ```
239
+
240
+ ---
241
+
242
+ ## 🐳 Docker CLI Workflow
243
+
244
+ Blue Bird comes with a built-in Docker CLI wrapper that handles both local development database bootstrapping and full-stack VPS production deployments.
245
+
246
+ ### Commands Syntax:
247
+
248
+ ```bash
249
+ npx blue-bird docker <command> [options]
250
+ ```
251
+
252
+ ### Supported Actions:
253
+
254
+ - **`npx blue-bird docker start`**: Boots the production stack (Node.js App + MySQL).
255
+ - **`npx blue-bird docker start mysql`**: Boots the MySQL container only (great for local HTTP development).
256
+ - **`npx blue-bird docker stop`**: Stops all active containers.
257
+ - **`npx blue-bird docker build [--no-cache]`**: Builds or updates the Node.js production image.
258
+ - **`npx blue-bird docker ps`**: Lists running project containers and ports.
259
+ - **`npx blue-bird docker logs [app|mysql]`**: Tails logs for the specified container.
260
+ - **`npx blue-bird docker db`**: Connects into the container's interactive MySQL shell using credentials from `.env`.
261
+ - **`npx blue-bird docker prune`**: Safely clears orphaned volumes, dangling build caches, and images.
262
+
263
+ ---
264
+
265
+ ## 🚀 Production Deployment Options
266
+
267
+ You can deploy Blue Bird applications to production using two main workflows:
268
+
269
+ ### A. Docker Container Stack (Recommended)
270
+
271
+ 1. Configure `.env` with production keys,DEBUG=false and your custom `TITLE`.
272
+ 2. Build the production image:
273
+ ```bash
274
+ npx blue-bird docker build
275
+ ```
276
+ 3. Run the container cluster:
277
+ ```bash
278
+ npx blue-bird docker start prod
279
+ ```
280
+
281
+ ### B. Standard PM2 / Node.js Runtime
282
+
283
+ To deploy in a standard Linux environment using PM2 process manager:
284
+
285
+ 1. Install PM2 globally:
286
+ ```bash
287
+ npm install pm2 -g
288
+ ```
289
+ 2. Start the application under PM2:
290
+ ```bash
291
+ pm2 start backend/index.js --name "bluebird-app"
292
+ ```
293
+ 3. Monitor status:
294
+ ```bash
295
+ pm2 status
296
+ pm2 logs
297
+ ```
298
+
299
+ ---
300
+
301
+ ## 📄 License / Licencia
302
+
303
+ Distributed under the **MIT License**. See `LICENSE` for more information.
304
+
305
+ Distribuido bajo la **Licencia MIT**. Mira `LICENSE` para más información.
306
+
307
+ ---
308
+
309
+ <div align="center">
310
+ <p>Made with ❤️ by <strong>Seip25</strong></p>
311
+ </div>
@@ -0,0 +1,21 @@
1
+ import App from "@seip/blue-bird/core/app.js";
2
+ import routerApiExample from "./routes/api.js";
3
+ import routerFrontendExample from "./routes/frontend.js";
4
+
5
+ /**
6
+ * Main entry point for the Blue Bird application.
7
+ * Initializes the App instance with routes, configuration, and starts the server.
8
+ */
9
+ const app = new App({
10
+ routes: [routerApiExample, routerFrontendExample],
11
+
12
+ cors: [],
13
+
14
+ middlewares: [],
15
+
16
+ host: "http://localhost",
17
+
18
+ port: process.env.PORT,
19
+ });
20
+
21
+ app.run();