A Simple Todo app using Golang, Protocol Buffer, Wire, Postgres, Mockery, Grpc, and Docker
- Docker Desktop
- When using Docker Desktop,you can skip the rest of the steps
- Go
- Wire
- Wire is used for dependency injection
- Mockery
- Mockery is used for mocking interfaces
- Postgres
- Postgres is used as the database
- gRPC
- gRPC is used for communication between services
- Modify .env accordingly
- Build the app
docker-compose build
- Run the app
docker-compose up
Note: first time running this command will take a while to download the images, but the next time will be faster, also the first time may fail because the app is trying to connect to the database before it is ready, just run the command again and it should work. In case it is still not working, modify the cmd in .air.toml and add a sleep command before running the app (look at the .air2.toml for example)
- Setup Local Postgres database
- Create database
todo
- Create database
- Modify .env file accordingly
- Make sure postgres credentials match with your local postgres
- Run the app
go run cmd/server/main.go
- Tables will be created automatically
- Run the client app
go run cmd/client/main.go
- It should execute the commands in the cmd/client/main.go file and print the result
sh scripts/protoc.sh
sh scripts/mockery.sh
sh scripts/coverage.sh
sh scripts/wire.sh
sh scripts/check_all.sh