Skip to content

Commit 7c8517e

Browse files
committed
update readme
1 parent 54d6b0c commit 7c8517e

File tree

1 file changed

+77
-29
lines changed

1 file changed

+77
-29
lines changed

README.md

Lines changed: 77 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,56 @@
11
# Node.js Backend Architecture Typescript Project
2-
Learn to build a Blogging platform like Medium, MindOrks, and FreeCodeCamp - Open-Source Project By Janishar Ali
2+
A complete project to build a blogging platform like Medium, and FreeCodeCamp
3+
4+
> 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)
35
46
<p align="center">
57
<img src="https://raw.githubusercontent.com/janishar/nodejs-backend-architecture-typescript/master/addons/github_assets/cover-nodejs-backend.png">
68
</p>
79
<br>
810

9-
## About this Open Source Project
10-
This open-source project is for you(community). I (https://janisharali.com) have taken this initiative to promote Backend Learning in the best possible way. I am determined to provide quality content for everyone. Let's do it together by learning from this project.
11+
# Project Highlights
12+
1. Node.js
13+
2. Express.js
14+
3. Typescript
15+
4. Mongoose
16+
5. Redis
17+
6. Mongodb
18+
7. Joi
19+
8. Unit Tests & Integration Tests
20+
9. Docker
21+
10. JWT
22+
23+
# About The Project
24+
This project is designed to be used in a production ready environment. It will handle the scale and complexity of very demanding applications. This project is used by companies like Mindorks, AfterAcademy, and CuriousJr, having 10+ million usebase.
25+
26+
It can be used to serve websites, mobile apps, and other API services.
27+
28+
# About The Author
29+
I, [Janishar Ali](https://janisharali.com) have created this project using my 10 years of experience in developing software for top tech companies. I enjoy sharing my learnings with the community. You can connect with me here:
30+
* [Twitter](https://twitter.com/janisharali)
31+
* [LinkedIn](https://www.linkedin.com/in/janishar-ali)
32+
* [Instagram](https://www.instagram.com/janisharali)
1133

12-
## We will learn and build the backend application for a blogging platform.
13-
The main focus will be to create a maintainable and highly testable architecture.
34+
[Learn from My YouTube Channel](https://www.youtube.com/@janisharali)
35+
36+
# Project Instructions
37+
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.
1438
<br>
1539
Following are the features of this project:
1640
* **This backend is written in Typescript**: The type safety at build time and having intellisense for it in the IDE like vscode is unparalleled to productivity. We have found production bug reduced to a significant amount since most of the code vulnerabilities are identified during the build phase itself.
17-
* **Separation of concern principle is applied**: Each component has been given a particular role. The role of the components is mutually exclusive. This makes the project easy to be unit tested.
18-
* **Feature encapsulation is adopted**: The files or components that are related to a particular feature have been grouped unless those components are required in multiple features. This enhances the ability to share code across projects.
19-
* **Centralised Error handling is done**: We have created a framework where all the errors are handled centrally. This reduces the ambiguity in the development when the project grows larger.
20-
* **Centralised Response handling is done**: Similar to Error handling we have a response handling framework. This makes it very convenient to apply a common API response pattern.
41+
* **Separation of concern principle**: Each component has been given a particular role. The role of the components is mutually exclusive. This makes the project easy to be unit tested.
42+
* **Feature encapsulation**: The files or components that are related to a particular feature have been grouped unless those components are required in multiple features. This enhances the ability to share code across projects.
43+
* **Centralised Error handling**: We have created a framework where all the errors are handled centrally. This reduces the ambiguity in the development when the project grows larger.
44+
* **Centralised Response handling**: Similar to Error handling we have a response handling framework. This makes it very convenient to apply a common API response pattern.
2145
* **Mongodb is used through Mongoose**: Mongodb fits very well to the node.js application. Being NoSQL, fast, and scalable makes it ideal for modern web applications.
22-
* **Async execution is adopted**: We have used async/await for the promises and made sure to use the non-blocking version of all the functions with few exceptions.
46+
* **Redis Memcache**: We have used the redis server for caching the items which does not change frequently. It will boost the performance of our system.
47+
* **Async execution**: We have used async/await for the promises and made sure to use the non-blocking version of all the functions with few exceptions.
2348
* **Docker compose has been configured**: We have created the Dockerfile to provide the easy deployability without any setup and configurations.
2449
* **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.
2550
* **A pure backend project**: We 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.
2651

27-
## We have also open source a complete blogging website working on this backend project: [Goto Repository](https://github.com/janishar/react-app-architecture)
28-
> In the above repository [**React.js Isomorphic Web Application Architecture**] we will learn and build a React web application for a blogging platform using this project as its API server. [Visit demo website](https://demo.react-app-architecture.afteracademy.com)
52+
> We have also open source a complete blogging website working on this backend project: [Goto Repository](https://github.com/janishar/react-app-architecture)
53+
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.
2954

3055
## 3RE Architecture: Router, RouteHandler, ResponseHandler, ErrorHandler
3156
<p align="center">
@@ -51,7 +76,7 @@ Following are the features of this project:
5176
* [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)
5277
* [TypeScript Tutorial For Beginners](https://afteracademy.com/blog/typescript-tutorial-for-beginners)
5378
* [From JavaScript to TypeScript](https://afteracademy.com/blog/from-javascript-to-typescript)
54-
* [Authentication vs Authorization](https://afteracademy.com/blog/authentication-vs-authorization)
79+
5580

5681
## You can find the complete API documentation [here](https://documenter.getpostman.com/view/1552895/SzYUZg52?version=latest)
5782
<a href="https://documenter.getpostman.com/view/1552895/SzYUZg52?version=latest" target="_blank">
@@ -92,6 +117,11 @@ Following are the features of this project:
92117

93118
## Project Directory Structure
94119
```
120+
├── .vscode
121+
│ ├── settings.json
122+
│ ├── tasks.json
123+
│ └── launch.json
124+
├── .templates
95125
├── src
96126
│ ├── server.ts
97127
│ ├── app.ts
@@ -106,7 +136,15 @@ Following are the features of this project:
106136
│ │ ├── ApiError.ts
107137
│ │ ├── ApiResponse.ts
108138
│ │ ├── JWT.ts
109-
│ │ └── Logger.ts
139+
│ │ ├── Logger.ts
140+
│ │ └── utils.ts
141+
│ ├── cache
142+
│ │   ├── index.ts
143+
│ │   ├── keys.ts
144+
│ │   ├── query.ts
145+
│ │   └── repository
146+
│ │   ├── BlogCache.ts
147+
│ │   └── BlogsCache.ts
110148
│ ├── database
111149
│ │ ├── index.ts
112150
│ │ ├── model
@@ -123,22 +161,29 @@ Following are the features of this project:
123161
│ │ └── UserRepo.ts
124162
│ ├── helpers
125163
│ │ ├── asyncHandler.ts
164+
│ │ ├── permission.ts
126165
│ │ ├── role.ts
166+
│ │ ├── security.ts
167+
│ │ ├── utils.ts
127168
│ │ └── validator.ts
128169
│ ├── routes
129170
│ │ └── v1
130171
│ │ ├── access
172+
│ │ │ ├── credential.ts
131173
│ │ │ ├── login.ts
132174
│ │ │ ├── logout.ts
133175
│ │ │ ├── schema.ts
134176
│ │ │ ├── signup.ts
135-
│ │ │ └── token.ts
177+
│ │ │ ├── token.ts
178+
│ │ │ └── utils.ts
136179
│ │ ├── blog
137-
│ │ │ ├── blogDetail.ts
138-
│ │ │ ├── blogList.ts
139180
│ │ │ ├── editor.ts
181+
│ │ │ ├── index.ts
140182
│ │ │ ├── schema.ts
141183
│ │ │ └── writer.ts
184+
│ │   ├── blogs
185+
│ │   │   ├── index.ts
186+
│ │   │   └── schema.ts
142187
│ │ ├── index.ts
143188
│ │ └── profile
144189
│ │ ├── schema.ts
@@ -163,22 +208,27 @@ Following are the features of this project:
163208
│ │ └── jwt
164209
│ │ ├── mock.ts
165210
│ │ └── unit.test.ts
211+
│ ├── cache
212+
│ │ └── mock.ts
213+
│ ├── database
214+
│ │ └── mock.ts
166215
│ ├── routes
167216
│ │ └── v1
168-
│ │ ├── blog
169-
│ │ │ ├── blogDetail
217+
│ │ ├── access
218+
│ │ │ ├── login
219+
│ │ │ │ ├── integration.test.ts
170220
│ │ │ │ ├── mock.ts
171221
│ │ │ │ └── unit.test.ts
172-
│ │ │ └── writer
222+
│ │ │ └── signup
173223
│ │ │ ├── mock.ts
174224
│ │ │ └── unit.test.ts
175-
│ │ ── login
176-
│ │ ├── integration.test.ts
177-
│ │ │ ├── mock.ts
178-
│ │ │ └── unit.test.ts
179-
│ │ └── signup
180-
│ │ ├── mock.ts
181-
│ │ └── unit.test.ts
225+
│ │ ── blog
226+
│ │ ├── index
227+
│ │ │ ├── mock.ts
228+
│ │ │ └── unit.test.ts
229+
│ │ └── writer
230+
│ │ ├── mock.ts
231+
│ │ └── unit.test.ts
182232
│ ├── .env.test
183233
│ └── setup.ts
184234
├── addons
@@ -194,8 +244,6 @@ Following are the features of this project:
194244
├── .prettierrc
195245
├── .prettierignore
196246
├── .travis.yml
197-
├── .vscode
198-
│ └── launch.json
199247
├── Dockerfile
200248
├── docker-compose.yml
201249
├── package-lock.json

0 commit comments

Comments
 (0)