/tsnode-express-mongodb-boilerplate

well-structured boilerplate for REST API using Node.js, TypeScript, Express & MongoDB ๐Ÿช

Primary LanguageTypeScriptMIT LicenseMIT

Project Banner Project Banner

TSNode & MongoDB REST API

well-structured boilerplate for REST API using Node.js, TypeScript, Express & MongoDB.

contributors last update forks stars open issues license


๐Ÿ“” Table of Contents

๐ŸŒŸ About the Project

This repository houses a well-structured REST API for User Management powered by MongoDB with cookie based authentication, with the abilities to Create, Read, Update users. REST API built with TypeScript, Node.js, Express & MongoDB.

โ€ผ๏ธ Folder Structure

Here is the folder structure of REST API.

TSNode-MongoDB-REST-API/
|- server/
  |-- src/
    |-- controllers/
    |-- db/
    |-- helpers/
    |-- middlewares/
    |-- router/
    |-- index.ts
  |-- .env
  |-- nodemon.json
  |-- tsconfig.json
  |-- package.json

๐Ÿ‘พ Tech Stack

My Skills

(back to top)

๐Ÿงฐ Getting Started

๐Ÿ”‘ Environment Variables

In order to use this REST API you have to add some environment variables to .env file,

server-side [server/.env]

create .env file in server/ directory & add the following environment variables:

SESSION_TOKEN_NAME=<SESSION_TOKEN_NAME>
MONGODB_URL=<MONGODB_URL>
SECRET=<REST_API_SECRET>
PORT=<PORT> // optional, default set to 8080

โš™๏ธ Installation

Step 1:

Download or clone this repo by using the command below:

 https://github.com/ladunjexa/TSNode-MongoDB-REST-API.git

Step 2:

This REST API using NPM (Node Package Manager), therefore, make sure that Node.js is installed by execute the following command in console: (minimum Node 14.x)

  node -v

Step 3:

In server folder execute the following command to get the required packages:

  npm install

๐Ÿƒ Run Locally

Step 1:

Go to server folder and execute the following command in order to start the server:

  npm start

(back to top)

๐Ÿ‘‹ Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

โš ๏ธ License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

๐Ÿค Contact

Liron Abutbul - @lironabutbul6 - @ladunjexa

Project Link: https://github.com/ladunjexa/TSNode-MongoDB-REST-API

(back to top)

๐Ÿ’Ž Acknowledgements

This section used to mention useful resources and libraries that used in the REST API:

server-side

(back to top)