Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamnasrudin03/go-template
This project is an example of a REST API project using the Go language and the implementation of other tools
https://github.com/adamnasrudin03/go-template
basic-authentication docker email-verification excel-export gin-framework gin-gonic golang gorm jwt jwt-auth otp-verification postgresql rabbitmq redis redis-client
Last synced: 3 months ago
JSON representation
This project is an example of a REST API project using the Go language and the implementation of other tools
- Host: GitHub
- URL: https://github.com/adamnasrudin03/go-template
- Owner: adamnasrudin03
- License: mit
- Created: 2024-05-26T02:53:12.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-19T01:56:27.000Z (6 months ago)
- Last Synced: 2024-10-02T05:21:54.374Z (3 months ago)
- Topics: basic-authentication, docker, email-verification, excel-export, gin-framework, gin-gonic, golang, gorm, jwt, jwt-auth, otp-verification, postgresql, rabbitmq, redis, redis-client
- Language: Go
- Homepage:
- Size: 339 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-template
This project is an example of a REST API project using the Go language and the implementation of other tools, such as Auth with JWT, Basic Auth, Logger API, Cache, ORM SQL, Message Broker, Export Excel File, OTP Mechanism, Deploy with Docker, Clean Code (smell code checker by CodeScene), Unit Test, and so on.## Technology Used
- Versioning using Git (See Git Installation)
- Programming Language using Go 1.22 or later. (See Golang Installation)
- DB using PostgreSQL 14 or later. (See PostgreSQL Installation)
- Migration using ORM GORM. (See Documentation)
- Cache Using Redis. (See Redis Installation)
- Routing Using Gin (See Gin Framework Doc)
- ORM Library using GORM. (See GORM Guides)
- Auth using Golang-JWT. (See Golang-JWT Guides)
- Message Broker using RabbitMQ. (See RabbitMQ Installation)
- Clean Code check using CodeScene. (See CodeScene)
- Deploy using Docker. (See Docker Installation)## Feature
| Method | Auth | Endpoint | Dec |
| ------ | ---- | -------------------------------------------| --------------------------------------------------------------------- |
| GET | no | / | Welcome API |
| POST | no | /api/v1/auth/sign-up | Register user with role USER |
| POST | yes | /api/v1/root/auth/sign-up | Register user with role USER or ADMIN, auth with super admin (root) |
| POST | no | /api/v1/auth/sign-in | Login |
| PATCH | yes | /api/v1/users/:id | Update User |
| GET | yes | /api/v1/users/:id | Detail User |
| GET | yes | /api/v1/users | List User, auth only admin or super admin (root) |
| PATCH | yes | /api/v1/users/change-password/:id | Change Password |
| GET | yes | /api/v1/users/send-email-verify | Send OTP Email verified |
| POST | yes | /api/v1/users/verified-email | Verified email with otp |
| GET | no | /api/v1/users/request-reset-password/:id | Send OTP Email forgot password |
| PATCH | no | /api/v1/users/validate-reset-password/:id | Verified Reset password |
| GET | yes | /api/v1/logs | List log activity history |
| GET | yes | /api/v1/logs/download | Download xlx List log activity history |
| GET | yes | /api/v1/message/translate/id | Translate text to language id (indonesia) |
| GET | yes | /api/v1/message/consumer | Trigger manual consume queue rabbitMQ |### Role
- ROOT (role super admin) = create a user the first time the project is run, check here
- ADMIN (role admin)
- USER (role user)
## Development Guide
### Documentations
Postman API Documentation### Collection Using Postman
- ./go-template.postman_collection.json
### Installation
- Clone this repo```sh
git clone https://github.com/adamnasrudin03/go-template.git
```- Copy `.env.example` to `.env`
```sh
cp .env.example .env
```
- Setup local database
- If you using RabbitMQ, Please check or create queue for ./app/models/queue.go
- Start service API
```sh
go run main.go
```## Build project by docker
- check ip address in terminal
```sh
ipconfig
```
- change data environment in file ./docker-compose.yml
- build with docker compose```sh
docker-compose -f "docker-compose.yml" up -d --build
```
- with make file
```sh
make docker
```## Coverage Unit Test
- with make file
```sh
make cover
```