Init Initialize App
Initialize your Blue Bird application.
npx blue-bird
A powerful structure based on Express and React, designed to build fast applications and everything you need pre-configured.
npm install @seip/blue-bird
Tired of configuring CORS, Cookies,etc and Routing every time you start a project? Blue Bird provides a solid, pre-configured base so you can go straight to the business logic, without losing the pure extensibility of Express.
Express, React , Validations, JWT Auth, and Uploads ready to use.
Use the `.use()` method to configure Express middleware just like you always do.
Designed to scale with elegance.
Token generation and validation with middleware ready to protect your API or Web routes.
Multi-language validation engine with predefined rules and automatic messages.
File uploads to disk powered by Multer, configured for your public folder.
React, React Router pre-configured and ready to use in SPA .
Vite ready to use , for dev and production.
Express pre-configured and ready to use in API mode and Web mode.
Everything about the Blue Bird Core API.
Initialize your Blue Bird application.
npx blue-bird
Setup React for your Blue Bird application.
npm run react
Edit package.json for "module" and "type": "module" support
{
"type": "module",....
}
Setup Dev for your Blue Bird application.
npm run dev
Setup Vite for your Blue Bird application.
npm run vite:dev
Central configuration for your Express server.
import App from "@seip/blue-bird/core/app.js";
import routerUsers from "./routes/users.js";
const app = new App({
port: 3000,
routes: [routerUsers],
cors:[],\\ [{ origin: '*' }],
rateLimit:{ \\Or true
windowMs: 10 * 60 * 1000,
max: 300
}
});
// Extend Express with .use()
app.use(myCustomMiddleware);
app.run();
| Option | Type | Default |
|---|---|---|
| routes | Array | [] |
| middlewares | Array | [] |
| port | Number | 3000 |
| host | String | "http://localhost" |
| cors | Object | {} |
| static | Object | { path: null, options: {} } |
| rateLimit | Boolean | Object | false |
| logger | Boolean | true |
| notFound | Boolean | true |
| json | Boolean | true |
| urlencoded | Boolean | true |
| cookieParser | Boolean | true |
| cookieParser | Boolean | true |
| helmet | Boolean | Object | true |
| xssClean | Boolean | true |
| swagger | Boolean | true |
Automatically activates secure HTTP headers to protect against common attacks like clickjacking, MIME sniffing and more.
new App({
helmet: true
});
Also accepts custom configuration.
Automatically sanitizes the request body to prevent malicious script injection (XSS).
new App({
xssClean: true
});
Blue Bird includes IP-based request throttling using
express-rate-limit.
new App({
rateLimit: {
windowMs: 15 * 60 * 1000, // 15 minutes
max: 100
}
});
trust proxy./debug.Blue Bird includes a logging system that:
Manage your routes in a modular and clean way.
import Router from "@seip/blue-bird/core/router.js";
import Template from "@seip/blue-bird/core/template.js";
const routerUsers = new Router("/")
routerUsers.get("/users", (req, res) => {
const users = [
{
name: "John Doe",
email: "john.doe@example.com",
},
{
name: "Jane Doe2",
email: "jane.doe2@example.com",
},
]
res.json(users)
})
const loginSchema = {
email: { required: true, email: true },
password: { required: true, min: 6 }
};
const loginValidator = new Validator(loginSchema, 'es');
routerUsers.post('/login', loginValidator.middleware(), (req, res) => {
res.json({ message: 'Login successful' });
});
//Example renderReact with customized meta Tags
routerUsers.get("/about", (req, res) => {
const response = Template.renderReact(res, "About", { title: "About Example title" }, {
metaTags: {
titleMeta: "About Title",
descriptionMeta: "About description",
keywordsMeta: "About,express, react, framework",
authorMeta: "Blue Bird",
langMeta: "es"
}
});
return response;
})
routerUsers.get("*", (req, res) => {
// Renderizado SPA con React
return Template.renderReact(res, "App", { title: "Mi Proyecto" });
})
export default routerUsers;
Render React components with automated SEO and multi-language support.
The router.seo() method allows you to register
multiple routes with metadata and props in a single call. It supports both single-language
and multi-language configurations.
import Router from "@seip/blue-bird/core/router.js";
const frontendRouter = new Router();
frontendRouter.seo([
{
path: "/",
component: "Home",
// Multi-language support (prefixed routes like /es/ will be created)
en: { title: "Home - Blue Bird", desc: "Welcome to our framework" },
es: { title: "Inicio - Blue Bird", desc: "Bienvenido a nuestro framework" },
props: { id: 1 }
},
{
path: "/about",
component: "About",
// Direct meta support for single language
meta: { titleMeta: "About Us", descriptionMeta: "Learn more about Blue Bird" },
props: { id: 2 }
}
], {
languages: ["en", "es"],
defaultLanguage: "en"
});
// IMPORTANT: Wildcard route for SPA support
routerFrontendExample.get("*", (req, res) => {
return Template.renderReact(res, "App");
});
router.seo() must
exactly match the routes in your App.jsx (React Router). Otherwise,
React will load the default route upon hydration.*
route at the end to ensure any sub-route not specifically defined is correctly
handled by the SPA (App).If you need more control, you can use
Template.renderReact directly. It automatically handles the
<html lang="..."> attribute if langMeta is provided.
import Template from "@seip/blue-bird/core/template.js";
router.get("/custom", (req, res) => {
return Template.renderReact(res, "Custom", { some: "prop" }, {
metaTags: {
titleMeta: "Custom Page",
descriptionMeta: "Custom description",
langMeta: "en" // Automatically sets
},
skeleton: true // [NEW] Enables skeleton loading (loading loaders) automatically
});
});
import Validator from "@seip/blue-bird/core/validate.js";
import router from "@seip/blue-bird/core/router.js";
const routerUsers = new Router("/api")
const schema = {
email: { required: true, email: true },
password: { required: true, min: 6 }
};
const validate = new Validator(schema, 'en');
router.post("/register", validate.middleware(), (req, res) => {
res.json({ message: "OK" });
});
import Auth from "@seip/blue-bird/core/auth.js";
const token =Auth.generateToken(payload);
res.cookie("token", token, {
httpOnly: true,
secure: process.env.NODE_ENV === "production",
sameSite: "strict",
maxAge: 24 * 60 * 60 * 1000
});
Auth.verifyToken(token) //Mode manual
Auth.protect(); // Middleware
//Get user with jwt
routerApiExample.get("/user", Auth.protect(), (req, res) => {
const currentUser = req;
console.log(`Request made by: ${currentUser.name} (ID: ${currentUser.id})`);
....});
import Upload from "...";
Upload.disk({ folder: 'img' });
// Based on Multer
The frontend features built-in multi-language capabilities. A Context Provider reads the
blue_bird_lang key from your localStorage to manage translations
across components.
Note: By default, Blue Bird already includes LanguageProvider
in App.jsx to manage multi-language applications natively. If you wish to
remove it, simply edit App.jsx and remove the provider wrapping.
import { LanguageProvider } from './blue-bird/contexts/LanguageContext.jsx';
export default function App() {
return (
<LanguageProvider>
<Router>
{/* Your Routes Here */}
</Router>
</LanguageProvider>
);
}
Then, inside any component or page you can use the useLanguage() hook:
import { useLanguage } from '../../blue-bird/contexts/LanguageContext.jsx';
export default function Login() {
const { t, lang, setLang } = useLanguage();
return (
<div>
{/* Translations are located in frontend/resources/js/blue-bird/locales/[lang].json */}
<p className="error">{t('error_general')}</p>
</div>
);
}
To accelerate development, we provide beautiful, ready-to-use React components. They are
styled using Tailwind CSS (which is now integrated natively via Vite in
vite.config.js,
ensuring optimal performance). Some of the included components:
Blue Bird provides a zero-config, production-ready complete authentication system scaffolding tool.
npm run scaffolding-auth
routes/auth.js, routes/authenticated.js)
with ready logic for login, registration, logout, and password resets.backend/databases/services/auth.service.js. This separates database
logic, so if you wish to swap raw SQL with Prisma or another ORM later, it's very
straightforward.
frontend/resources/js/pages/auth (Login,
Register, Dashboard, Forgot/Reset Password).Simple in-memory caching middleware for JSON responses. It allows for improved performance by avoiding repeatedly running the handler for a defined period.
import Router from "@seip/blue-bird/core/router.js"
import Cache from "@seip/blue-bird/core/cache.js";
const routerStats = new Router("/")
routerStats("/stats",
Cache.middleware(120), // 120 seconds
controller.stats
);
//Testing
routerStats("/stats_",
cache.middleware(120),
async (req, res) => {
await new Promise(resolve => setTimeout(resolve, 2000));
res.json({
message: 'Login successful',
note: 'This response took 2 seconds to arrive.'
});
}
);;
| Parameter | Type | Default | Description |
|---|---|---|---|
| seconds | Number | 60 | Time in seconds that the response remains cached. |
req.originalUrl as cache key.res.json() to store the response.Automated documentation integration using Swagger (OpenAPI 3). Allows you to view and test endpoints directly from your browser.
First install swagger with npm or cli blue-bird with:
npm run swagger-install
const app = new App({
routes: [routerUsers],
cors: [],
middlewares: [],
port: 3000,
host: "http://localhost",
swagger:{
info: {
title: "Blue Bird API",
version: "1.0.0",
description: "Blue Bird Framework API Documentation"
},
url: "http://localhost:8000"
}
})
/**
/**
* @swagger
* /users:
* get:
* summary: Get all users
* tags: [Users]
* responses:
* 200:
* description: List of users
*
*/
router.get("/users", controller.getUsers);
/**
* @swagger
* components:
* schemas:
* User:
* type: object
* properties:
* name:
* type: string
* email:
* type: string
*/
/docs.components.securitySchemes.@swagger must be properly indented./docs.The Debug module allows you to monitor your application's performance in real time. It records metrics such as response time, RAM usage, CPU consumption, and statistics by route. When Debug=true is set in .env, the route is activated.
Then access the visual panel at:
http://localhost:3000/debug
fetch/debug?fetch=true/debugGET /debug?fetch=true
Returns metrics in JSON format:
{
"requests": [
{
"method": "GET",
"url": "/users",
"status": 200,
"responseTime": 32.14,
"ramUsedMB": 45.21,
"cpuUsedMS": 1.23,
"date": "2026-02-27T12:00:00.000Z"
}
],
"routes": {
"GET /users": {
"count": 5,
"totalTime": 160.5
}
}
}
Blue Bird is designed for production. With features like caching, gzip compression, and robust error handling, you can be sure that your application will work correctly.
For production, it is recommended to use a proxy server like Nginx to handle SSL, gzip compression, and load balancing.
First edit .env , putting DEBUG=false
DEBUG=false
Then run the command to generate the build of react with vite:
npm run vite:build
To run in production use "npm run start" , so with PM2 we will do:
pm2 start npm --name "blue-bird" -- run start
This will start the application in production and keep it alive
.
pm2 save
This will save the PM2 configuration so that it starts
automatically when the server restarts.