Giter VIP home page Giter VIP logo

desend's Introduction

RESTful API Node Server with User Auth Boilerplate

A boilerplate/starter project for quickly building RESTful APIs using Node.js, Express, and Postgres SQL.

By running following command, you will get a Node.js app installed and fully configured on your machine. The app comes with many built-in features, such as authentication using JWT , Forgot and Reset Password etc. For more details, check the features list below.

Installation

If you want to do the installation , follow these steps:

Clone the repo:

git clone URL

Install the dependencies:

npm install

Set the environment variables:

# open .env and modify the environment variables (if needed)
npm run sync:db
npm run seed:db
npm start

Features

  • Authentication and authorization: using passport
  • Error handling: centralized error handling mechanism
  • Process management: advanced production process management using PM2
  • Environment variables: using dotenv
  • CORS: Cross-Origin Resource-Sharing enabled using cors

Commands

Running locally:

npm start

Running in production:

npm run prod

Environment Variables

The environment variables can be found and modified in the .env file. They come with these default values:

# Port number
PORT=8000

# URL of the Postgres DB
DB_HOST=localhost

# JWT
# JWT secret key
JWT_SECRET=smart-key
# SMTP configuration options for the email service
# For testing, you can use a fake SMTP service like Ethereal: https://ethereal.email/create
SMTP_HOST=email-server
SMTP_PORT=587
SMTP_USERNAME=email-server-username
SMTP_PASSWORD=email-server-password
[email protected]

Project Structure

src\
 |--config\         # Environment variables and configuration related things
 |--controllers\    # Route controllers (controller layer)
 |--middlewares\    # Custom express middlewares
 |--models\         # {Postgres} models (data layer)
 |--routes\         # Routes
 |--utils\          # Utility classes and functions
 |--app.js          # Express app
 |--bin
    |--www        # App entry point

API Endpoints

List of available routes:

Postman Collection

https://www.getpostman.com/collections/5a44fa118e99cda49a79

Inspirations

License

MIT

desend's People

Contributors

mtalhakhan326 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.