Skip to content
/ golerplate Public template

GOlerplate is a Boilerplate for Go

License

Notifications You must be signed in to change notification settings

Figaarillo/golerplate

Repository files navigation

English | Spanish

GOlerplate

GOlerplate is a template for web applications in Golang. This means it can be a starting point for web applications in Golang, designed to facilitate development with a clean and modular architecture.

Technologies

  • Language: Go
  • Frameworks and Libraries: Gorilla Mux, GORM
  • Containers: Docker, Docker Compose
  • Documentation: Swagger

Getting Started

Prerequisites

Clone the repository

  1. Clone the repository:

    git clone https://github.com/Figaarillo/golerplate.git
    cd golerplate
  2. Copy the .env.example file to .env:

    cp .env.example .env

Usage

  • Run the server and database through Docker

    make docker.run
  • Run the server locally and the database with Docker

    make run

How to run tests?

Unit Tests

To run all unit tests:

make test.unit

To run a single unit test:

make test.unit.[entity_name]

For example, to run the unit test for category:

make test.unit.category

Integration Tests

To run all integration tests:

make test.e2e

To run a single integration test:

make test.e2e.[entity_name]

For example, to run the integration test for category:

make test.e2e.category

Project Structure

.
├── cmd
│   └── api                # Main entry point of the application
├── docs                   # Swagger generated documentation
├── internal
│   ├── application
│   │   └── usecase        # Application use cases
│   ├── domain
│   │   ├── entity         # Domain entity definitions
│   │   ├── exception      # Domain exception handling
│   │   └── repository     # Repository interfaces
│   ├── infrastructure
│   │   ├── handler        # HTTP handlers
│   │   ├── middleware     # HTTP middlewares
│   │   ├── repository     # Repository implementations
│   │   └── router         # Route definitions
│   ├── setup              # Initial setup
│   ├── share
│   │   ├── config         # Shared configuration
│   │   ├── exception      # Shared exception handling
│   │   ├── utils          # Shared utilities
│   │   └── validation     # Shared validations
│   └── test               # Unit and integration tests
└── scripts                # Automation scripts

Features

  • REST API: CRUD implementation for entities.
  • Tests: Unit and integration tests.
  • Documentation: API documentation with Swagger.
  • Architecture: Implements clean and hexagonal architecture principles.

License

This project is licensed under the MIT License.