The goal of this project is to create an optimized API using two patterns: CQRS & Event sourcing.
CQRS separates reads and writes into different models, using commands to update data, and queries to read data.
The Event Sourcing pattern defines an approach to handling operations on data that's driven by a sequence of events, each of which is recorded in an append-only store. Application code sends a series of events that imperatively describe each action that has occurred on the data to the event store, where they're persisted. Each event represents a set of changes to the data.
The consumer wait to receive messages from the message broker host in the main project
- User authentication with JWT.
- User management.
- Article management.
After cloning the repo, cd
into the project, create the .env according to .env.example, and run the following commands
docker-compose up --build
After that : Go to http://localhost:8091/
Enter the env COUCH_USER/COUCH_PASSWORD
Create Two Buckets as CouchBase:
- event-store
- read-models
Restart the docker-compose
docker-compose restart
Healthcheck ❤️
GET /
Login 🔒
POST /login
Create a new user
POST /users
Get all users
GET /users
Get a user by id
GET /users/{id}
Update a user
PUT /users/{id}
Delete a user
DELETE /users/{id}
Create a new post
POST /posts
Get all posts
GET /posts
Get a post by id
GET /posts/{id}
Update a post
PUT /posts/{id}
Delete a post
DELETE /posts/{id}
The API doc is available here
You can find the technical and functional documentation in French and English version by clicking on the link below:
Feel free to discuss with any contributor about the technical choices that were made:
- Go Version:
1.15
- PostgreSQL database:
13
- CouchBase database:
5.5.x
Share with us your ideas to improve our project !
See contributing guidelines.
We like to iterate quickly, setting up an agile board helps everyone stay on task. With Trello, we Created lists for backlogged items, what’s being worked on in the current sprint, and (most importantly) what’s completed.
You can take a look at our organization of tasks on Trello
The code is available under the MIT license.