Giter Club home page Giter Club logo

go-fiber-boilerplate's Introduction

Go Fiber Boilerplate

A Starter project with Golang and Fiber

routes -> handler -> service -> repository -> database

In folder infrastructure you can also add other methods such as gRPC, GraphQL, etc.
You can add with folder name grpc, graphql, etc.
In folder infrastructure you can also add other connection like aws, sendgrid, cloudinary, etc.
You can add with folder name aws, sendgrid, cloudinary, etc.
In Folder utils/constants you can add error code and validation message.
In Folder utils you can add helper function like generate token, hash password, etc.

Getting Started

Prerequisites

  • You need to install Golang and Docker on your machine.
  • You need to install Makefile on your machine. Makefile
  • You need to install PostgreSQL on your machine.
  • You need to install Postman on your machine.
  • You need to install Git on your machine.
  • You need to install Visual Studio Code on your machine.

Tech Stack

  • Golang (Go Programming Language)
  • Fiber (Web Framework)
  • JWT (JSON Web Token)
  • Docker
  • PostgreSQL
  • Validator (go-playground/validator)
  • GORM (ORM)
  • UUID (Universally Unique Identifier)

Installation

Clone the repository and run the following commands:

git clone https://github.com/saufiroja/go-fiber-boilerplate.git

Go to the project directory:

cd go-fiber-boilerplate

Copy the .env_example file to .env:

copy .env.example .env

Install dependencies:

go mod tidy

Run the project:

make run

Structure Directory

An example of implementing a hexagonal architecture backend using golang.

.
├── .github/
│   └── workflows/
│       └── go.yaml
├── app/
│   └── main.go
├── config/
│   ├── app.go
│   ├── config.go
│   ├── fiber.go
│   └── postgres.go
├── infrastructure/
│   ├── database/
│   │   ├── mongo.go
│   │   └── postgres.go
│   └── http/
│       ├── handler/
│       │   ├── auth/
│       │   │   ├── auth_handler.go
│       │   │   └── routes.go
│       │   └── user/
│       │       ├── user_handler.go
│       │       └── routes.go
│       ├── middlewares/
│       │   └── jwt_middlewares.go
│       └── server/
│           └── fiber.go
├── initdb.d/
│   └── migrations/
│       ├── 0001_init.up.sql
│       └── 0002_init.users.sql
├── interfaces/
│   ├── auth_interfaces.go
│   └── user_interfaces.go
├── models/
│   ├── dto/
│   │   └── user_dto.go
│   └── entity/
│       └── user_entity.go
├── nginx/
│   ├── nginx.conf
│   └── Dockerfile
├── repository/
│   └── postgres/
│       ├── auth/
│       │   └── auth_repository.go
│       └── user/
│           └── user_repository.go
├── service/
│   ├── auth/
│   │   └── auth_service.go
│   └── user/
│       └── user_service.go
├── test/
│   ├── e2e/
│   │   ├── auth/
│   │   │   └── auth_test.go
│   │   ├── health/
│   │   │   └── health_test.go
│   │   └── user/
│   │       └── user_test.go
├── utils/
│   ├── constants/
│   │   ├── error.go
│   │   └── validation.go
│   ├── generate_token.go
│   └── password.go
├── .env
├── .env.example
├── .gitignore
├── docker-compose.yaml
├── Dockerfile
├── go.mod
├── go.sum
├── LICENCE
├── Makefile
└── README.md

License

This project is licensed under the terms of the MIT license.

go-fiber-boilerplate's People

Contributors

saufiroja avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.