Simple Node.js MVC architecture with class object implementation using babel.
- Repository Design Pattern
This boilerplate uses latest version of Node/NPM. i.e. node v12 and npm v6.9.
- Node.js - JavaScript Runtime.
- Express - Web Application Framework.
- Knex.js - A query builder for database
- ObjectionJs - ORM for interacting with database on top of Knex.js.
- Clone the repository
- Copy
.env.example
to.env
$ cp .env.example .env
- Update the information in
.env
file with your information such as database credentials etc. - Install npm packages. I recommend to use
yarn
.
$ yarn
or,
$ npm install
- Now, start server with following commands.
$ yarn start
- Create database migration file
$ yarn make:migration create_users_table
- Run Migrations
$ yarn migrate
- Rollback migration
$ yarn migrate:rollback
- Create database seeder file
$ yarn make:seed UsersTableSeeder
- Run seeders
$ yarn db:seed
To deploy in production, first build app with following command
$ yarn build
After building app, deploy build
directory and run like any other node app.
If you faced any issue with this boilerplate create an issue. Or if you manage to improve it, send pull request.