Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/opplieam/bb-product-server
https://github.com/opplieam/bb-product-server
Last synced: 1 day ago
JSON representation
- Host: GitHub
- URL: https://github.com/opplieam/bb-product-server
- Owner: opplieam
- License: gpl-3.0
- Created: 2024-08-27T17:26:51.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-11-29T14:29:26.000Z (about 2 months ago)
- Last Synced: 2024-11-29T15:31:31.012Z (about 2 months ago)
- Language: Go
- Size: 55.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Buy-Better Product Server
## Table of contents
- [Overview](#overview)
- [Project structure](#project-structure)
- [Dependencies](#dependencies)
- [Developer Setup](#developer-setup)
- [Running Test](#running-test)
- [Running in local cluster minikube](#running-in-local-cluster-minikube)
- [Postman Testing](#postman-testing)## Overview
Buy Better Product server is a grpc server that responsible for the products related logic.
example `GetProductsByUser` etc.`NOTE: This project is for learning purpose and not fully complete yet`
## Project structure
```
├── .gen # auto generated by jet-db
│ ├── buy-better-core
├── .github
│ ├── workflows
├── bin # go binary
├── deploy # helm chart
│ ├── bb-product-server # project helm chart
├── cmd
│ └── server # main package for product service
├── internal
│ ├── product # product service handler
│ └── store # database logic
└── k8s
├── base # kustomize base
└── dev # patch kustomize
```## Dependencies
#### Infrastructure
- docker / docker-compose
- minikube
- kubectl / kustomize
- helm
#### Database tools
- CLI [jet-db](https://github.com/go-jet/jet?tab=readme-ov-file#installation)
#### Testing tools
- CLI [mockery](https://vektra.github.io/mockery/latest/installation/)## Developer Setup
1. Create environment variable store in `.env` file at root directory
```
DB_DRIVER="postgres"
DB_DSN="postgresql://postgres:admin1234@localhost:5433/buy-better-core?sslmode=disable"
DB_MAX_OPEN_CONNS=25
DB_MAX_IDLE_CONNS=25
DB_MAX_IDLE_TIME="15m"
```
> environment variables must be match with Makefile2. Visit `Makefile` There are 2 important variables for local development. Feel free to edit.
```
DB_DSN
DB_NAME
DB_USERNAME
CONTAINER_NAME
```3. Please visit [Buy-Better-Core](https://github.com/opplieam/bb-core-api) and run `make dev-db-up` from there
4. `go run cmd/server` start the service with port `:3031`
## Running Test
`go test ./... -v` Currently, There is unit test only.
## Running in local cluster minikube
Please keep in mind. This project meant to be running with other [service](https://github.com/opplieam/bb-core-api).`make dev-apply` to apply product service to local cluster
## Postman testing
Please import the proto file from [Buy-Better-Proto](https://github.com/opplieam/bb-grpc)## Useful Command/Makefile
Please visit `Makefile` for the full command.
- `make jet-gen` generate a type safe from database. run this command everytime there is a change in database schema.
- `mockery` generate a mock file. please visit `.mockery.yaml` for the setting
- `make dev stop` delete the product service resource## TODO
- Add grpc healthcheck
- Make address as an environment variable