|
1 | | -# TSNode-MongoDB-Rest-API |
2 | | -This repository houses a well-structured boilerplate of REST API using Node.js, TypeScript, Express & MongoDB 🖇 |
| 1 | +<a name="readme-top"></a> |
| 2 | +<div align="center"> |
| 3 | + |
| 4 | +  |
| 5 | +  |
| 6 | + |
| 7 | + <h1>TSNode & MongoDB REST API</h1> |
| 8 | + |
| 9 | + <p> |
| 10 | + well-structured boilerplate for REST API using Node.js, TypeScript, Express & MongoDB. |
| 11 | + </p> |
| 12 | + |
| 13 | +<!-- Badges --> |
| 14 | +<p> |
| 15 | + <a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API/graphs/contributors"> |
| 16 | + <img src="https://img.shields.io/github/contributors/ladunjexa/TSNode-MongoDB-REST-API" alt="contributors" /> |
| 17 | + </a> |
| 18 | + <a href=""> |
| 19 | + <img src="https://img.shields.io/github/last-commit/ladunjexa/TSNode-MongoDB-REST-API" alt="last update" /> |
| 20 | + </a> |
| 21 | + <a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API/network/members"> |
| 22 | + <img src="https://img.shields.io/github/forks/ladunjexa/TSNode-MongoDB-REST-API" alt="forks" /> |
| 23 | + </a> |
| 24 | + <a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API/stargazers"> |
| 25 | + <img src="https://img.shields.io/github/stars/ladunjexa/TSNode-MongoDB-REST-API" alt="stars" /> |
| 26 | + </a> |
| 27 | + <a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API/issues/"> |
| 28 | + <img src="https://img.shields.io/github/issues/ladunjexa/TSNode-MongoDB-REST-API" alt="open issues" /> |
| 29 | + </a> |
| 30 | + <a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API/blob/master/LICENSE"> |
| 31 | + <img src="https://img.shields.io/github/license/ladunjexa/TSNode-MongoDB-REST-API.svg" alt="license" /> |
| 32 | + </a> |
| 33 | +</p> |
| 34 | + |
| 35 | + <h4> |
| 36 | + <a href="https://ai-powered-3-d-product-web.vercel.app/">View Demo</a> |
| 37 | + <span> · </span> |
| 38 | + <a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API">Documentation</a> |
| 39 | + <span> · </span> |
| 40 | + <a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API/issues/">Report Bug</a> |
| 41 | + <span> · </span> |
| 42 | + <a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API/issues/">Request Feature</a> |
| 43 | + </h4> |
| 44 | +</div> |
| 45 | + |
| 46 | +<br /> |
| 47 | + |
| 48 | +<!-- Table of Contents --> |
| 49 | +<details> |
| 50 | + |
| 51 | +<summary> |
| 52 | + |
| 53 | +# :notebook_with_decorative_cover: Table of Contents |
| 54 | + |
| 55 | +</summary> |
| 56 | + |
| 57 | +- [About the Project](#star2-about-the-project) |
| 58 | + * [Folder Structure](#bangbang-folder-structure) |
| 59 | + * [Tech Stack](#space_invader-tech-stack) |
| 60 | +- [Getting Started](#toolbox-getting-started) |
| 61 | + * [Environment Variables](#key-environment_variables) |
| 62 | + * [Installation](#gear-installation) |
| 63 | + * [Run Locally](#running-run-locally) |
| 64 | +- [Contributing](#wave-contributing) |
| 65 | +- [License](#warning-license) |
| 66 | +- [Contact](#handshake-contact) |
| 67 | +- [Acknowledgements](#gem-acknowledgements) |
| 68 | + |
| 69 | +</details> |
| 70 | + |
| 71 | +<!-- About the Project --> |
| 72 | +## :star2: About the Project |
| 73 | + |
| 74 | +<!-- <div align="center"> |
| 75 | + <img src="readme_assets/mock.png" height="auto" width="90%"/> |
| 76 | +</div> --> |
| 77 | + |
| 78 | +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. |
| 79 | +REST API built with TypeScript, Node.js, Express & MongoDB. |
| 80 | + |
| 81 | +<!-- Folder Structure --> |
| 82 | +### :bangbang: Folder Structure |
| 83 | + |
| 84 | +Here is the folder structure of REST API. |
| 85 | +```bash |
| 86 | +TSNode-MongoDB-REST-API/ |
| 87 | +|- server/ |
| 88 | + |-- src/ |
| 89 | + |-- controllers/ |
| 90 | + |-- db/ |
| 91 | + |-- helpers/ |
| 92 | + |-- middlewares/ |
| 93 | + |-- router/ |
| 94 | + |-- index.ts |
| 95 | + |-- .env |
| 96 | + |-- nodemon.json |
| 97 | + |-- tsconfig.json |
| 98 | + |-- package.json |
| 99 | +``` |
| 100 | +<br /> |
| 101 | + |
| 102 | +<!-- TechStack --> |
| 103 | +### :space_invader: Tech Stack |
| 104 | + |
| 105 | +[](https://skillicons.dev) |
| 106 | + |
| 107 | +<p align="right">(<a href="#readme-top">back to top</a>)</p> |
| 108 | + |
| 109 | +<!-- Getting Started --> |
| 110 | +## :toolbox: Getting Started |
| 111 | + |
| 112 | +<!-- ENV VARIABLES --> |
| 113 | +### :key: Environment Variables |
| 114 | + |
| 115 | +In order to use this REST API you have to add some environment variables to .env file, |
| 116 | + |
| 117 | +##### _server-side_ [server/.env] |
| 118 | +create `.env` file in `server/` directory & add the following environment variables: |
| 119 | +```env |
| 120 | +SESSION_TOKEN_NAME=<SESSION_TOKEN_NAME> |
| 121 | +MONGODB_URL=<MONGODB_URL> |
| 122 | +SECRET=<REST_API_SECRET> |
| 123 | +PORT=<PORT> // optional, default set to 8080 |
| 124 | +``` |
| 125 | + |
| 126 | +<!-- Installation --> |
| 127 | +### :gear: Installation |
| 128 | + |
| 129 | +#### Step 1: |
| 130 | +Download or clone this repo by using the command below: |
| 131 | + |
| 132 | +```bash |
| 133 | + https://github.com/ladunjexa/TSNode-MongoDB-REST-API.git |
| 134 | +``` |
| 135 | + |
| 136 | +#### Step 2: |
| 137 | + |
| 138 | +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) |
| 139 | + |
| 140 | +```bash |
| 141 | + node -v |
| 142 | +``` |
| 143 | + |
| 144 | +#### Step 3: |
| 145 | + |
| 146 | +In `server` folder execute the following command to get the required packages: |
| 147 | + |
| 148 | +```bash |
| 149 | + npm install |
| 150 | +``` |
| 151 | + |
| 152 | +<!-- Run Locally --> |
| 153 | +### :running: Run Locally |
| 154 | + |
| 155 | +#### Step 1: |
| 156 | + |
| 157 | +Go to `server` folder and execute the following command in order to start the server: |
| 158 | + |
| 159 | +```bash |
| 160 | + npm start |
| 161 | +``` |
| 162 | + |
| 163 | +<p align="right">(<a href="#readme-top">back to top</a>)</p> |
| 164 | + |
| 165 | +<!-- Contributing --> |
| 166 | +## :wave: Contributing |
| 167 | + |
| 168 | +<a href="https://github.com/ladunjexa/TSNode-MongoDB-REST-API/graphs/contributors"> |
| 169 | + <img src="https://contrib.rocks/image?repo=ladunjexa/TSNode-MongoDB-REST-API" /> |
| 170 | +</a> |
| 171 | + |
| 172 | + |
| 173 | +Contributions are always welcome! |
| 174 | + |
| 175 | +See [`contributing.md`](https://contributing.md/) for ways to get started. |
| 176 | + |
| 177 | +Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. |
| 178 | + |
| 179 | +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". |
| 180 | +Don't forget to give the project a star! Thanks again! |
| 181 | + |
| 182 | +1. Fork the Project |
| 183 | +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) |
| 184 | +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) |
| 185 | +4. Push to the Branch (`git push origin feature/AmazingFeature`) |
| 186 | +5. Open a Pull Request |
| 187 | + |
| 188 | +<p align="right">(<a href="#readme-top">back to top</a>)</p> |
| 189 | + |
| 190 | +<!-- License --> |
| 191 | +## :warning: License |
| 192 | + |
| 193 | +Distributed under the MIT License. See [LICENSE.txt](https://github.com/ladunjexa/TSNode-MongoDB-REST-API/blob/main/LICENSE) for more information. |
| 194 | + |
| 195 | +<p align="right">(<a href="#readme-top">back to top</a>)</p> |
| 196 | + |
| 197 | +<!-- Contact --> |
| 198 | +## :handshake: Contact |
| 199 | + |
| 200 | +Liron Abutbul - [@lironabutbul6](https://twitter.com/lironabutbul6) - [@ladunjexa](https://t.me/ladunjexa) |
| 201 | + |
| 202 | +Project Link: [https://github.com/ladunjexa/TSNode-MongoDB-REST-API](https://github.com/ladunjexa/TSNode-MongoDB-REST-API) |
| 203 | + |
| 204 | +<p align="right">(<a href="#readme-top">back to top</a>)</p> |
| 205 | + |
| 206 | +<!-- Acknowledgments --> |
| 207 | +## :gem: Acknowledgements |
| 208 | + |
| 209 | +This section used to mention useful resources and libraries that used in the REST API: |
| 210 | + |
| 211 | +#### server-side |
| 212 | + |
| 213 | +- [Body Parser](https://www.npmjs.com/package/body-parser) |
| 214 | +- [Compression](https://www.npmjs.com/package/compression) |
| 215 | +- [Cookie Parser](https://www.npmjs.com/package/cookie-parser) |
| 216 | +- [CORS](https://www.npmjs.com/package/cors) |
| 217 | +- [dotenv](https://www.npmjs.com/package/dotenv) |
| 218 | +- [Express.js](https://expressjs.com/) |
| 219 | +- [lodash](https://lodash.com/) |
| 220 | +- [mongoose.js](https://mongoosejs.com/) |
| 221 | +- [Nodemon](https://www.npmjs.com/package/nodemon) |
| 222 | + |
| 223 | +<p align="right">(<a href="#readme-top">back to top</a>)</p> |
0 commit comments