node-ddd
node-ddd copied to clipboard
Domain Driven Design boilerplate for NodeJS
Node DDD Boilerplate
RESTful API and Serverless-ready (TBD) with Domain Driven Design
What is DDD (Domain Driven Design)?
Domain driven design (DDD) is an approach to software design that values simplicity and modeling code as closely to the business domain as possible. This results in code that can be easily understood by the business and evolved as the needs of the business domain change.
By isolating domain code away from all other concerns of the system like infrastructure, security, transportation, serialization etc; the complexity of the system grows only as large as the complexity of the business or problem domain itself.
Overview
- uses Node.js > v8
- written using ES6
- uses NPM for package dependency management
- uses JavaScript Standard Style
- uses
sequelizeandsequelize-clias ORM and data migration tool - Filename convention are
camelCaseandkebab-case.
Development Environment Setup
Make sure you have npm, and at least node v12.x
Note:
If you need database connectivity, PostgreSQL and MySQL is supported by default as it uses sequelize as ORM.
Installation
- Clone the repository with
git clone --depth=1 https://github.com/ricomonster/node-ddd.git - Install the dependencies with NPM. It is installed by default with Node.
- Install global dependencies Application Setup.
- Create the development and test Databases.
- Run database migrations and seed with
npm run db:migrate. - Run the application in development mode with
npm run start:http. - Access
http://localhost:<PORT>and you're ready to go!
Application Setup (Development)
$ npm install -g standard # JavaScript Standard Style
$ npm install -g sequelize-cli # CLI for Sequelize
$ npm install -g pg mysql2 # Database
Database Setup (Development)
- Install either Postgres 12.4 or MySQL 5.x.
- Create an empty database according to your preference.
- Rename the .env and populate it with the correct credentials and settings of your preferred database.
Acknowledgments
This boilerplate is inspired from node-api-boilerplate