hackathon-fiber-starter

module
v0.0.0-...-04f365a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2025 License: MIT

README

Hackathon Fiber Starter

Go Version

Description

This project presents a boilerplate/starter kit for rapidly developing RESTful APIs using Go, Fiber, and PostgreSQL.

The application is built on Go v1.23.4 and PostgreSQL. It uses Fiber as the HTTP framework and pgx as the driver and sqlx as the query builder. It also utilizes Redis as the caching layer with go-redis as the client.

Getting started

  1. Ensure you have Go 1.23 or higher and Task installed on your machine:

    go version && task --version
    
  2. Create a copy of the .env.example file and rename it to .env:

    cp ./config/.env.example ./config/.env
    

    Update configuration values as needed.

  3. Install all dependencies, run docker compose, create database schema, and run database migrations:

    task
    
  4. Run the project in development mode:

    task dev
    

Documentation

For database schema documentation, see here, powered by dbdocs.io.

For API documentation, see here, powered by Apidog.

Features

  • Migration: database schema migration using golang-migrate
  • Validation: request data validation utilizing Package validator
  • Logging: implemented with zerolog
  • Testing: unit and integration tests powered by Testify with formatted output using gotestsum
  • Error handling: centralized error management system
  • Email functionality: implemented using Gomail
  • Environment variables: managed with Viper
  • Security: HTTP headers secured by Fiber-Helmet
  • CORS: Cross-Origin Resource-Sharing enabled through Fiber-CORS
  • Compression: gzip compression provided by Fiber-Compress
  • Linting: code quality ensured with golangci-lint
  • Docker support
  • Vercel support

Convention

Please review and adhere to the conventions outlined CONVENTION

Contributing

Developers interested in contributing can refer to the CONTRIBUTING file for detailed guidelines and instructions on how to contribute.

Inspirations

License

MIT

Directories

Path Synopsis
cmd
app
dto
internal
pkg
bcrypt/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
jwt
jwt/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
log
time/mock
Package mock_time is a generated GoMock package.
Package mock_time is a generated GoMock package.
uuid/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
validator/mock
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
tests
unit/user/repository/mock
Package repository_mock is a generated GoMock package.
Package repository_mock is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL