Skip to content

yatri-motorcycles/nodejs-starter

Repository files navigation

Nodejs Starter. E-Mobility, Urban Transportation & Lifestyle.

Twitter Follow PRs Welcome Strapi on Slack code style: airbnb Tested with Jest

Node.js Starter

Folder structure

|-- migrations        # Database migration dir
|-- tests             # All unit and integration test files goes here
|-- .husky            # Husky hooks for git pre-commits for lint check
|-- src
    |   index.js      # App entry point
    |   app.js        # Load express application modules
    |-- config        # Environment variables and configuration related stuff
    |-- constants     # App constants
    |-- controllers   # Express route controllers
    |-- interfaces    # TypeScript interfaces
    |-- middlewares   # Express middlewares
    |-- models        # Mongoose models
    |-- routes        # Express routes
    |-- services      # Service modules
    |-- startup       # Split the startup process into modules
    |-- types         # Shared TypeScript types
    |-- utils         # Shared utilities modules

Requirements

  • NodeJS >= 12.x
  • Yarn >= 1.x
  • MongoDB >= 4.2

Setup

First of all, you need to check if you're using the required versions of Node.js and npm

Then, please follow the instructions below:

Clone the repo:

$ git clone https://github.com/yatri-motorcycles/nodejs-starter.git

$ cd nodejs-starter

Install dependencies:

$ yarn install

Set environment variables:

$ cp .env.example .env

Import sample documents

$ yarn seed:import

Running Locally

$ yarn dev

Available Scripts

In the project directory, you can run:

Lint

# lint code with ESLint
$ yarn lint

# try to fix ESLint errors
$ yarn lint:fix

Test

# run all tests with Mocha
$ yarn test

Validate

# run lint and tests
$ yarn validate

Run debugger

$ yarn debug

Populate database collections with sample documents

$ yarn seed:import

Clear all database documents

$ yarn seed:delete

Contributing guide

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes.

Legal

© Yatri Motorcycles. All rights reserved.