Skip to content

Commit bdcd15d

Browse files
committed
2 parents 33a4ba8 + a9cacfa commit bdcd15d

File tree

1 file changed

+126
-8
lines changed

1 file changed

+126
-8
lines changed

README.md

+126-8
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ The main focus will be to create a maintainable and highly testable architecture
1616
<br>
1717
Following are the features of this project:
1818
* **This backend in written in Typescript**: The type safety at build time and having intellisense for it in the IDE like vscode is unparallel to productivity. We have found production bug reduced to significant amount, since most of the code vulnarabilties are identified during the build phase itself.
19-
* **Separation of concern principle is applied**: Each component has been given a particular role. The role of the components are mutually excllusive. This makes the project easy to be unit tested.
20-
* **Feature enpasulation is adopted**: The files or components those are related to a particular feature has been grouped together unless that components is required in multiple features.This enhances the ability to share code across projects.
21-
* **Centralised Error handling is done**: We have created a framework where all the error is handled centrally. This reduces the abiguity in the developement when the project grows larger.
19+
* **Separation of concern principle is applied**: Each component has been given a particular role. The role of the components are mutually exclusive. This makes the project easy to be unit tested.
20+
* **Feature enpasulation is adopted**: The files or components those are related to a particular feature has been grouped together unless that components is required in multiple features. This enhances the ability to share code across projects.
21+
* **Centralised Error handling is done**: We have created a framework where all the errors are handled centrally. This reduces the ambiguity in the developement when the project grow larger.
2222
* **Centralised Response handling is done**: Similar to Error handling we have response handling framework. This makes it very convinient to apply a common API response pattern.
2323
* **Mongodb is used through Mongoose**: Mongodb really fits very well to the nodejs application. Being nosql, fast, and scalable makes it ideal for the modern web applications.
2424
* **Async execution is adopted**: We have used async/await for the promises and made sure to use non blocking version of all the functions with few exceptions.
25-
* **Docker compose has been configured**: We Dockerfile has been created to assist in easy deployability without setup and much configurations.
25+
* **Docker compose has been configured**: We have created the Dockerfile to provide the easy deployability without any setup and configurations.
2626
* **Unit test is favoured**: The tests has been written to test the functions and routes without the need of the database server. Integration tests has also been done but unit test is favoured.
27-
* **A pure backend project**: We have experienced that when a backend is developed clubed with a frontend then in the future it become really difficult to scale. We would want to use a single backend project to server many websites and mobile apps.
27+
* **A pure backend project**: We have experienced that when a backend is developed clubed with a frontend then in the future it become really difficult to scale. We would want to create a separate backend project that servers many websites and mobile apps.
2828

