Categorygithub.com/pangolin-do-golang/thumb-processor-worker
module
0.0.0-20250210004957-98a6c39687f7
Repository: https://github.com/pangolin-do-golang/thumb-processor-worker.git
Documentation: pkg.go.dev

# README

Quality Gate Status Known Vulnerabilities

Coverage Report

Hackaton - Thumb Processor Worker

Install

Go

Make sure you have Go 1.22.2 or higher

Execute

go mod tidy

Run tests

go test -cover ./...

Defining Envs

To correctly use the project, it is necessary to define a .env file, with the values for the envs:

  • S3_BUCKET
  • SQS_QUEUE_URL
  • SMTP_HOST
  • SMTP_PORT
  • SMTP_PASSWORD
  • SMTP_FROM

Executing with Docker (Compose)

docker compose build

docker compose up -d

curl --request GET --url http://localhost:8082/health

## Expected response
= Status Code 200

If you're having trouble deploying the application with docker-compose (and not docker compose), use docker version 27.0.0 or higher.

Accessing Swagger UI

Go to http://localhost:8080/swagger/index.html#/ after the application is running.

Stack

  • Go
  • Gin Web Framework - Routes, JSON validation, Error management, Middleware support
  • S3 - Object storage service that stores data as objects in buckets
  • SQS - Managed message queues for microservices, distributed systems, and serverless applications
  • swag - Tool to generate swagger documentation
  • docker - Containerization tool
  • docker-compose - Tool to define and run multi-container Docker applications

Swagger

This project makes use of the library swag to generate the swagger documentation.

Install

Follow the steps described in the official documentation

Generate

 swag init -g cmd/worker/main.go 

Access the documentation

The documentation can be founded at the path /docs/swagger.yaml or accessing this link.

Project structure

  • cmd: Application entry point directory for the application's main entry points, dependency injection, or commands. The web subdirectory contains the main entry point to the REST API.
  • internal: Directory to contain application code that should not be exposed to external packages.
    • core: Directory that contains the application's core business logic.
      • thumb: Directory contains definition of the entity's heights, interfaces, repository and service of the entity Thumb.
    • adapters: Directory to contain external services that will interact with the application core.
    • domainerrors: Directory that contains the definition of the application's domain errors.

DDD with event storm

The team chose to use Miro to document this deliverable, available at the link.

The diagram contains:

  • System documentation in DDD with Event Storm
  • Caption for the ubiquitous language used
  • Additional details to understand the proposed resolution
  • Worker flow
  • API flow

ubiquitous language

event storm

# Packages

No description provided by the author
Package docs Code generated by swaggo/swag.