Node Framework is a modular, opinionated, and lightweight backend framework for Node.js, built with TypeScript, powered by Express.js, TypeORM, and Socket.IO.
It aims to help developers build scalable applications faster with clear structure, out-of-the-box features, and familiar syntax.
- 🔧 Modular folder structure
- 🧠 Lifecycle hooks on : (
Before System
,After System
,Shutdown System
) - 📦 DTO-based validation using
class-validator
- 🔄 Dynamic middleware and route registration (routes with Laravel styles routing : grouping routes, grouping routes with middleware, set route with standard method)
- 💽 TypeORM-based entity-repository pattern
- 📬 Built-in mailer using
nodemailer
- 🍪 Cookie helper integrated with Express.js
- 🔐 JWT helper for token handling with jsonwebtoken
- 🧾 Pagination helper for repositories
- 🔌 Real-time support with Socket.IO
- 📁 Static files & EJS view support
root/
│
├── public/
│ ├── static/ # Serve static files at /static/\*
│ │ └── file/ # Uploads (e.g., multer)
│ └── views/ # EJS templates
│
├── src/
│ ├── main.ts # Application entry point
│ ├── types/ # Custom typings
│ │ ├── core.ts
│ │ └── express/
│ │ └── index.d.ts # e.g., Request.upload from multer
│ │
│ ├── app/
│ │ ├── config/ # Configuration files (db, express, socket)
│ │ ├── database/
│ │ │ ├── entities/
│ │ │ ├── repositories/
│ │ │ └── seeders/
│ │ │ └── register.ts
│ │ ├── hooks/ # App-defined lifecycle hooks
│ │ ├── http/
│ │ │ ├── controllers/
│ │ │ ├── middlewares/
│ │ │ └── validators/
│ │ │ └── dto/
│ │ └── routes/
│ │ └── register.ts
│ │
│ └── core/
│ ├── boot.ts # Bootstrap logic (called by main.ts)
│ ├── common.ts # Shared helper functions
│ ├── cookie.ts # Cookie utilities based on express
│ ├── express.ts # Express app builder
│ ├── hooks.ts # Lifecycle hook runner
│ ├── jwt.ts # JWT encode/decode/sign/verify
│ ├── mailer.ts # Nodemailer helper
│ ├── paginate.ts # Pagination helper
│ ├── repository.ts # Base repository
│ ├── scope.ts # Global process scope setup
│ ├── server.ts # HTTP server runner
│ ├── socket.ts # Socket.io integration
│ └── typeorm.ts # DB setup & seeder runner
│
└── .env
Alias | Path |
---|---|
@core |
./dist/core |
@app |
./dist/app |
@type |
./dist/types |
Configured via module-alias
.
main.ts
callscore/boot.ts
boot.ts
initializes the database viacore/typeorm.ts
- On success, it bootstraps:
- Express (with cookie, middleware, route register)
- Seeder (optional based on
.env
) - Socket.IO (optional)
- HTTP server runs via
core/server.ts
Script | Description |
---|---|
npm run dev |
Start in dev mode (ts-node + nodemon) |
npm run build |
Compile TypeScript to JS |
npm start |
Run the built app |
npm run lint |
Lint check with ESLint |
npm run lint-fix |
Auto-fix lint issues |
npm run format |
Format code with Prettier |
- Core:
express
,typeorm
,socket.io
,class-validator
,jsonwebtoken
,bcrypt
,nodemailer
- Dev:
typescript
,ts-node
,eslint
,prettier
,nodemon
,@types/*
Have a bug or feature request? Create an issue
This project is licensed under the MIT License.
Feel free to fork, improve, or contribute ideas. PRs are welcome!