Skip to content

Project Template for Backend Application with Golang #22

@ameliarahman

Description

@ameliarahman

Overview

This proposal outlines a standard application template for building backend services in Golang. The template emphasizes clean architecture and will be designed to support RESTful API development.

Required Component

  • Project Structure : Follows Golang’s Clean Architecture principles, structured into Model, Repository, Usecase, and Delivery layers.
  • Database Migration: Manage database schema changes using goose.
  • Table Seeders: Manage how to seed data into existing table.
  • Database Integration: Establish a connection to a PostgreSQL database.
  • Environment Configuration: Use .env files and a configuration management package for managing environment-specific settings.
  • Routing & HTTP Server: Setup RESTful routes using echo.
  • Error Handling: Centralized error handling strategy with custom error types and HTTP response formatting.
  • Logging: Implement structured, leveled logging using slog.
  • Docker Support: Provide Dockerfile and docker-compose.yml for development.
  • Testing: Implement test using Go's testing package.
  • API Documentation: Support API documentation.
  • Authentication: Provide authentication example.

Optional Components

Proposed Package / Library

Component Suggested Libraries / Tools
Database Migration github.com/pressly/goose
Database Integration github.com/jackc/pgx/v5
Environment Config github.com/joho/godotenv
Routing & HTTP Server github.com/labstack/echo/v4
Logging log/slog
Error Handling Manual or github.com/pkg/errors
Task Scheduling github.com/go-co-op/gocron
API Documentation https://pkg.go.dev/github.com/swaggo/echo-swagger

Reference

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions