https://github.com/ayresmonteiro/reinforcer
A REST API made with TypeScript Clean Architecture for a quiz app.
https://github.com/ayresmonteiro/reinforcer
clean-architecture clean-code rest-api tests typescript
Last synced: 26 days ago
JSON representation
A REST API made with TypeScript Clean Architecture for a quiz app.
- Host: GitHub
- URL: https://github.com/ayresmonteiro/reinforcer
- Owner: AyresMonteiro
- Created: 2023-07-10T18:56:25.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-21T09:49:54.000Z (over 2 years ago)
- Last Synced: 2025-01-08T12:15:56.977Z (over 1 year ago)
- Topics: clean-architecture, clean-code, rest-api, tests, typescript
- Language: TypeScript
- Homepage:
- Size: 528 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Reinforcer, a base backend for quiz apps.
## How to run
- **Prerequisites**: Have node.js v16 or above and yarn package manager installed in your environment.
Run command on your terminal:
$ yarn install && yarn build && yarn start
## The Architecture
Our app is based on simple principles:
- We should can easily read and understand the code.
- We should can easily read and understand the commit history.
- We should can easily add a new feature.
- We should can easily modify an old feature.
- We should can easily change a dependency, without breaking the previous features.
To accomplish these principles, we will use the Test-Driven Development philosophy and the following architecture:
The **domain** layer constitutes the abstract idea of the main entities our application will use, so, there we have the interfaces and base classes of them. (`domain/types` and `domain/entities`).
The **data** layer constitutes base actions of these entities and actions performed over other types of data (i.e.: string hash), so there will have contracts that describe these actions. (i.e: `data//save`).
The **application** layer constitutes actions that provides real value to the entire system (the business' logic) so there will be the usecases (final compound actions). (i.e.: `application/usecases`).
The **infra** layer will implement the **data** layer actions, using types and entities and, of course, external/dependency-based code.
The **main** layer will just wrap everything, maybe making use of the concept of `adapters`: pieces of code that provides communication between our app API and some external API (i.e: an `ExpressAdapter` class could wrap a usecase to an `Express.js` route, making possible the use of a REST API).
The layers will be under `src` directory and the tests will be under `test` directory.
## Archictecture Illustration
