Skip to content

tuanlc/book-management

Repository files navigation

Book management

action status Go Report Card MIT license Go.Dev reference

Table Of Contents

Motivation

I'm a Golang & gRPC newbie (August 2022). A good way to practice is working on a real opensource project, so I decided to create & work on the book management project with these technologies. If you are a newbie as me, don't hesitate to join me in contribute to this project. If you are an experienced developer, I'm highly appreciate you if you can take a look to the project structure, codebase, etc and give me any feedback on mistakes, good practices, etc. Feel free to create issues or join the project discussion

You can use this project as the template for the following technologies.

Technologies

Demonstration

You can experiment the project quickly on your local by using docker compose.

Setup & up services

$ docker-compose pull
$ docker-compose up -d

You can verify all service up without any error by:

$ docker-compose ps

               Name                             Command               State                    Ports                  
----------------------------------------------------------------------------------------------------------------------
book-management-server               ./main.out                       Up      0.0.0.0:8080->8080/tcp,:::8080->8080/tcp
book-management_database-manager_1   entrypoint.sh docker-php-e ...   Up      0.0.0.0:9000->8080/tcp,:::9000->8080/tcp
database                             docker-entrypoint.sh postgres    Up      0.0.0.0:5432->5432/tcp,:::5432->5432/tcp

Services:

  • book-management-server: gRPC server is listening on port 8080
  • database: Postgresql database service
  • book-management_database-manager_1: Database management UI service

Test

There is no gRPC client for the project yet. However, you can use Postman to test APIs. Thanks to Postman.

simplescreenrecorder-2022-08-07_16.04.01.mp4

Development

Prequisite

$ make deps

Configure databse DNS

Set the environment varibale DATABASE_DNS to configure database DNS. For example:

$ DATABASE_DNS=host=localhost user=admin password=admin dbname=book-management port=5432 sslmode=disable TimeZone=Asia/Ho_Chi_Minh

Run in dev mode with hot reload feature

$ make dev

Unit test

$ make test

Production

Run

$ make run

License

MIT

Copyright (c) 2022-present, Tuan LE CONG