Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/solo21-12/task_management_api_gin

A robust RESTful API for managing tasks and users, built with the Gin framework. Features include user authentication with JWT, user management, and task management. This API follows Clean Architecture principles for modularity and maintainability.
https://github.com/solo21-12/task_management_api_gin

cicd clean-architecture docker docker-compose gin-gonic github-action go golang makefile mongodb testify testify-mocking testing

Last synced: 2 months ago
JSON representation

A robust RESTful API for managing tasks and users, built with the Gin framework. Features include user authentication with JWT, user management, and task management. This API follows Clean Architecture principles for modularity and maintainability.

Awesome Lists containing this project

README

        

# Task Management RESTful API
![Go](https://img.shields.io/badge/Go-1.18+-blue.svg)
![Gin](https://img.shields.io/badge/Gin-1.7+-green.svg)
![MongoDB](https://img.shields.io/badge/MongoDB-5.0+-brightgreen.svg)
![Docker](https://img.shields.io/badge/Docker-20.10+-blue.svg)
![License](https://img.shields.io/badge/License-MIT-yellow.svg)

Welcome to the **Task Management RESTful API** built with the Gin framework. This API provides features for user authentication, user management, and task management, following the principles of Clean Architecture.

## ๐Ÿ“ Folder Structure

The project is organized into the following directory structure:

## ๐Ÿš€ Features

- **Authentication with JWT**: Secure authentication using JSON Web Tokens (JWT).
- **User Management**: Manage user sign-up, login, and user role promotion.
- **Task Management**: Create, retrieve, update, and delete tasks.

## ๐Ÿ—๏ธ Clean Architecture

This project follows the principles of Clean Architecture to ensure that the code is modular, maintainable, and scalable. The architecture is divided into layers with clearly defined responsibilities:

- **Delivery**: Handles the HTTP requests and responses, including routing and controllers.
- **Domain**: Contains the core business logic and domain models.
- **Infrastructure**: Manages the interaction with external services and systems.
- **Repositories**: Manages data access and persistence.
- **UseCases**: Implements the application's use cases and business rules.

```
bootstrap/
โ”œโ”€โ”€ app.go
โ”œโ”€โ”€ database.go
โ”œโ”€โ”€ env.go

Delivery/
โ”œโ”€โ”€ controllers/
โ”‚ โ”œโ”€โ”€ login.controller.go
โ”‚ โ”œโ”€โ”€ promote_user.controller.go
โ”‚ โ”œโ”€โ”€ sign_up.controller.go
โ”‚ โ””โ”€โ”€ task.controller.go
โ”œโ”€โ”€ main.go
โ”œโ”€โ”€ routers/
โ”‚ โ”œโ”€โ”€ login.router.go
โ”‚ โ”œโ”€โ”€ promote.route.go
โ”‚ โ”œโ”€โ”€ router.go
โ”‚ โ”œโ”€โ”€ sign_up.router.go
โ”‚ โ””โ”€โ”€ task.router.go
โ””โ”€โ”€ tmp/
โ”œโ”€โ”€ build-errors.log
โ””โ”€โ”€ main
doc/
โ””โ”€โ”€ api_documentation.md

Domain/
โ”œโ”€โ”€ auth.middleware.go
โ”œโ”€โ”€ error_response.go
โ”œโ”€โ”€ jwt_custome.go
โ”œโ”€โ”€ jwt.service.go
โ”œโ”€โ”€ login.go
โ”œโ”€โ”€ password.service.go
โ”œโ”€โ”€ promote.go
โ”œโ”€โ”€ sign_up.go
โ”œโ”€โ”€ task.go
โ”œโ”€โ”€ user.go
โ””โ”€โ”€ validate.go

Infrastructure/
โ”œโ”€โ”€ auth.middleware.go
โ”œโ”€โ”€ jwt.service.go
โ””โ”€โ”€ password.service.go
mocks/
โ”œโ”€โ”€ mock_auth_middler.go
โ”œโ”€โ”€ mock_jwt_service.go
โ”œโ”€โ”€ mock_login_usecase.go
โ”œโ”€โ”€ mock_password_service.go
โ”œโ”€โ”€ mock_promote_usecase.go
โ”œโ”€โ”€ mock_signup_repository.go
โ”œโ”€โ”€ mock_task.go
โ””โ”€โ”€ mock_user_repository.go

Repositories/
โ”œโ”€โ”€ task_repository.go
โ””โ”€โ”€ user_repository.go

tests/
โ”œโ”€โ”€ constants/
โ”‚ โ””โ”€โ”€ user.go
โ”œโ”€โ”€ controllers/
โ”‚ โ”œโ”€โ”€ login_controller_test.go
โ”‚ โ”œโ”€โ”€ promote_controller_test.go
โ”‚ โ”œโ”€โ”€ signup_controller_test.go
โ”‚ โ””โ”€โ”€ task_controller_test.go
โ”œโ”€โ”€ Repositories/
โ”‚ โ”œโ”€โ”€ task_repository_test.go
โ”‚ โ””โ”€โ”€ user_repository_test.go
โ””โ”€โ”€ UseCases/
โ”œโ”€โ”€ login_usecase_test.go
โ”œโ”€โ”€ promote_user_usecase_test.go
โ”œโ”€โ”€ sign_up_usecase_test.go
โ””โ”€โ”€ task_usecase_test.go

UseCases/
โ”œโ”€โ”€ login.usecase.go
โ”œโ”€โ”€ promote.usecase.go
โ”œโ”€โ”€ sign_up.usecase.go
โ””โ”€โ”€ task.usecase.go

go.mod
go.sum
makefile
README.md
```

## ๐Ÿ Getting Started

To get started with the project:

1. **Clone the Repository**:
```sh
git clone https://github.com/solo21-12/task_management_API_gin.git
cd task_management_API_gin
```

2. **Run the Application**:
```sh
make run
```

3. **stop the Application**:
```sh
make stop
```

4. **Run Tests**:
```sh
make test
```

5. **Run Tests with Coverage**:
```sh
make test-coverage
```
6. **logs for the Application**:
```sh
make logs
```

## ๐Ÿงช Testing

Testing is crucial for maintaining the quality of the application. To run tests, use the following commands:

- **Run Tests**:
```sh
make test
```

- **Run Tests with Coverage**:
```sh
make test-coverage
```

## ๐Ÿ“œ Documentation

For detailed API documentation, please refer to [Task Management API Documentation](https://documenter.getpostman.com/view/22911710/2sA3s7j8v6)

For more information, please visit the [GitHub repository](https://github.com/solo21-12/task_management_API_gin).

---