Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fraybabak/hexagonal_example_nodejs
sample hexagonal architecture in Node.js and TypeScript
https://github.com/fraybabak/hexagonal_example_nodejs
clean-code dependency-injection expressjs hexagonal-architecture nodejs typescript
Last synced: about 6 hours ago
JSON representation
sample hexagonal architecture in Node.js and TypeScript
- Host: GitHub
- URL: https://github.com/fraybabak/hexagonal_example_nodejs
- Owner: fraybabak
- Created: 2023-08-26T23:02:59.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-01T19:30:45.000Z (9 months ago)
- Last Synced: 2024-05-02T13:30:33.004Z (9 months ago)
- Topics: clean-code, dependency-injection, expressjs, hexagonal-architecture, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 176 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hexagonal Architecture example in Node.js using TypeScript
This is a simple example of Hexagonal Architecture in Node.js using TypeScript.
I made this example to show how to implement the Hexagonal Architecture in Node.js using TypeScript with my underestanding of the concept.## What is Hexagonal Architecture?
Hexagonal Architecture is an architectural pattern that helps us to create applications that are more independent of the external world.
It is also known as Ports and Adapters Architecture or Onion Architecture.## How to run the application
pre-requisites:
- Node.js
- npm
- prisma => `npm install -g prisma`1. Clone the repository
2. Run `npm install`
3. cd into the `src/infrastructure/db` folder
```
cd src/infrastructure/dbnpx prisma migrate dev --name init
```4. Run `npm run start` to start the application
5. Run `npm run test` to run the tests
## usecases
this is the list of the usecases that the application supports,this usecases will be changed in the future to be more realistic.
### Create user
I want to create a user with the following data:- name
- password```json
{
"name": "John Doe",
"email": "[email protected]",
"password": "123456"
}
```
### Authenticate user
I want to authenticate a user with the following data:
- password```json
{
"email": "[email protected]",
"password": "123456"
}
```
### Create post
I want to create a post with the following data:- title
- content```json
{
"title": "My first post",
"content": "This is my first post",
}
```