GitPedia

Go hexagonal http api course

Ejemplos del curso de API HTTP en Go aplicando Arquitectura Hexagonal

From CodelyTV·Updated April 26, 2026·View on GitHub·

This repository contains the code examples used on the CodelyTV course. The project is written primarily in Go, first published in 2020. Key topics include: codelytv, ddd, domain-driven-design, gin, go.

CodelyTV - Go HTTP API - Hexagonal Architecture

This repository contains the code examples used on the CodelyTV course.

Requirements

  • Go v1.15+
  • MySQL (see below).

Contents

This project has been designed as a single Go module with multiple applications.
Each folder contains a completely functional application (binary) that can be executed isolated.

Each folder corresponds to one of the course lessons / videos:

  1. 01-01-your-first-http-endpoint - Nuestro primer endpoint HTTP en Go
  2. 01-02-using-gin - Usando Gin: nuestro primer framework
  3. 01-03-architectured-healthcheck - Arquitecturando nuestro health check
  4. 02-01-post-course-endpoint - Implementando el endpoint de creación de curso
  5. 02-02-repository-injection - Inyectando nuestro repositorio
  6. 02-03-controller-test - Testeando nuestro endpoint
  7. 02-04-domain-validations - Añadiendo validaciones a nuestro dominio
  8. 03-01-mysql-repository-implementation - Implementando nuestro repositorio para MySQL
  9. 03-02-repository-test - Testeando nuestro repositorio
  10. 04-01-application-service - Refactorizando el endpoint para extraer el Application Service
  11. 04-02-application-service-test - Testeando el Application Service
  12. 04-03-command-bus - Unificando nuestros casos de uso: Command Bus
  13. 05-01-graceful-shutdown - Graceful shutdown
  14. 05-02-timeouts - Timeouts en operaciones asíncronas: repositorio
  15. 06-01-http-middlewares - Usando middlewares HTTP en Go
  16. 06-02-time-parse-in-go - El secreto mejor guardado de Go y sus fechas
  17. 06-03-gin-middlewares - Implementando el middleware de recuperación de errores en Gin
  18. 07-01-publishing-domain-events - Publicando eventos de curso creado
  19. 07-02-domain-events-subscriber - Implementando nuestro suscriptor de eventos
  20. 07-03-event-bus-implementation - Implementando el Event Bus
  21. 08-01-reading-env-variables - Leyendo configuración de variables de entorno
  22. 08-02-build-and-deploy - Build, despliegue y ¡a producción!
  23. 08-03-debugging - Generando la imagen de Docker y depurando errores

Usage

To execute the application from any lesson, just run:

sh
export COURSE_LESSON=02-04-domain-validations; go run $COURSE_LESSON/cmd/api/main.go

Replacing COURSE_LESSON value by any of the available ones.

Simple examples

Some lessons only contain a single main.go file with a few lines of code.
To run one of those lessons, just run:

sh
export COURSE_LESSON=01-01-your-first-http-endpoint; go run $COURSE_LESSON/main.go

MySQL & Docker

From 02-01-post-course-endpoint on, the application on each directory relies
on a MySQL database. So, to simplify its execution, we've added a
docker-compose.yaml file with a MySQL container already set up.

To run it, just execute:

sh
docker-compose up -d

You can also use your own MySQL instance. Note that those applications
expects a MySQL instance to be available on localhost:3306,
identified by codely:codely and with a codely database.

To set up your database, you can execute the schema.sql file
present on the sql directory. It's automatically loaded if
you use the provided docker-compose.yaml file.

Tests

To execute all tests, just run:

sh
go test ./...

To execute only the tests present in one of the lessons, run:

sh
go test ./02-04-domain-validations/...

Contributors

Showing top 1 contributor by commit count.

View all contributors on GitHub →

This article is auto-generated from CodelyTV/go-hexagonal_http_api-course via the GitHub API.Last fetched: 6/16/2026