- copy .env.example and setup your own env.make sure you fill in all required env
cp .env.example .env
- download all depedencies
go mod download
- First you need to Make sure your psql connection is connected.Run app
DB_HOST=<DB_HOST> go run main.go
- While development, just repeat step 4 to get changes
-
First you need to make sure you have added your own env as listed in the service environment inside docker-compose
-
Build app using docker
make docker-build
- Run all container
make docker-up
Also you can combine those two command with
docker-compose up --build
and if you need to run in background proccess add argument -d.see documentation for details.
- While development to get changes from application, just rebuild your service-app
make edufund-rebuild
and restart then
make edufund-restart
If you want to rebuild all containers, do these steps sequentially
make docker-down
make docker-build
make docker-up
- Models
- Same as Entities, will used in all layer. This layer, will store any Object’s Struct and its method
- Repository
- Repository will store any Database handler. Querying, or Creating/ Inserting into any database will stored here. This layer will act for CRUD to database only. No business process happen here. Only plain function to Database.
- Feature & Usecase
- This layer will act as the business process handler. Any process will handled here. This layer will decide, which repository layer will use. And have responsibility to provide data to serve into delivery. Process the data doing calculation or anything will done here
- Delivery
- This layer will act as the presenter. Decide how the data will presented.
- Clean Code Using SOLID Principles
- uncle bob's explanation
- Standard Go Project Layout :3
- multiple entrypoints of building a binary executable
- [Makefile][#makefile]
- productive command dictionary
- UnitTest
- validate that each unit of the software code performs as expected
See coverage testing result
make test-unit
- sqlx/db
- for sql driver
- godotenv
- for local environtment management
- gin
- for serve http
- jwt
- for auth security issue
- go-sqlmock, gomonkey, testify
- for testing purpose
Endpoint | Path | Interface |
---|---|---|
POST /api/v1/user/account-creation |
[internal/feature/contract.user.go] | SetupUser |
POST /api/v1/user/account-login |
[internal/feature/contract.user.go] | AccountLogin |