You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-18Lines changed: 18 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,23 +1,23 @@
1
1
# Node API boilerplate
2
2
3
-
It's an opinionated boilerplate for Node web APIs focused on separation of concerns and scalability.
3
+
An opinionated boilerplate for Node web APIs focused on separation of concerns and scalability.
4
4
5
5
## Features
6
6
7
7
<dl>
8
8
<dt>Multilayer folder structure</dt>
9
9
<dd>
10
-
Code organization inspired by <a href="http://dddcommunity.org/">DDD</a> and <a href="https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html">Clean Architecture</a>
10
+
<a href="https://github.com/talyssonoc/node-api-boilerplate/wiki/Folder-structure">Code organization</a> inspired by <a href="http://dddcommunity.org/">DDD</a> and <a href="https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html">Clean Architecture</a> focused on codebase scalability.
11
11
</dd>
12
12
13
-
<dt>Instant feedback</dt>
13
+
<dt>Instant feedback and reload</dt>
14
14
<dd>
15
15
Use <a href="https://www.npmjs.com/package/nodemon">Nodemon</a> to automatically reload the server after a file change when on development mode, makes the development faster and easier.
16
16
</dd>
17
17
18
18
<dt>Ready for production</dt>
19
19
<dd>
20
-
Setup with <a href="https://www.npmjs.com/package/pm2">PM2</a> process manager ready to go live on production. If you use Heroku there's also a Procfile and a post-build task to run the migrations on production.
20
+
Setup with <a href="https://www.npmjs.com/package/pm2">PM2</a> process manager ready to go live on production. It's also out-of-box ready to be deployed at Heroku, you can read more about it <a href="https://github.com/talyssonoc/node-api-boilerplate/wiki/Setup-in-Heroku">here</a>.
21
21
</dd>
22
22
23
23
<dt>Scalable and easy to use web server</dt>
@@ -27,17 +27,17 @@ It's an opinionated boilerplate for Node web APIs focused on separation of conce
27
27
28
28
<dt>Database integration</dt>
29
29
<dd>
30
-
<a href="https://www.npmjs.com/package/sequelize">Sequelize</a>, an ORM for SQL databases, is already integrated, you just have to set the authentication configurations.
30
+
<a href="https://www.npmjs.com/package/sequelize">Sequelize</a>, an ORM for SQL databases, is already integrated, you just have to set the <a href="https://github.com/talyssonoc/node-api-boilerplate/wiki/Database-setup">authentication configurations</a>.
31
31
</dd>
32
32
33
33
<dt>Prepared for testing</dt>
34
34
<dd>
35
-
The test suite uses <a href="https://www.npmjs.com/package/mocha">Mocha</a>/<a href="https://www.npmjs.com/package/chai">Chai</a> and is prepared to run unit, integration and functional tests right from the beginning. There are helpers to make it easy to make requests to the web app during the tests and for cleaning the database after each test. A <a href="https://www.npmjs.com/package/factory-girl">FactoryGirl</a> adapter for Sequelize is setup as well to make your tests DRY, and the tests generate code coverage measurement with <a href="https://www.npmjs.com/package/istanbul">Istanbul</a>.
35
+
The test suite uses <a href="https://www.npmjs.com/package/mocha">Mocha</a>/<a href="https://www.npmjs.com/package/chai">Chai</a> and is prepared to run unit, integration and functional tests right from the beginning. There are helpers to <a href="https://github.com/talyssonoc/node-api-boilerplate/wiki/The-test-suite">make it easy to make requests to the web app during the tests and for cleaning the database after each test</a>. A <a href="https://www.npmjs.com/package/factory-girl">FactoryGirl</a> adapter for Sequelize is setup to make your tests DRY as well, and the tests generate code coverage measurement with <a href="https://www.npmjs.com/package/istanbul">Istanbul</a>. You should read about the <a href="https://github.com/talyssonoc/node-api-boilerplate/wiki/Chai-plugins">Chai plugins that are setup by default too</a>.
36
36
</dd>
37
37
38
38
<dt>Dependency injection</dt>
39
39
<dd>
40
-
With <a href="https://www.npmjs.com/package/awilix">Awilix</a>, a practical dependency injection library, the code will not be coupled and it'll still be easy to resolve automatically the dependencies on the runtime and mock them during the tests. It's even possible inject dependencies on your controllers with the <a href="https://www.npmjs.com/package/awilix-express">Awilix Express adapter</a>.
40
+
With <a href="https://www.npmjs.com/package/awilix">Awilix</a>, a practical dependency injection library, the code will not be coupled and it'll still be easy to resolve automatically the dependencies on the runtime and mock them during the tests. It's even possible inject dependencies on your controllers with the <a href="https://www.npmjs.com/package/awilix-express">Awilix Express adapter</a>. Click <a href="https://github.com/talyssonoc/node-api-boilerplate/wiki/Dependency-injection-container">here</a> if you want to read more about how to use dependency injection with this boilerplate.
41
41
</dd>
42
42
43
43
<dt>CLI integration</dt>
@@ -62,31 +62,31 @@ _Notice that the boilerplate comes with a small application for user management
62
62
63
63
1. Clone the repository with `git clone --depth=1 https://github.com/talyssonoc/node-api-boilerplate`
64
64
2. Setup the database on `config/database.js` (there's an example file there to be used with PostgreSQL 😉 )
65
-
3. Install the dependencies with `yarn` (click here if you [don't have Yarn installed](https://yarnpkg.com/docs/install))
65
+
3. Install the dependencies with `yarn` (click here if [you don't have Yarn installed](https://yarnpkg.com/docs/install))
66
66
4. Create the development and test databases you have setup on `config/database.js`
67
67
5. Run the database migrations with `npm run sequelize db:migrate`
68
68
6. Add some seed data to the development database with `npm run sequelize db:seed:all`
69
69
7. Run the application in development mode with `npm run dev`
70
70
8. Access `http://localhost:3000/api/users` and you're ready to go!
71
71
72
-
After playing a little bit with the boilerplate and before implementing a real application with it I recommend you to read at least the `Setup` and the `Organization and architecture` sections of our [Wiki](https://github.com/talyssonoc/node-api-boilerplate/wiki). After that you'll be able to remove the example application files running `npm run cleanup`
72
+
After playing a little bit with the boilerplate and _before_ implementing a real application with it I recommend you to read at least the `Setup` and the `Organization and architecture` sections of our [Wiki](https://github.com/talyssonoc/node-api-boilerplate/wiki). After that you'll be able to remove the example application files running `npm run cleanup`
73
73
74
74
## Aditional info:
75
75
76
76
- Don't forget to run the migrations for the test environment as well (including when you create a new migration) with `npm run sequelize db:migrate -- --env=test`
77
77
78
78
## Scripts
79
79
80
-
This boilerplate comes with a collection of npm scripts to make your life easier, you'll run them with `npm run <script name>`:
80
+
This boilerplate comes with a collection of npm scripts to make your life easier, you'll run them with `npm run <script name>` or `yarn run <script name>`:
81
81
82
-
-`dev`: Open the application in development mode
83
-
-`start`Open the application ready to production (prefer not to do that in development)
82
+
-`dev`: Run the application in development mode
83
+
-`start`Run the application in production mode (prefer not to do that in development)
84
84
-`test`: Run the test suite
85
85
-`coverage`: Run the test suite and generate code coverage, the output will be on `coverage` folder
86
-
-`lint`: Run the linter
87
-
-`sequelize`: Alias to use the [Sequelize CLI](https://github.com/sequelize/cli)
88
-
-`console`: Open a pre-built console, you can access the DI container through the `container` variable once it's open, the console is promise-friendly
89
-
-`cleanup`: Removes the files from example application
86
+
-`lint`: Lint the codebase
87
+
-`sequelize`: Alias to the [Sequelize CLI](https://github.com/sequelize/cli)
88
+
-`console`: Open the built-in console, you can access the DI container through the `container` variable once it's open, the console is promise-friendly. Click [here](https://github.com/talyssonoc/node-api-boilerplate/wiki/Application-console) to know more about the built-in console
89
+
-`cleanup`: Removes the files from the example application
90
90
91
91
## Tech
92
92
@@ -107,6 +107,6 @@ This boilerplate comes with a collection of npm scripts to make your life easier
0 commit comments