Go Fiber Rest Boilerplate is a starter template for building simple REST APIs using Go Fiber, GORM, and PostgreSQL. This project provides a ready-to-use setup with features like CRUD operations, pagination, and validation, following the clean architecture principles.
- Golang: The programming language used for this project.
- Fiber: An Express-inspired web framework for Golang.
- GORM: The ORM library for Golang.
- PostgreSQL: The relational database used for storing data.
- JWT: JSON Web Token (JWT) auth middleware
- Google UUID: Go package for UUIDs based on RFC 4122 and DCE 1.1: Authentication and Security Services.
- CRUD Operations: Predefined template for Create, Read, Update, and Delete operations.
- Pagination: Easy-to-use pagination for API responses.
- Validation: Input validation to ensure data integrity.
- Clean Architecture: Organized project structure following clean architecture principles.
- Swagger: API documentation using Swagger.
- Go (version 1.16 or higher)
- PostgreSQL
-
Clone the repository:
git clone https://github.com/IKHINtech/go-fiber-api-boilerplate.git cd go-fiber-boilerplate
-
Install dependencies:
go mod tidy
-
Setup PostgreSQL:
- Create a PostgreSQL database and update the connection settings in the
config
file.
- Create a PostgreSQL database and update the connection settings in the
-
Run the application:
go run main.go
.
βββ app
β βββ controllers # HTTP handlers for processing requests and returning responses
β βββ dto # Data Transfer Objects for request and response payloads
β βββ mappers # Functions to map between models and DTOs
β βββ models # Data models representing database tables
β βββ repositories # Data access layer for interacting with the database
β βββ routes # Route definitions and setup
β βββ services # Business logic and service layer
βββ config # Configuration settings
βββ docs # Swagger documentation
β βββ docs.go # Swagger documentation generator
β βββ swagger.json # Swagger JSON file
β βββ swagger.yaml # Swagger YAML file
βββ database # Database connection setup and migrations
βββ utils # Utility functions and helpers
βββ middlewares # Fiber middleware for request processing
βββ routes # Additional route definitions
βββ go.mod # Go module file
βββ go.sum # Go module dependencies
βββ main.go # Entry point of the application
Feel free to contribute to this project! Whether it's bug reports, feature requests, or pull requests, all contributions are welcome.
- Fork the project.
- Create your feature branch
git checkout -b feature/YourFeature
. - Commit your changes
git commit -m 'feat: add some YourFeature'
. - Push to the branch
git push origin feature/YourFeature
. - Open a pull request.
This project is licensed under the MIT License.