2929
## 3RE Architecture: Router, RouteHandler, ResponseHandler, ErrorHandler
3030
<p align="center">
@@ -60,8 +60,8 @@ Following are the features of this project:
6060
* Install Docker and Docker Compose. [Find Instructions Here](https://docs.docker.com/install/).
6161
* Execute `docker-compose up -d` in terminal from the repo directory.
6262
* You will be able to access the api from http://localhost:3000
63-
* *If having any issue* then make sure 3000 port is not occupied else update a different port in **.env** file.
64-
* *If having any issue* then make sure 27017 port is not occupied else update a different port in **.env** file.
63+
* *If having any issue* then make sure 3000 port is not occupied else provide a different port in **.env** file.
64+
* *If having any issue* then make sure 27017 port is not occupied else provide a different port in **.env** file.
6565
* Run The Tests
6666
* Install nodejs and npm on your local machine.
6767
* From the root of the project execute in terminal `npm install`.
@@ -77,9 +77,127 @@ Following are the features of this project:
7777
* To run the tests execute `npm test`.
7878

7979
## Explore Online Tutorials and Courses To Learn More by AfterAcademy
80-
* [Backend Tutorial](https://afteracademy.com/blogs/backend) - All Free Tutorials by AfterAcademy
80+
* [Backend Tutorial](https://afteracademy.com/blogs/backend) - All free tutorials by AfterAcademy
8181
* [Online Courses for Backend](https://afteracademy.com/courses/backend) - Master the skills that companies love to hire.
8282

83+
## Learn Backend Development From Our Videos
84+
* [Introduction to Web Backend Development for Beginners](https://youtu.be/Q0nfLi-4GBg)
85+
* [Backend System Design for Startups](https://www.youtube.com/playlist?list=PLqOiaH9id5quh5Dph5yuXfdHVGe1LrKvT)
86+
* [Practical Javascript for Beginners](https://www.youtube.com/playlist?list=PLqOiaH9id5qtw5MhI-C1G3CS7RVZ8ejct)
87+
88+
## Project Directory Structure
89+
```
90+
├── src
91+
│ ├── server.ts
92+
│ ├── app.ts
93+
│ ├── config.ts
94+
│ ├── auth
95+
│ │ ├── apikey.ts
96+
│ │ ├── authUtils.ts
97+
│ │ ├── authentication.ts
98+
│ │ ├── authorization.ts
99+
│ │ └── schema.ts
100+
│ ├── core
101+
│ │ ├── ApiError.ts
102+
│ │ ├── ApiResponse.ts
103+
│ │ ├── JWT.ts
104+
│ │ └── Logger.ts
105+
│ ├── database
106+
│ │ ├── index.ts
107+
│ │ ├── model
108+
│ │ │ ├── ApiKey.ts
109+
│ │ │ ├── Blog.ts
110+
│ │ │ ├── Keystore.ts
111+
│ │ │ ├── Role.ts
112+
│ │ │ └── User.ts
113+
│ │ └── repository
114+
│ │ ├── ApiKeyRepo.ts
115+
│ │ ├── BlogRepo.ts
116+
│ │ ├── KeystoreRepo.ts
117+
│ │ ├── RoleRepo.ts
118+
│ │ └── UserRepo.ts
119+
│ ├── helpers
120+
│ │ ├── asyncHandler.ts
121+
│ │ ├── role.ts
122+
│ │ └── validator.ts
123+
│ ├── routes
124+
│ │ └── v1
125+
│ │ ├── access
126+
│ │ │ ├── login.ts
127+
│ │ │ ├── logout.ts
128+
│ │ │ ├── schema.ts
129+
│ │ │ ├── signup.ts
130+
│ │ │ └── token.ts
131+
│ │ ├── blog
132+
│ │ │ ├── blogDetail.ts
133+
│ │ │ ├── blogList.ts
134+
│ │ │ ├── editor.ts
135+
│ │ │ ├── schema.ts
136+
│ │ │ └── writer.ts
137+
│ │ ├── index.ts
138+
│ │ └── profile
139+
│ │ ├── schema.ts
140+
│ │ └── user.ts
141+
│ └── types
142+
│ └── app-request.d.ts
143+
├── tests
144+
│ ├── auth
145+
│ │ ├── apikey
146+
│ │ │ ├── mock.ts
147+
│ │ │ └── unit.test.ts
148+
│ │ ├── authUtils
149+
│ │ │ ├── mock.ts
150+
│ │ │ └── unit.test.ts
151+
│ │ ├── authentication
152+
│ │ │ ├── mock.ts
153+
│ │ │ └── unit.test.ts
154+
│ │ └── authorization
155+
│ │ ├── mock.ts
156+
│ │ └── unit.test.ts
157+
│ ├── core
158+
│ │ └── jwt
159+
│ │ ├── mock.ts
160+
│ │ └── unit.test.ts
161+
│ ├── routes
162+
│ │ └── v1
163+
│ │ ├── blog
164+
│ │ │ ├── blogDetail
165+
│ │ │ │ ├── mock.ts
166+
│ │ │ │ └── unit.test.ts
167+
│ │ │ └── writer
168+
│ │ │ ├── mock.ts
169+
│ │ │ └── unit.test.ts
170+
│ │ ├── login
171+
│ │ │ ├── integration.test.ts
172+
│ │ │ ├── mock.ts
173+
│ │ │ └── unit.test.ts
174+
│ │ └── signup
175+
│ │ ├── mock.ts
176+
│ │ └── unit.test.ts
177+
│ ├── .env.test
178+
│ └── setup.ts
179+
├── addons
180+
│ └── init-mongo.js
181+
├── keys
182+
│ ├── private.pem
183+
│ └── public.pem
184+
├── .env
185+
├── .gitignore
186+
├── .dockerignore
187+
├── .vscode
188+
│ └── launch.json
189+
├── Dockerfile
190+
├── docker-compose.yml
191+
├── package-lock.json
192+
├── package.json
193+
├── jest.config.js
194+
├── tsconfig.json
195+
└── tslint.json
196+
```
197+
198+
## Directory Traversal for Signup API call
199+
`/src → server.ts → app.ts → /routes/v1/index.ts → /auth/apikey.ts → schema.ts → /helpers/validator.ts → asyncHandler.ts → /routes/v1/signup.ts → schema.ts → /helpers/validator.ts → asyncHandler.ts → /database/repository/UserRepo.ts → /database/model/User.ts → /core/ApiResponses.ts`
200+
83201
## API Examples
84202
* Signup
85203
* Method and Headers

0 commit comments

Comments
 (0)