Go-Clean-Architecture-Template
Go-Clean-Architecture-Template copied to clipboard
Golang Clean Architecture Template with JWT Auth, Google OAuth2 Authentication, MySQL Connection and User CRUD operations
Golang Backend Clean Architecture Template
This is a template repository for building a Golang backend application following the Clean Architecture principles. It includes the following features:
- Google Auth: Integration with Google OAuth for user authentication.
- JWT Auth: Token-based authentication and authorization system.
- MySQL Connection: Database connectivity to MySQL for data storage.
- User CRUD Operations: Basic user management operations (Create, Read, Update, Delete).
You can use this project as a template to build your Backend project in the Go language on top of this project.
Edit the project to suit your needs after you use it as a template.
Please ⭐️ this repository if this project helped you, also contributions are welcome 🙏🏼
Getting Started
Follow the steps below to set up and start using this template for your Golang backend project.
Prerequisites
Before you begin, ensure you have the following installed:
- Go
- MySQL (or a compatible database)
- Google Cloud Console project for Google Auth setup.
Installation
There are two ways to start using this template:
- Create a new repository based on this template by clicking the Use this template button at the top of this page.
-
Clone this repository to your local machine:
git clone https://github.com/oguzhantasimaz/Go-Clean-Architecture-Template.git cd your-repo-name
-
Create a
.env
file in the root directory based on the.env.example
template and fill in your configuration details. -
Install the necessary Go packages:
go mod tidy
Configuration
-
Set up your Google OAuth credentials in the Google Cloud Console, and update your
.env
file with the corresponding client ID and client secret. -
Configure your MySQL database connection in the
.env
file with the appropriate credentials.
Usage
Run the following command to start the Golang backend server:
go run main.go
Your server should now be running at port you specified in the .env
file.
Project Structure
├── api/
│ ├── controller/
│ ├── middleware/
│ └── route/
├── bootstrap/
├── cmd/
├── domain/
├── internal/
│ ├── tokenutil/
├── repository/
├── usecase/
├── utils/
└── main.go
About Me
Hello, I am Oguzhan Tasimaz, a software engineer from Turkey. I am interested in backend development, distributed systems, and cloud computing. You can find me on LinkedIn.
Contributing
Feel free to contribute to this project.
If this project helps you in anyway, show your love ❤️ by putting a ⭐ on this project ✌️
Contributing to Go Backend Clean Architecture
All pull requests are welcome.