Skip to content

Commit 7065d4e

Browse files
committed
update readme
1 parent 74314b2 commit 7065d4e

File tree

3 files changed

+91
-65
lines changed

3 files changed

+91
-65
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2025 FIFOCODE
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 90 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
---
2-
### :tada: Announcement
3-
#### A new repository based on Nest.js is also available here [Modern Backend Development - WhereIsMyMotivation](https://github.com/unusualcodeorg/wimm-node-app) :confetti_ball:
4-
---
5-
61
# Node.js Backend Architecture Typescript Project
72
### A complete project to build a blogging platform like Medium, and FreeCodeCamp
83

9-
[![Docker Compose CI](https://github.com/janishar/nodejs-backend-architecture-typescript/actions/workflows/docker_compose.yml/badge.svg)](https://github.com/janishar/nodejs-backend-architecture-typescript/actions/workflows/docker_compose.yml)
4+
[![Docker Compose CI](https://github.com/fifocode/nodejs-backend-architecture-typescript/actions/workflows/docker_compose.yml/badge.svg)](https://github.com/fifocode/nodejs-backend-architecture-typescript/actions/workflows/docker_compose.yml)
105

11-
Note: This is the **latest (version 2)** of the project. If you are using **version 1** then checkout the branch [**version-1**](https://github.com/janishar/nodejs-backend-architecture-typescript/tree/version-1)
6+
Note: This is the **latest (version 2)** of the project. If you are using **version 1** then checkout the branch [**version-1**](https://github.com/fifocode/nodejs-backend-architecture-typescript/tree/version-1)
127

138
<p align="center">
14-
<img src="https://raw.githubusercontent.com/janishar/nodejs-backend-architecture-typescript/master/addons/github_assets/cover-nodejs-backend.png">
9+
<img src="https://raw.githubusercontent.com/janishar/nodejs-backend-architecture-typescript/main/addons/github_assets/cover-nodejs-backend.png">
1510
</p>
1611
<br>
1712

@@ -33,10 +28,10 @@ This project is designed for a production ready environment. It can handle the s
3328
It is suitable for Web Apps, Mobile Apps, and other API services.
3429

3530
# About The Author
36-
You can connect with me here:
37-
* [Janishar Ali](https://janisharali.com)
38-
* [Twitter](https://twitter.com/janisharali)
39-
* [YouTube Channel](https://www.youtube.com/@unusualcode)
31+
You can connect with us here:
32+
* [Website](https://fifocode.com)
33+
* [Twitter](https://twitter.com/fifocode)
34+
* [YouTube Channel](https://www.youtube.com/@fifocode)
4035

4136
# Project Instructions
4237
We will learn and build the backend application for a blogging platform. The main focus will be to create a maintainable and highly testable architecture.
@@ -54,77 +49,108 @@ Following are the features of this project:
5449
* **Unit test is favored**: The tests have been written to test the functions and routes without the need of the database server. Integration tests has also been done but the unit test is favored.
5550
* **A pure backend project**: I have experienced that when a backend is developed clubbed with a frontend then in the future it becomes really difficult to scale. We would want to create a separate backend project that servers many websites and mobile apps.
5651

57-
> I have also open source a complete blogging website working on this backend project: [Goto Repository](https://github.com/janishar/react-app-architecture)
58-
The repository [**React.js Isomorphic Web Application Architecture**] has a complete React.js web application implemented for a blogging platform which is using this project as its API server.
5952

6053
## 3RE Architecture: Router, RouteHandler, ResponseHandler, ErrorHandler
6154
<p align="center">
62-
<img src="https://raw.githubusercontent.com/janishar/nodejs-backend-architecture-typescript/master/addons/github_assets/3RE.png">
55+
<img src="https://raw.githubusercontent.com/fifocode/nodejs-backend-architecture-typescript/main/addons/github_assets/3RE.png">
6356
</p>
6457
<br>
6558

6659
## Project Outline: Blogging Platform
6760
<p align="center">
68-
<img src="https://raw.githubusercontent.com/janishar/nodejs-backend-architecture-typescript/master/addons/github_assets/project-outline.png">
61+
<img src="https://raw.githubusercontent.com/fifocode/nodejs-backend-architecture-typescript/main/addons/github_assets/project-outline.png">
6962
</p>
7063
<br>
7164

7265
## Request-Response Handling Schematic Diagram
7366
<p align="center">
74-
<img src="https://raw.githubusercontent.com/janishar/nodejs-backend-architecture-typescript/master/addons/github_assets/api-structure.png">
67+
<img src="https://raw.githubusercontent.com/fifocode/nodejs-backend-architecture-typescript/main/addons/github_assets/api-structure.png">
7568
</p>
7669
<br>
7770

7871
## Learn the concepts used in this project
79-
* [Design Node.js Backend Architecture like a Pro](https://janisharali.com/blog/design-node-js-backend-architecture-like-a-pro)
72+
* [Design Node.js Backend Architecture like a Pro](https://fifocode.com/article/design-node-js-backend-architecture-like-a-pro)
8073
* [The video guide to build and run this project](https://youtu.be/t7blRxqPIMs)
81-
* [Implement JSON Web Token (JWT) Authentication using AccessToken and RefreshToken](https://janisharali.com/blog/implement-json-web-token-jwt-authentication-using-access-token-and-refresh-token)
82-
* [TypeScript Tutorial For Beginners](https://afteracademy.com/blog/typescript-tutorial-for-beginners)
83-
* [From JavaScript to TypeScript](https://afteracademy.com/blog/from-javascript-to-typescript)
84-
85-
86-
## You can find the complete API documentation [here](https://documenter.getpostman.com/view/1552895/2s8Z6u4a6N)
87-
<a href="https://documenter.getpostman.com/view/1552895/2s8Z6u4a6N" target="_blank">
88-
<img src="https://raw.githubusercontent.com/afteracademy/nodejs-backend-architecture-typescript/master/addons/github_assets/api-doc-button.png" width="200" height="60"/>
89-
</a>
90-
91-
## How to build and run this project
92-
93-
* Install using Docker Compose [**Recommended Method**]
94-
* Clone this repo.
95-
* Make a copy of **.env.example** file to **.env**.
96-
* Make a copy of **keys/private.pem.example** file to **keys/private.pem**.
97-
* Make a copy of **keys/public.pem.example** file to **keys/public.pem**.
98-
* Make a copy of **tests/.env.test.example** file to **tests/.env.test**.
99-
* Install Docker and Docker Compose. [Find Instructions Here](https://docs.docker.com/install/).
100-
* Execute `docker-compose up -d` in terminal from the repo directory.
101-
* You will be able to access the api from http://localhost:3000
102-
* Run Tests: `docker exec -t app npm test`
103-
* *If having any issue* then make sure 3000 port is not occupied else provide a different port in **.env** file.
104-
* *If having any issue* then make sure 27017 port is not occupied else provide a different port in **.env** file.
105-
* Run The Tests
106-
* Install node.js and npm on your local machine.
107-
* From the root of the project executes in terminal `npm install`.
108-
* *Use the latest version of node on the local machine if the build fails*.
109-
* To run the tests execute `npm test`.
110-
* Install Without Docker [**2nd Method**]
111-
* Install MongoDB on your local.
112-
* Do steps 1 to 5 as listed for **Install using Docker Compose**.
113-
* Do steps 1 to 3 as listed for **Run The Tests**.
114-
* Create users in MongoDB and seed the data taking reference from the **addons/init-mongo.js**
115-
* Change the `DB_HOST` to `localhost` in **.env** and **tests/.env.test** files.
116-
* Execute `npm start` and You will be able to access the API from http://localhost:3000
117-
* To run the tests execute `npm test`.
118-
119-
* Postman APIs Here:
120-
[addons/postman](https://github.com/janishar/nodejs-backend-architecture-typescript/tree/master/addons/postman)
74+
* [Implement JSON Web Token (JWT) Authentication using AccessToken and RefreshToken](https://fifocode.com/article/implement-json-web-token-jwt-authentication-using-access-token-and-refresh-token)
75+
* [TypeScript Tutorial For Beginners](https://fifocode.com/article/typescript-tutorial-for-beginners)
76+
* [From JavaScript to TypeScript](https://fifocode.com/article/from-javascript-to-typescript)
77+
78+
79+
# How to build and run this project
80+
vscode is the recommended editor - dark theme
81+
82+
### Get the repo
83+
```bash
84+
# clone repository recursively
85+
git clone https://github.com/fifocode/nodejs-backend-architecture-typescript.git
86+
```
87+
88+
### Run Docker Compose
89+
- Install Docker and Docker Compose. [Find Instructions Here](https://docs.docker.com/install/).
90+
91+
```bash
92+
# install and start docker containers
93+
docker-compose up --build
94+
```
95+
96+
- You will be able to access the api from http://localhost:3000
97+
98+
### Run Tests
99+
```bash
100+
docker exec -t blogs-tester npm run test
101+
```
102+
103+
If having any issue
104+
- Make sure 3000 port is not occupied else change PORT in **.env** file.
105+
- Make sure 27017 port is not occupied else change DB_PORT in **.env** file.
106+
- Make sure 6379 port is not occupied else change REDIS_PORT in **.env** file.
107+
108+
## Run on the local machine
109+
Change the following hosts in the **.env** and **.env.test**
110+
- DB_HOST=localhost
111+
- REDIS_HOST=localhost
112+
113+
Best way to run this project is to use the vscode `Run and Debug` button. Scripts are available for debugging and template generation on vscode.
114+
115+
- Install node.js and npm on your local machine.
116+
117+
```bash
118+
# From the root of the project executes
119+
$ npm install
120+
```
121+
122+
### Stop the app and tester docker container
123+
```bash
124+
$ docker compose stop tester
125+
$ docker compose stop app
126+
```
127+
128+
### Run the app
129+
130+
```bash
131+
# production mode
132+
$ npm start
133+
or
134+
# watch mode
135+
$ npm run watch
136+
```
137+
138+
### Test
139+
140+
```bash
141+
# unit and integration tests
142+
$ npm test
143+
```
144+
145+
## API DOC
146+
[![API Documentation](https://img.shields.io/badge/API%20Documentation-View%20Here-blue?style=for-the-badge)](https://documenter.getpostman.com/view/1552895/2s8Z6u4a6N)
121147

122-
## Learn Backend Development From Our Videos
148+
## Learn Backend Development From Our Videos
123149
* [Introduction to Web Backend Development for Beginners](https://youtu.be/SikmqyFocKQ)
124150
* [Backend System Design for Startups](https://youtube.com/playlist?list=PLuppOTn4pNYeAn-ioA-Meec5I8pQK_gU5)
125151
* [Practical Javascript for Beginners](https://youtube.com/playlist?list=PLuppOTn4pNYdowBb05yG2I8wAmHiW7vze)
126152

127-
## Project Directory Structure
153+
## Project Directory Structure
128154
```
129155
├── .vscode
130156
│ ├── settings.json
@@ -236,14 +262,14 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
236262
│ │ └── writer
237263
│ │ ├── mock.ts
238264
│ │ └── unit.test.ts
239-
│ ├── .env.test
240265
│ └── setup.ts
241266
├── addons
242267
│ └── init-mongo.js
243268
├── keys
244269
│ ├── private.pem
245270
│ └── public.pem
246271
├── .env
272+
├── .env.test
247273
├── .gitignore
248274
├── .dockerignore
249275
├── .eslintrc
@@ -259,10 +285,10 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
259285
└── tsconfig.json
260286
```
261287

262-
## Directory Traversal for Signup API call
288+
## Directory Traversal for Signup API call
263289
`/src → server.ts → app.ts → /routes/index.ts → /auth/apikey.ts → schema.ts → /helpers/validator.ts → asyncHandler.ts → /routes/access/signup.ts → schema.ts → /helpers/validator.ts → asyncHandler.ts → /database/repository/UserRepo.ts → /database/model/User.ts → /core/ApiResponses.ts`
264290

265-
## API Examples
291+
## API Examples
266292
* Signup
267293
* Method and Headers
268294
```
@@ -352,7 +378,7 @@ The repository [**React.js Isomorphic Web Application Architecture**] has a comp
352378
353379
### License
354380
```
355-
Copyright (C) 2024 JANISHAR ALI ANWAR
381+
Copyright (C) 2025 FIFOCODE
356382

357383
Licensed under the Apache License, Version 2.0 (the "License");
358384
you may not use this file except in compliance with the License.
-14.9 KB
Binary file not shown.

0 commit comments

Comments
 (0)