Golang API Boilerplate
- Authentication: Includes JWT-based authentication out-of-the-box.
- Database Migration: Integrated database migration for easy schema management.
- RESTful API Structure: Pre-defined RESTful routes and handlers.
- Modular Codebase: Organized code structure for easy scalability and maintenance.
- Live Reloading: Using air for hot reloading.
- Configuration Management: Simple and flexible configuration using environment variables.
- Social Login: Social Login Out of the box.
- Go 1.18+
- Make (optional, for running commands)
- Go air
Clone the repository https://github.com/rachitkawar/boilerplate-go.git
git clone https://github.com/rachitkawar/boilerplate-go.git my-project
cd my-project
To run this project, you will need to add the following environment variables to your .env file
DSN=
GIN_MODE=
MIGRATION_PATH=src/internal/database/migrations/
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_REDIRECT_URL=
GOOGLE_LOGIN_URL=
SOCIAL_LOGIN_SECRET_STATE=
JWT_SECRET=
The boilerplate supports social login via Google and Facebook. To enable this feature, ensure you have set the appropriate environment variables (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URL , GOOGLE_LOGIN_URL)
To create migration:
make migrations-create {table_name}
Migration Up:
make migrations-up
Migration Down:
make migrations-down
To run the app:
make dev
To build this app
make build
To run this app
make run
This project is licensed under the MIT License. See the LICENSE file for details.