Skip to content

A Node JS structure following some of the most best practices from other top frameworks - Built on the top of Express JS

Notifications You must be signed in to change notification settings

saumya04/Nodular

Repository files navigation

Nodular Backend App - NodeJS

nodular logo

A "modular" / "nodular" Node.js App using Express 4 to serve APIs & web-based views. A breif of this structure can be found in this article

Overall App Structure

├───.docker
│   └───data
│       └───mysql
│           ├───nodular
│           ├───mysql
│           ├───performance_schema
│           └───sys
├───app
│   ├───commands
│   ├───contracts
│   ├───errors
│   ├───helpers
│   ├───http
│   │   ├───controllers
│   │   │   └───api
│   │   │       └───v1
│   │   ├───middlewares
│   │   │   └───policies
│   │   └───responses
│   ├───models
│   ├───providers
│   ├───repositories
│   ├───services
│   ├───tasks
│   │   ├───DatabaseNotification
│   │   └───Imports
│   │       └───Student
│   ├───transformers
│   ├───utilities
│   │   ├───AWS
│   │   ├───fcm
│   │   ├───Logger
│   │   ├───mail
│   │   ├───paginator
│   │   └───passport
│   └───validators
├───config
├───database
│   ├───migrations
│   ├───raw-query
│   └───seeders
├───public
│   ├───images
│   └───samples
├───routes
├───storage
│   ├───conversations
│   ├───imports
│   └───logs
├───uploads
│   ├───documents
│   └───images
└───views
    └───emails
        └───auth

Running Locally

Make sure you have Node.js installed.

git clone git@bitbucket.org:saumya04/Nodular.git # or clone your own fork
cd Nodular
npm install
npm start

Your app should now be running on localhost:3000. (Port depends upon the values from your env file)

Documentation

This app is following the nodejs (express) boilerplate from hackathon-starter project

Docker Help

Commands to start and stop containers for this app:

  • Command to start the containers ("--build" is for rebuilding with the dockerfile)
    docker-compose -f .docker/docker-compose.yml up -d --build
    
  • Command to stop the containers (with rebuilding the dockerfile)
    docker-compose -f .docker/docker-compose.yml stop
    
  • Command to kill a specific container
    docker kill {container_name_or_id}`
    
  • Command to remove a specific container
    docker rm {container_name_or_id}
    

All about Crons

  • running a cron
0 * * * * /usr/local/bin/node app/commands/cron-job.js
tail -f /var/log/cron.log

About

A Node JS structure following some of the most best practices from other top frameworks - Built on the top of Express JS

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages