Skip to content

Commit

Permalink
Merge pull request #29 from dipeshdulal/doc/update-readme
Browse files Browse the repository at this point in the history
Doc: Updated readme with more information
  • Loading branch information
dipeshhkc authored Aug 5, 2021
2 parents 33fe960 + a104efc commit bd3db8c
Showing 1 changed file with 53 additions and 17 deletions.
70 changes: 53 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
## Clean Gin
# Clean Gin

Trying to implement clean architecture with gin framework.
Clean architecture template with gin framework, go-fx as dependency container, gorm as orm for database related operations.

To learn about project structure and dependency injection please go through [here](https://medium.com/wesionary-team/dependency-injection-with-go-fx-b698a6585cf0?source=friends_link&sk=26f391ae41c493946ee3434be2ed4971)

## Running the project

- Make sure you have docker installed.
- Copy `.env.example` to `.env`
- Run `docker-compose up -d`
- Go to `localhost:5000` to verify if the server works.
- [Adminer](https://www.adminer.org/) Database Management runs at `5001` .

If you are running without docker be sure database configuration is provided in `.env` file and run `go run .`

#### Environment Variables
<details>
<summary>Variables Defined in the project </summary>

| Key | Value | Desc |
| -------------- | ------------------------ | -------------------------------- |
Expand All @@ -18,10 +32,17 @@ Trying to implement clean architecture with gin framework.
| `ADMINER_PORT` | `5001` | Adminer DB Port |
| `DEBUG_PORT` | `5002` | Port that delve debugger runs in |

</details>

#### Migration Commands
⚓️ &nbsp; Add argument `p=host` if you want to run the migration runner from the host environment instead of docker environment.

> ⚓️ &nbsp; Add argument `p=host` if you want to run the migration runner from the host environment instead of docker environment.
Check [#19](https://github.com/dipeshdulal/clean-gin/issues/19) for more details. eg; `make p=host migrate-up`

<details>
<summary>Migration commands available</summary>


| Command | Desc |
| ------------------- | ---------------------------------------------- |
| `make migrate-up` | runs migration up command |
Expand All @@ -31,17 +52,32 @@ Check [#19](https://github.com/dipeshdulal/clean-gin/issues/19) for more details
| `make drop` | Drop everything inside database |
| `make create` | Create new migration file(up & down) |

#### Checklist

- [x] Implement Dependency Injection (go-fx)
- [x] Routing (gin web framework)
- [x] Environment Files
- [x] Logging (file saving on `production`) [zap](https://github.com/uber-go/zap)
- [x] Middlewares (cors)
- [x] Database Setup (mysql)
- [x] Models Setup and Automigrate (gorm)
- [x] Repositories
- [x] Implementing Basic CRUD Operation
- [x] Authentication (JWT)
- [x] Migration
- [x] Dockerize Application with Debugging Support Enabled. Debugger runs at `5002`. Vs code configuration is at `.vscode/launch.json` which will attach debugger to remote application.
</details>

## Implemented Features

- Dependency Injection (go-fx)
- Routing (gin web framework)
- Environment Files
- Logging (file saving on `production`) [zap](https://github.com/uber-go/zap)
- Middlewares (cors)
- Database Setup (mysql)
- Models Setup and Automigrate (gorm)
- Repositories
- Implementing Basic CRUD Operation
- Authentication (JWT)
- Migration Runner Implementation
- Live code refresh
- Dockerize Application with Debugging Support Enabled. Debugger runs at `5002`. Vs code configuration is at `.vscode/launch.json` which will attach debugger to remote application. [Learn More](https://medium.com/wesionary-team/docker-debug-environment-for-go-and-gin-framework-36df80e061ac?source=friends_link&sk=35c9d856852944083dd30059200d87f0)

## Todos
- [ ] COBRA Commander CLI Support [#26](https://github.com/dipeshdulal/clean-gin/issues/26)
- [ ] Swagger documentation examples [#25](https://github.com/dipeshdulal/clean-gin/issues/25)
- [ ] Unit testing examples. [#23](https://github.com/dipeshdulal/clean-gin/issues/23)
- [ ] File upload middelware. [#20](https://github.com/dipeshdulal/clean-gin/issues/20)
- [ ] Use of Interfaces [#10](https://github.com/dipeshdulal/clean-gin/issues/10)

## Contributing
Please open issues if you want the template to add some features that is not in todos. 🙇‍♂️

Create a PR with relevant information if you want to contribute in this template.

0 comments on commit bd3db8c

Please sign in to comment.