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.

Stars
1
Committers
2

Task Management RESTful API

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:

    git clone https://github.com/solo21-12/task_management_API_gin.git
    cd task_management_API_gin
    
  2. Run the Application:

    make run
    
  3. stop the Application:

    make stop
    
  4. Run Tests:

    make test
    
  5. Run Tests with Coverage:

    make test-coverage
    
  6. logs for the Application:

    make logs
    

๐Ÿงช Testing

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

  • Run Tests:

    make test
    
  • Run Tests with Coverage:

    make test-coverage
    

๐Ÿ“œ Documentation

For detailed API documentation, please refer to Task Management API Documentation

For more information, please visit the GitHub repository.