Skip to content

Commit

Permalink
Add architecture documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
devleejb committed Feb 8, 2024
1 parent f3f3780 commit da07789
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Contents

- [Architecture](./architecture.md): The architecture of CodePair's NestJS backend
- [Yorkie Auth Webhook](./auth-webhook.md): Auth Webhook to prevent users from accessing unauthorized documents using a Public Key

## Maintaining the Document
Expand Down
33 changes: 33 additions & 0 deletions backend/design/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Yorkie Auth Webhook

This document covers ㅅhe architecture of CodePair's NestJS backend.

## Architecture

Below is the diagram of the CodePair Backend Architecture. Currently, it adheres to the default architecture that can be generated through [NestJS CLI](https://docs.nestjs.com/cli/overview).
If you want to add a new component, you can use the command `nest generate controller [CONTROLLER_NAME]`.

```
CodePair Backend
┌───────┐ ┌──────────────────────────────────────────────────────────────────────┐
│Request├─────►│ │
└───────┘ │ ┌────┐ ┌─────┐ ┌──────────┐ ┌───────┐ ┌──────────┐ │
│ │Pipe│────►│Guard│────►│Controller│────►│Service│────►│Repository│ │
┌────────┐ │ └────┘ └─────┘ └──────────┘ └───────┘ └──────────┘ │
│Response│◄─────┤ │
└────────┘ └──────────────────────────────────────────────────────────────────────┘
```

- Pipe: Handles data transformation/validation in the request/response pipeline.
- Guard: Implements access control and validation logic for routes.
- Controller: Defines the endpoints/routes and their corresponding request handling logic.
- Service: Contains the business logic and performs operations required by the application.
- Repository: Handles data persistence and retrieval operations from the data source.

Note that the naming for the Repository Layer is `PrismaService`.

## Note

For now, we are using the architecture recommended by NestJS as a reference.
However, in the future, we can evolve towards implementing Clean Architecture by introducing interfaces between each layer.

0 comments on commit da07789

Please sign in to comment.