Git Product home page Git Product logo

gin-golang-boilerplate's Introduction

Gin Golang Boilerplate

Introduction

This project is a Boilerplate for Restful-API using Gin-Gonic and GORM for faster development by providing several common functions, such as:

  • Service repository for every database models
  • JWT Auth
  • Logging
  • Swagger Documentation
  • Env loader
  • Response Templating
  • Migration & Seeder
  • Etc.

Prerequisites

Make sure you have the following installed on your machine:

  • Go (version 1.20 or higher)
  • Node.js (for the dev target in the Makefile with Nodemon)

Installation

  1. Clone the repository:

    git clone https://github.com/dimasbagusussilo/gin-golang-boilerplate.git

  2. Change into the project directory:

    cd gin-golang-boilerplate

  3. Install project dependencies:

    make deps

  4. Rename file .env.example to .env

Usage

Build

To compile the packages, run the following command:

make build

Run

To build and run the project in development mode, use the following command:

make run

This will compile the packages and start the application.

Clean

To clean the project and remove previous builds, run:

make clean

Development Mode

To run the project in development mode using nodemon (requires Node.js), use the following command:

make dev

This will automatically restart the application whenever changes are made.

Generate API Documentation V1

To generate API documentation using Swag, run:

make generatedocs1

This will create the documentation in the docs/v1/ directory.

Additional Migration

To generate additional database migration file run:

make migrationcreate

This will create the migration file in the database/migrations/ directory.

We can run migration with Golang Migrate we can install with this command (mac):

brew install golang-migrate

Then we can run up migration with (we need setup credentials in Makefile):

make migrateup

Same as up migration, we can run down migration with:

make migratedown

Contributors

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.# gin-golang-boilerplate

gin-golang-boilerplate's People

Contributors

dimasbagussusilo avatar

Stargazers

 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.