Hello! NExp (Node Experience) is a boilerplate for Node, which makes use of a Hexagonal architecture, in addition to all the power of TypeScript that combined allow a perfect cohesion thus achieving a clean and at the same time very powerful implementation.
https://github.com/DigiChanges/node-experience
We can run the project directly with docker compose and then bash where the basic commands to feed the database are located.
- Install dependencies.
pnpm install
. - Copy
.env.dev
file to.env
. (.env.dev it's a environment example file) - Then execute
STAGE=dev docker-compose up --build
to up all containers. - Basically generates an admin user, add roles with permission and get a bucket for minIO.
docker-compose exec node bash dev.init.sh
First, install nexp-cli using npm (we assume you have pre-installed node.js).
npm install -g nexp-cli
Then generate your new project:
nexp-cli setPayload
Each module is divided by business domain:
- Auth
- File
- Item
- Notification
There are also two particular cases:
- Config
- Shared
The directory structures for business domains are as follows:
Folder structure of a module
├── Domain
│ ├── Entities
│ ├── Exceptions
│ └── Services
│ └── UseCases
├── Infrastructure
│ ├── Repositories
│ ├── Schema
│ └── Seeds
├── Presentation
│ ├── Commands
│ ├── Controllers
│ ├── Criterias
│ ├── Exceptions
│ ├── Handlers
│ ├── Middlewares
│ ├── Requests
│ └── Transformers
├── Tests
│ ├── Fixtures
Tip I know it may sound repetitive, but it is not a framework. NExp is a set of tools or libraries working together through a common structure. All structural code within this project is not fixed and can be changed freely.
The advantages of using this boilerplate is to save time thinking about certain basic structures common to any project to make an API without having to get everything from scratch.
As it is only a boilerplate, you have the freedom to structure the code whatever you want.
Common structures found within this project are:
- Basic authentication and authorization.
- Filesystem with minIO, 100% S3 compatible.
- Basic push Notification and Email.
- TypeORM, MikroORM and Mongoose Integration.
- Express and Koa integration.
- Business logic independent of the HTTP and persistence libraries.
- Esbuild compiler.
NExp is MIT licensed.