Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ladunjexa/tsnode-express-mongodb-boilerplate

well-structured boilerplate for REST API using Node.js, TypeScript, Express & MongoDB ๐Ÿช
https://github.com/ladunjexa/tsnode-express-mongodb-boilerplate

backend-api-boilerplate best-practices expressjs mongoosejs rest-api-boilerplate typescript-nodejs

Last synced: 12 days ago
JSON representation

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

Awesome Lists containing this project

README

        


![Project Banner](readme_assets/readme_banner.png#gh-dark-mode-only)
![Project Banner](readme_assets/readme_banner-light.png#gh-light-mode-only)

TSNode & MongoDB REST API




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



contributors


last update


forks


stars


open issues


license




View Demo
ยท
Documentation
ยท
Report Bug
ยท
Request Feature



# :notebook_with_decorative_cover: Table of Contents

- [About the Project](#star2-about-the-project)
* [Folder Structure](#bangbang-folder-structure)
* [Tech Stack](#space_invader-tech-stack)
- [Getting Started](#toolbox-getting-started)
* [Environment Variables](#key-environment_variables)
* [Installation](#gear-installation)
* [Run Locally](#running-run-locally)
- [Contributing](#wave-contributing)
- [License](#warning-license)
- [Contact](#handshake-contact)
- [Acknowledgements](#gem-acknowledgements)

## :star2: 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.

### :bangbang: Folder Structure

Here is the folder structure of REST API.
```bash
TSNode-MongoDB-REST-API/
|- server/
|-- src/
|-- controllers/
|-- db/
|-- helpers/
|-- middlewares/
|-- router/
|-- index.ts
|-- .env
|-- nodemon.json
|-- tsconfig.json
|-- package.json
```

### :space_invader: Tech Stack

[![My Skills](https://skillicons.dev/icons?i=ts,nodejs,express,mongodb)](https://skillicons.dev)

(back to top)

## :toolbox: Getting Started

### :key: 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:
```env
SESSION_TOKEN_NAME=
MONGODB_URL=
SECRET=
PORT= // optional, default set to 8080
```

### :gear: Installation

#### Step 1:
Download or clone this repo by using the command below:

```bash
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)

```bash
node -v
```

#### Step 3:

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

```bash
npm install
```

### :running: Run Locally

#### Step 1:

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

```bash
npm start
```

(back to top)

## :wave: Contributing



Contributions are always welcome!

See [`contributing.md`](https://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)

## :warning: License

Distributed under the MIT License. See [LICENSE.txt](https://github.com/ladunjexa/TSNode-MongoDB-REST-API/blob/main/LICENSE) for more information.

(back to top)

## :handshake: Contact

Liron Abutbul - [@lironabutbul6](https://twitter.com/lironabutbul6) - [@ladunjexa](https://t.me/ladunjexa)

Project Link: [https://github.com/ladunjexa/TSNode-MongoDB-REST-API](https://github.com/ladunjexa/TSNode-MongoDB-REST-API)

(back to top)

## :gem: Acknowledgements

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

#### server-side

- [Body Parser](https://www.npmjs.com/package/body-parser)
- [Compression](https://www.npmjs.com/package/compression)
- [Cookie Parser](https://www.npmjs.com/package/cookie-parser)
- [CORS](https://www.npmjs.com/package/cors)
- [dotenv](https://www.npmjs.com/package/dotenv)
- [Express.js](https://expressjs.com/)
- [lodash](https://lodash.com/)
- [mongoose.js](https://mongoosejs.com/)
- [Nodemon](https://www.npmjs.com/package/nodemon)

(back to top)