Skip to content

mrjmarcelo/task-forge-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Forge API

A containerized Todo Web API built using Go, REST, MongoDB, Docker, and Kubernetes, applying Clean Architecture principles.


📌 Overview

Task Forge API is a simple containerized Todo Web API designed to demonstrate the application of modern technologies and practices:

  • Go (Golang) for backend implementation
  • REST API for communication
  • MongoDB for persistence
  • Docker for containerzation
  • Kubernetes for orchestration
  • Clean Architecture for maintainability and separation of concerns

🚀 Running Locally

This project is intended to run locally using Minikube and Makefile.

Prerequisites

  • Linux or WSL environment
  • Minikube installed and running
  • Make installed

Steps

From the root of the project directory, run:

make all

This will:

  1. Build the API image
  2. Deploy MongoDB and the API into Minikube
  3. Expose the API on localhost:8080

📡 API Endpoints

Here are sample requests supported by the API:

Get all todos

curl --location --request GET 'localhost:8080/api/todos'

Create a new todo

curl --location --request POST 'localhost:8080/api/todos' \
--header 'Content-Type: application/json' \
--data '{"title":"dummy","completed":false}'

Update an existing todo

curl --location --request PUT 'localhost:8080/api/todos/7f3c9f2e-8c6a-4b9d-9f7a-2e1a4c6d8b90' \
--header 'Content-Type: application/json' \
--data '{"title":"dummy2","completed":false}'

Delete a todo

curl --location --request DELETE 'localhost:8080/api/todos/7f3c9f2e-8c6a-4b9d-9f7a-2e1a4c6d8b90'

Health checks

curl --location --request GET 'localhost:8080/health/live'
curl --location --request GET 'localhost:8080/health/ready'

🗂️ Project Structure

The project follows Clean Architecture, separating concerns into delivery, domain, infrastructure, and use cases:

cmd/
  main.go                  # Application entrypoint

internal/todo/
  delivery/http/           # HTTP handlers (controllers)
    error.go
    http_todo_handler.go

  domain/entity/           # Core domain entities
    todo.go

  infra/                   # Infrastructure layer
    repository/
      boltdb/
        boltdb_todo_repository.go
      mongodb/
        mongodb_todo_repository.go
    service/
      uuid_generator.go

  mocks/                   # Mocks for testing

  usecase/                 # Application use cases (business logic)
    repository/
    service/
    create_todo_use_case.go
    create_todo_use_case_test.go
    delete_todo_use_case.go
    delete_todo_use_case_test.go
    get_todos_use_case.go
    get_todos_use_case_test.go
    update_todo_use_case.go
    update_todo_use_case_test.go
    error.go

k8s/                       # Kubernetes manifests
  api/
    configmap.yaml
    deployment.yaml
    service.yaml
  mongo/
    deployment.yaml
    pv.yaml
    pvc.yaml
    service.yaml

Dockerfile                 # Container build instructions
Makefile                   # Build and deploy automation
go.mod / go.sum            # Go module dependencies
.gitignore                 # Git ignore rules

🛠️ Purpose

This project was built to:

  • Showcase containerization and orchestration with Kubernetes
  • Demonstrate clean architecture in Go
  • Provide a simple, practical example of a RESTful API with persistence

📖 License

This project is for educational and demonstration purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors