Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Ecommerce Node API

An eCommerce platform for Node web APIs focused on separation of concerns and scalability. The app is deployed on heroku and APIs documentation is available at


Multilayer folder structure
Code organization inspired by DDD and Clean Architecture focused on codebase scalability.
Instant feedback and reload
Use Nodemon to automatically reload the server after a file change when on development mode, makes the development faster and easier.
Ready for production
Setup with PM2 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 here.
Scalable and easy to use web server
Use Express for requests routing and middlewares. There are some essential middlewares for web APIs already setup, like body-parser, compression, CORS and method-override.
Database integration
Sequelize, an ORM for SQL databases, is already integrated, you just have to set the authentication configurations.
Prepared for testing
The test suite uses Mocha/Chai 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 FactoryGirl adapter for Sequelize is setup to make your tests DRY as well, and the tests generate code coverage measurement with Istanbul. You should read about the Chai plugins that are setup by default too.
Dependency injection
With Awilix, 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 Awilix Express adapter. Click here if you want to read more about how to use dependency injection with this boilerplate.
CLI integration
Both the application and Sequelize have command-line tools to make it easy to work with them. Check the Scripts section to know more about this feature.
The Log4js logger is highly pluggable, being able to append the messages to a file during the development and send them to a logging service when on production. Even the requests (through morgan) and queries will be logged.
It's also setup with ESLint to make it easy to ensure a code styling and find code smells.

Quick start

This platform have the basic web APIs for ecommerce app. The platform uses backend as my sql database but can be used for other platforms like firebase, dynamodb etc.

  1. Download the source code file or clone it from
  2. Setup the database on config/database.js with the MySQL database configurations.
  3. Install the dependencies with yarn (click here if you don't have Yarn installed)
  4. Create the development and test databases you have setup on config/database.js
  5. Run the database script located at src/infra/database scripts. This shall create the sample data along with tables and store procedures.
  6. Run the application in development mode with npm run dev
  7. Access http://localhost:3000/api/docs and you can check the APIs documentation. You can test the APIs by change the baseURL. you're ready to go!


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>:

  • dev: Run the application in development mode
  • start Run the application in production mode (prefer not to do that in development)
  • test: Run the test suite
  • test:unit: Run only the unit tests
  • test:features: Run only the features tests
  • test:single: Run only the single test case
  • coverage: Run only the unit tests and generate code coverage for them, the output will be on coverage folder
  • lint: Lint the codebase
  • sequelize: Alias to the Sequelize CLI
  • 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 to know more about the built-in console


ToDo (v1.1)

  • Add support for data migration and seed data using Sequelize
  • Add Additional APIs to support Sociallogin.
  • Additional APIs for ecommerce (My Orders, Create Products etc)
  • Additional Test cases to complete more cases.
You can’t perform that action at this time.