Product | Stack | Structure | Execution | Acknowledgements
The Go API is a RESTful service designed for managing users and their associated notes. It provides operations for creating, reading, updating, and deleting users, as well as managing notes for individual users.
Users are uniquely identified by a UUID (user_id), and the API allows for the creation of users with specific attributes like name. It also enables the association of notes with each user, where notes are identified by a unique UUID (note_id).
Upon creation, a new user with the provided attributes is stored in the system, and the service can query existing users, modify user details, or delete them. Similarly, the notes system allows for creating, reading, updating, and deleting notes attached to a specific user.
Each API operation either performs a specific CRUD (Create, Read, Update, Delete) action on the user resource or the note resource, with interaction between the two based on user identities.
This project was developed using the following technologies:
| Technologies | |
|---|---|
| Go 1.22.5 | PostgreSQL |
| Fiber | GORM |
| AWS Sdk | Redis |
| Cucumber |
- Create new users in the system with a specified
name. - Retrieve details of a user using their unique
user_id. - Update the
nameof an existing user. - Delete users based on their
user_id. - List and retrieve notes associated with a specific user.
- Create new notes linked to a user.
- Delete notes attached to a specific user.
Creates a new user with the following request body:
{
"name": "John Doe"
}
Retrieves the details of a user by their user_id.
Deletes the user identified by the user_id.
Retrieves all notes associated with the user identified by user_id.
Retrieves a specific note attached to a user by note_id.
Creates a new note for the user with the following request body:
{
"title": "new note",
"content": "6238b914-0f07-44c3-b039-d5e76af1f1db"
}
Deletes a specific note associated with the user by note_id.
For the organization of the application, it was separated into several folders so that they were distributed according to their functions. The folder structure can be seen in depth here
-
-
env
- Contains local environment variables.
-
internal
- Contains all application layers.
- config
- Contains all projects configs (DB, properties, dependency wiring).
- delivery
- Contains the entrance layer to the api (controllers, DTOs, contracts, etc...).
- domain
- Contains all project's business logic (entities, use cases, adapters).
- integration
- Contains the implementation of external dependencies (DB, webservices, topics publishers).
-
cmd
- Contains golang entrypoint.
-
scripts
- Contains miscellaneous scripts.
-
-
Install Go
- Windows/MacOS/Linux
-
Install Docker
- Run the following command to run the tests with coverage:
- Windows/MacOS/Linux
make tests
- Windows/MacOS/Linux
-
Make sure Docker is running on your machine.
-
Run the following command to start the application infrastructure locally:
- Windows/MacOS/Linux
make docker-up
- Windows/MacOS/Linux
-
Start the application:
- Windows/MacOS/Linux
make run
- Windows/MacOS/Linux
-
To stop the application just hit
Ctrl + C:
I migrated this project from a previous repository to this one to better organize my studies and share the knowledge I have acquired in Go. Since the commit history and original authorship of the code may not be fully preserved in this repository, I want to acknowledge the original authors and contributors of the project bellow: