Giter Club home page Giter Club logo

chariondm / task-flow-hub Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 127 KB

Task Flow Hub is a web application designed for companies to efficiently manage tasks. Built with .NET and MySQL, it offers secure authentication, task management, and admin functionalities. This repository contains the source code, including API endpoints for user registration, task creation, editing, listing, and administrative views.

License: MIT License

C# 100.00%
clean-architecture dapper docker docker-compose dotnet dotnet8 hexagonal-architecture mysql mysql-database

task-flow-hub's Introduction

Table of Contents

Task Flow Hub

(back to top)

Task Flow Hub is a comprehensive system developed using .NET 8 and C# designed to manage the task flow of a company. It leverages the principles of Hexagonal and Clean Architecture to provide a robust and scalable solution for task management. This system includes functionalities such as creating new users, managing tasks, and handling user registrations and task assignments. The project is organized into different modules, including Core, Adapters, and Infrastructure, to ensure a clear separation of concerns and facilitate the development and maintenance of the system.

Hexagonal Architecture Fundamentals

(back to top)

Click to expand! The essence of Hexagonal Architecture lies in the clear separation between the core application logic and the interaction points with the external world. This separation is achieved through the use of:
  • Adapters: Concrete implementations of the ports, adapted to specific means of communication or technologies. For example, an adapter might be responsible for receiving HTTP requests and converting them into calls to the application logic, or for publishing messages in a Kafka topic based on events within the application.

    • Inbound Adapters: Handle the communication between the external world and the application. They are responsible for receiving requests from external clients and translating them into calls to the application logic.

    • Outbound Adapters: Handle the communication between the application and the external world. They are responsible for executing external actions requested by the application logic, such as writing to a database or sending messages to a message broker.

  • Core: Contains the essential business logic and domain models. This is the part of the application that encapsulates fundamental rules and operations, such as creating users, managing tasks, and handling task assignments.

    • Domain Models: Represent the core concepts of the application domain. They encapsulate the business rules and behaviors that govern the application's behavior.

    • Application: Contains the use cases and business logic of the application. It orchestrates the interactions between the domain models and the adapters, ensuring that the application's business rules are enforced.

  • Infrastructure: Provides the necessary infrastructure for the application to run, including database configurations, such as migrations and entity mappings, and other infrastructure-related concerns.

    • Database: Contains the database configurations, such as migrations and entity mappings, needed to persist the application's data.

    • Security: Contains the security-related configurations, such as authentication and authorization mechanisms, needed to secure the application.

By organizing the application into these distinct modules, Hexagonal Architecture promotes a clear separation of concerns and a modular, flexible structure that facilitates the development and maintenance of the system.

Benefits of Hexagonal Architecture

  • Modularity: The clear separation of concerns between the core application logic and the adapters makes it easier to understand and maintain the system.

  • Flexibility: The modular structure allows for easy integration of new adapters or changes to existing ones without affecting the core application logic.

  • Testability: The separation of concerns makes it easier to write unit tests for the core application logic and the adapters, ensuring that the system behaves as expected.

  • Scalability: The modular structure allows for the system to scale by adding new adapters or scaling the core application logic independently.

  • Maintainability: The clear separation of concerns and modular structure make it easier to maintain and extend the system over time.

Project Structure

(back to top)

Click to expand!

The project is organized into different modules, each serving a specific purpose within the system. The main modules are:

├── docker-setup
├── docs
│   └── design-docs
├── src
│   ├── Adapters
│   │   ├── Inbounds
│   │   │   └── TaskFlowHubHttpApi
│   │   └── Outbounds
│   │       └── MySqlDbAdapter
│   ├── Core
│   │   ├── Application
│   │   └── Domain
│   └── Infrastructure
│       ├── Database
│       │   └── MySqlDb
│       └── Security
└── test
    ├── IntegrationTests
    │   └── MySqlDbAdapterTests
    └── UnitTests
  • docker-setup: Contains the Docker Compose configuration files for setting up the development environment.

  • docs: Contains the documentation for the project, including design documents and other relevant information.

    • design-docs: Contains the design documents for the project, detailing the architecture, design decisions, and other relevant information.
  • src: Contains the source code for the project, organized into different modules.

    • Adapters: Contains the concrete implementations of the ports, adapted to specific means of communication or technologies.

      • Inbounds: Contains the inbound adapters responsible for handling the communication between the external world and the application.

        • TaskFlowHubHttpApi: Handles the HTTP communication between the external clients and the application.
      • Outbounds: Contains the outbound adapters responsible for handling the communication between the application and the external world.

        • MySqlDbAdapter: Handles the communication with the MySQL database.
    • Core: Contains the essential business logic and domain models of the application.

      • Application: Contains the use cases and business logic of the application.

      • Domain: Contains the domain models that represent the core concepts of the application domain.

    • Infrastructure: Contains the infrastructure-related configurations and implementations.

      • Database:

        • MySqlDb: Contains the database configurations, such as migrations and entity mappings, needed to persist the application's data.
      • Security: Contains the security-related configurations, such as authentication and authorization mechanisms, needed to secure the application.

  • test: Contains the test code for the project, organized into different test suites.

    • IntegrationTests: Contains the integration tests for the project.

      • MySqlDbAdapterTests: Contains the integration tests for the MySQL database adapter.
    • UnitTests: Contains the unit tests for the project.

Getting Started

(back to top)

Click to expand!

To get started with the project, follow these steps:

  1. Clone the Repository:

    git clone https://github.com/chariondm/task-flow-hub.git
  2. Navigate to the Project Directory:

    cd task-flow-hub
  3. Set Up the Development Environment:

    docker compose -f docker-setup/docker-compose.services.yml up -d
  4. Build the Project:

    dotnet build

    ⚠️ Note: You may need to install the required .NET SDK version specified in the global.json file.

  5. Run the Project:

    dotnet run --project src/Adapters/Inbounds/TaskFlowHubHttpApi/TaskFlowHubHttpApi.csproj

    ⚠️ Note: You may need to set the environment variables required by the application. Refer to the Configuration section for more information.

  6. Access the Application:

  7. Run the Tests:

    dotnet test

    ⚠️ Note: You may need to set up the Set Up the Development Environment step before running the tests.

Configuration

(back to top)

Click to expand!

The application can be configured using environment variables. The following environment variables are used by the application:

  • ConnectionStrings__DefaultConnection: The connection string for the MySQL database.

  • JwtTokenSettings__Audience: The audience for the JWT token.

  • JwtTokenSettings__Issuer: The issuer for the JWT token.

  • JwtTokenSettings__Secret: The secret key for the JWT token.

    • Note: The encryption algorithm used for the JWT token is HS256 and the secret key requires a key size of at least 128 bits.
  • JwtTokenSettings__ExpirationInMinutes: The expiration time for the JWT token in minutes.

Example Configuration

{
  "ConnectionStrings": {
    "DefaultConnection": "Host=localhost;Port=3306;Database=task_flow_hub_db;User Id=task_flow_hub_user;password=changeme_user;"
  },
  "JwtTokenSettings": {
    "Audience": "https://localhost:5126",
    "Issuer": "https://localhost:5126",
    "Secret": "D92BC749BE52BDA162BBB28A7677D3A3",
    "ExpiryInMinutes": 60
  },
  "Logging": {
    "LogLevel": {
      "Default": "Debug",
      "Microsoft.AspNetCore": "Warning"
    }
  }
}

task-flow-hub's People

Contributors

chariondm avatar

Watchers

 avatar

task-flow-hub's Issues

List Users

Description

As an admin user

I want to be able to list all registered users

So that I can manage the users of the application.

Acceptance Criteria

  • The system must return a list of all registered users.
  • The endpoint must be accessible only by an admin user.
  • The system must protect the password data.

Create the Design Document

Description

As a developer

I want to create a design document for the Task Flow Hub

So that I can have a clear understanding of the application's architecture and features.

Acceptance Criteria

  • The design document must include an overview of the application.
  • The design document must include the technology stack used in the application.
  • The design document must include the application's architecture.
  • The design document must include the database schema and data dictionary.
  • The design document must include the API endpoints with request and response details.

Register User

Description

As an unregistered user

I want to be able to register in the application

So that I can access the system's features.

Acceptance Criteria

  • The user must provide a username, an email, and a password.
  • The system must validate the uniqueness of the email and username.
  • The user's password must be stored securely.
  • The system must return the user's ID after registration.

Edit Task

Description

As a logged-in user

I want to be able to edit my tasks

So that I can update their details as required.

Acceptance Criteria

  • The user must provide the task's ID, title, description, status.
  • The system must validate the task's data.
  • The system must return the task's ID after updating.

Secure Authentication

Description

As a registered user

I want to securely log in to the application

So that I can safely manage my tasks.

Acceptance Criteria

  • The user must provide their email and password.
  • The system must validate the user's credentials.
  • The system must return a JWT token upon successful authentication.

Create Task

Description

As a logged-in user

I want to be able to create a task with a title, description, status, and creation date

So that I can keep track of new tasks that need to be done.

Acceptance Criteria

  • The user must provide a title, description, status, and creation date.
  • The system must validate the task's data.
  • The system must return the task's ID after creation.
  • The system must associate the task with the logged-in user.

*The status field must be one of the following values: pending, completed, canceled, or in_progress.

List Tasks

Description

As a logged-in user

I want to be able to list all my tasks

So that I can see everything that needs to be done.

Acceptance Criteria

  • The system must return a list of all tasks associated with the logged-in user.

View Task

Description

As a logged-in user

I want to be able to view the details of a specific task

So that I can focus on the details of what needs to be done.

Acceptance Criteria

  • The user must provide the task's ID.
  • The system must return the task's data.
  • The task must be associated with the logged-in user.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.