{"id":51635900,"url":"https://github.com/refkinscallv/rfbe","last_synced_at":"2026-07-13T14:30:39.151Z","repository":{"id":362455113,"uuid":"1258660348","full_name":"refkinscallv/rfbe","owner":"refkinscallv","description":"Quick-action Node.js backend framework: Express routing, Sequelize, JWT, cron, queue, Socket.IO, mailer \u0026 a standard response envelope — one .env config. Scaffold with: npm create rfbe@latest my-app","archived":false,"fork":false,"pushed_at":"2026-06-04T08:19:35.000Z","size":102,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-04T10:09:12.053Z","etag":null,"topics":["backend","boilerplate","create-rfbe","cron","express","framework","jwt","mysql","nodejs","nodemailer","queue","rest-api","scaffold","sequelize","socket-io","starter"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/create-rfbe","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/refkinscallv.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-03T19:47:03.000Z","updated_at":"2026-06-04T08:19:39.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/refkinscallv/rfbe","commit_stats":null,"previous_names":["refkinscallv/rfbe"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/refkinscallv/rfbe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refkinscallv%2Frfbe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refkinscallv%2Frfbe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refkinscallv%2Frfbe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refkinscallv%2Frfbe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/refkinscallv","download_url":"https://codeload.github.com/refkinscallv/rfbe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refkinscallv%2Frfbe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35426085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","boilerplate","create-rfbe","cron","express","framework","jwt","mysql","nodejs","nodemailer","queue","rest-api","scaffold","sequelize","socket-io","starter"],"created_at":"2026-07-13T14:30:38.303Z","updated_at":"2026-07-13T14:30:39.142Z","avatar_url":"https://github.com/refkinscallv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RFBE — Refkinscallv Backend Framework\n\n[![CI](https://github.com/refkinscallv/rfbe/actions/workflows/ci.yml/badge.svg)](https://github.com/refkinscallv/rfbe/actions/workflows/ci.yml)\n[![npm](https://img.shields.io/npm/v/create-rfbe.svg)](https://www.npmjs.com/package/create-rfbe)\n[![license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nA quick-action backend framework for Node.js. RFBE wires the pieces you reach\nfor on almost every project — HTTP, database, auth, scheduling, queues and\nrealtime — into a small set of cores with one central configuration file. You\nwrite controllers, models and jobs; the framework handles the boot order,\ngraceful shutdown and the wiring in between.\n\n## Why RFBE\n\n- **One config surface.** Everything is driven by `.env` and `src/config.js`.\n- **Laravel-style routing** via [`@refkinscallv/express-routing`](https://github.com/refkinscallv/express-routing).\n- **Batteries included.** Database, JWT, cron, queue, sockets and a rich set of\n  helper utilities ship in the box.\n- **Predictable lifecycle.** A single bootstrapper starts the cores in order and\n  tears them down cleanly on `SIGINT` / `SIGTERM`.\n\n## Tech Stack\n\n| Concern        | Library                             |\n| -------------- | ----------------------------------- |\n| HTTP server    | express 5                           |\n| Routing        | @refkinscallv/express-routing       |\n| Database / ORM | sequelize 6 + mysql2                |\n| Auth tokens    | jsonwebtoken                        |\n| Passwords      | bcrypt                              |\n| Scheduling     | node-cron                           |\n| Realtime       | socket.io                           |\n| Security       | helmet, cors, express-rate-limit    |\n| Uploads        | multer                              |\n| HTTP client    | axios                               |\n| Mail           | nodemailer                          |\n| Logging        | winston + winston-daily-rotate-file |\n| Validation     | zod                                 |\n\n## Project Structure\n\n```\nrfbe/\n├── bootstrap/\n│   └── index.js              # process entry: dotenv + aliases + Bootstrap.run()\n├── core/                     # framework internals (do not edit per-project)\n│   ├── common/               # utility modules\n│   │   ├── array.js  string.js  object.js  url.js   path.js\n│   │   ├── hash.js   crypt.js   collection.js        date.js\n│   │   └── cache.js  storage.js\n│   ├── common.core.js        # facade: env readers + utility namespaces\n│   ├── bootstrap.core.js     # boot order + graceful shutdown\n│   ├── express.core.js       # HTTP backbone\n│   ├── database.core.js      # Sequelize: models, migrate, seed, sync, scaffold\n│   ├── jwt.core.js           # access / refresh tokens\n│   ├── mailer.core.js        # nodemailer wrapper\n│   ├── response.core.js      # standard response envelope\n│   ├── validator.core.js     # Zod schema -\u003e route middleware\n│   ├── cron.core.js          # scheduled jobs\n│   ├── queue.core.js         # in-process job queue\n│   ├── socket.core.js        # socket.io\n│   ├── hooks.core.js         # lifecycle hooks\n│   ├── logger.core.js  error.core.js  runtime.core.js\n├── scripts/\n│   ├── setup.js              # `npm run setup`\n│   └── db.js                 # database CLI (migrate / seed / make:model / ...)\n├── src/                      # your application\n│   ├── config.js             # central configuration\n│   ├── http/\n│   │   ├── controllers/      # request handlers\n│   │   ├── middleware/       # register.middleware.js (global) + route guards\n│   │   └── validator/        # Zod request schemas\n│   ├── models/               # Sequelize model factories\n│   ├── routes/register.route.js\n│   ├── jobs/register.job.js\n│   ├── queue/register.queue.js\n│   ├── socket/register.socket.js\n│   ├── hooks/register.hook.js    # _sample.hook.js shows every stage\n│   └── database/\n│       ├── migrations/\n│       └── seeders/\n├── .env / .env.example\n└── package.json\n```\n\nThe `@core` and `@app` import aliases (configured in `package.json`) map to\n`core/` and `src/` respectively, so you write `require('@core/jwt.core')` and\n`require('@app/config')` from anywhere.\n\n## Installation\n\nRequirements: Node.js 18+ and a MySQL server.\n\n### Scaffold a new project (recommended)\n\n```bash\n# via npm create (published as the create-rfbe initializer)\nnpm create rfbe@latest my-app\n\n# or straight from GitHub, no publish required\nnpx degit refkinscallv/rfbe my-app \u0026\u0026 cd my-app \u0026\u0026 npm install \u0026\u0026 npm run setup\n```\n\nThe scaffolder copies the template, installs dependencies, writes `.env`, and\ngenerates `APP_KEY`, `JWT_SECRET` and `JWT_REFRESH_SECRET`. Flags: `--no-install`\nand `--no-git`.\n\n\u003e The npm initializer is published as the **`create-rfbe`** package, which is\n\u003e what `npm create rfbe@latest` resolves to.\n\n### Clone this repository\n\n```bash\ngit clone https://github.com/refkinscallv/rfbe.git\ncd rfbe\nnpm install\nnpm run setup\n```\n\n`npm run setup` installs any missing dependencies, creates `.env` from\n`.env.example`, and generates `APP_KEY`, `JWT_SECRET` and `JWT_REFRESH_SECRET`.\n\n## Quick Start\n\n1. Create the database referenced by `DB_NAME` (default `rfbe`).\n2. Run the migrations and seed the baseline data:\n\n    ```bash\n    npm run db:migrate\n    npm run db:seed\n    ```\n\n3. Start the server:\n\n    ```bash\n    npm run dev      # nodemon, auto-reload\n    # or\n    npm start        # plain node\n    ```\n\n4. Verify it is up:\n\n    ```bash\n    curl http://localhost:3000/\n    curl http://localhost:3000/home/health\n    curl http://localhost:3000/api/ping\n    ```\n\n## Usage\n\n### Define a route\n\n`src/routes/register.route.js`:\n\n```js\nconst Routes = require('@refkinscallv/express-routing');\nconst Validator = require('@core/validator.core');\nconst UserController = require('@app/http/controllers/user.controller');\nconst AuthMiddleware = require('@app/http/middleware/auth.middleware');\nconst { createUserSchema } = require('@app/http/validator/user.validator');\n\n// Auto-mount a controller's methods\nRoutes.controller('/users', UserController);\n\n// Per-route validation + auth guard\nRoutes.middleware([AuthMiddleware]).post('/users', UserController, [Validator.make(createUserSchema)]);\n```\n\n### Write a controller\n\nHandlers receive a single `{ req, res, next, error }` object. `res` is decorated\nwith the standard response envelope helpers (`res.success`, `res.error`,\n`res.respond`).\n\n```js\nclass UserController {\n\tstatic async index({ res }) {\n\t\tconst users = await User.findAll();\n\t\tres.success(users, 'Users loaded');\n\t}\n}\nmodule.exports = UserController;\n```\n\nEvery response follows one shape — `{ status, code, message, data, meta, errors,\nadditional }` — including validation failures and errors. See\n[Response](API.md#response).\n\n### Use the cores\n\n```js\nconst Jwt = require('@core/jwt.core');\nconst Common = require('@core/common.core');\nconst Queue = require('@core/queue.core');\n\nconst tokens = Jwt.issue({ id: user.id });\nconst slug = Common.Str.slug('Hello World'); // 'hello-world'\nconst hash = await Common.Hash.make('secret');\nQueue.dispatch('emails', { to: user.email });\n```\n\nSee [API.md](API.md) for the full reference of every core.\n\n## Configuration\n\nAll configuration lives in [`src/config.js`](src/config.js) and is sourced from\nenvironment variables with sensible defaults. Never read `process.env` directly\nin application code — add a key to `config.js` and read it from there.\n\nKey groups: `app`, `database`, `jwt`, `bcrypt`, `cors`, `express`, `rateLimit`,\n`upload`, `axios`, `logging`, `runtime`, `storage`, `cache`, `cron`, `queue`,\n`socket`, `mail`. Every key maps to an environment variable documented in\n[`.env.example`](.env.example).\n\nToggle whole subsystems from `.env`: `DB_ENABLED`, `CRON_ENABLED`,\n`QUEUE_ENABLED`, `SOCKET_ENABLED`, `MAIL_ENABLED`. When disabled, the matching\ncore is skipped at boot, so you can run, say, an HTTP-only service with\n`DB_ENABLED=false`.\n\n## Models vs Migrations\n\nThese two concepts are easy to confuse, so to be explicit:\n\n- **Models** (`src/models/*.model.js`) are how your application reads and writes\n  data at runtime. They are loaded when the app boots.\n- **Migrations** (`src/database/migrations/*.js`) are versioned schema changes\n  (DDL). They are the source of truth for your database structure and run\n  through the CLI — never automatically at boot.\n\nThere are two ways to get tables in place:\n\n1. **Migrations (recommended, works in production).** Author migrations and run\n   `npm run db:migrate`. Set `DB_AUTO_MODEL=true` to have `migrate` scaffold a\n   model file for any table that does not have one yet (existing files are never\n   overwritten). You can also scaffold on demand with `npm run db:make:model`.\n2. **Model sync (development convenience only).** Set `DB_SYNC=true` to have the\n   framework mirror your **models** to tables on boot via Sequelize `sync()`\n   (optionally `DB_ALTER`/`DB_FORCE`). Do not use this in production.\n\nSo: write models by hand and let `DB_SYNC` build tables in dev, **or** write\nmigrations and let `DB_AUTO_MODEL` scaffold the models for you. Pick one\ndirection per project to avoid surprises.\n\n## Database CLI\n\n```bash\nnpm run db:migrate           # apply pending migrations (scaffolds models if DB_AUTO_MODEL=true)\nnpm run db:rollback          # roll back the last batch\nnpm run db:reset             # roll back everything, then migrate\nnpm run db:fresh             # drop all tables and migrate (add -- --seed to seed)\nnpm run db:seed              # run seeders\nnpm run db:sync              # sync models to the schema (-- --force / -- --alter)\nnpm run db:make:model        # scaffold model file(s) from existing tables\n```\n\n## License\n\nReleased under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefkinscallv%2Frfbe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frefkinscallv%2Frfbe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefkinscallv%2Frfbe/lists"}