Skip to content

miladabc/golang-starter

Repository files navigation

golang-starter

Overview

golang-starter is a boilerplate project for starting new Go projects. It includes a basic setup for a web server, database migrations, and testing. The project uses Docker for containerization and includes a Makefile for common tasks.

Prerequisites

  • Docker
  • Docker Compose
  • Go

Getting Started

Running the Project

  1. Start the project:

    make up

    This command will start the Docker containers for the project.

  2. Access the server:

    Open your browser and navigate to http://localhost:8080. Swagger documentation is available at http://localhost:8080/swagger.

  3. Open a container bash window:

    make bash

Stopping the Project

To stop the running containers:

make stop

To remove the containers and associated volumes:

make down

Running Tests

To run the tests:

make tests

Running Database Migrations

To run the database migrations:

make migrate

To create a new migration file:

make migration

You will be prompted to enter a migration name. This will create new .up.sql and .down.sql files in the internal/migrations directory.

Viewing Logs

To view the logs:

make logs

Project Structure

Configuration

Configuration is managed using the config.yml file. Environment variables can override the configuration values. The environment variables should be prefixed with MYVAR_ and use _ as the delimiter.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published