{"id":15161772,"url":"https://github.com/jeamon/demo-redis","last_synced_at":"2026-01-20T18:56:51.113Z","repository":{"id":152279688,"uuid":"616431007","full_name":"jeamon/demo-redis","owner":"jeamon","description":"Demo Go-based RestFul API backend implementation with Redis \u0026 HTTP-Router. Driven by DDD approach in a flat style project structure for simplicity.","archived":false,"fork":false,"pushed_at":"2024-09-16T22:27:55.000Z","size":173,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T01:23:48.796Z","etag":null,"topics":["boltdb","ddd","docker","docker-compose","go","golang","http-router","json","redis","restful-api","yaml"],"latest_commit_sha":null,"homepage":"https://blog.cloudmentor-scale.com","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jeamon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-20T11:29:29.000Z","updated_at":"2024-09-16T22:27:59.000Z","dependencies_parsed_at":"2024-09-17T03:18:10.480Z","dependency_job_id":null,"html_url":"https://github.com/jeamon/demo-redis","commit_stats":{"total_commits":292,"total_committers":1,"mean_commits":292.0,"dds":0.0,"last_synced_commit":"781200136b265d9d85b4a61152ff8214a48ee643"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeamon%2Fdemo-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeamon%2Fdemo-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeamon%2Fdemo-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeamon%2Fdemo-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeamon","download_url":"https://codeload.github.com/jeamon/demo-redis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755560,"owners_count":20990620,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boltdb","ddd","docker","docker-compose","go","golang","http-router","json","redis","restful-api","yaml"],"created_at":"2024-09-27T00:44:51.476Z","updated_at":"2026-01-20T18:56:51.059Z","avatar_url":"https://github.com/jeamon.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# demo-redis\n\n[![Build Status](https://github.com/jeamon/demo-redis/actions/workflows/tests.yml/badge.svg)](https://github.com/jeamon/demo-redis/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/jeamon/demo-redis)](https://goreportcard.com/report/github.com/jeamon/demo-redis)\n[![codecov](https://codecov.io/gh/jeamon/demo-redis/graph/badge.svg)](https://codecov.io/gh/jeamon/demo-redis)\n![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/jeamon/demo-redis)\n[![MIT License](https://img.shields.io/github/license/jeamon/demo-redis)](https://github.com/jeamon/demo-redis/blob/main/LICENSE)\n\nThis is a small go-based project to craft an `API` Backend which persist to `Redis`. It can be run on bare-metal computer as well\nin containerized environment with `Docker` and `Docker-Compose`. Keep watching for more features updates like `redis-based pubsub`  async event for persisting data to file-like storage such as `BoltDB` and authenticate \u0026 authorize with `JWT (Json Web Token)` and log monitoring with `Loki/Grafana` and metrics monitoring with `Prometheus/Grafana` and tracing with `OpenTelemetry/Tempo`. The project mimic a DDD approach but in order to keep it minimal (avoid folders/packages) - I crafted it with some flat contextual files. Based on each file name, you can easily restructure to packages-based style.\n\n## Get-Started\n\nYou can run this project directly on your host machine (windows or linux or macos) or inside containerized environment (with docker-compose). I will be adding K8s manifest files soon. You can use the Make Tool for common tasks (check the `Makefile` for available actions). Make sure, you have `git` or [`git bash`](https://git-scm.com/downloads) and `make` tools installed along with `docker` or `docker desktop` and `docker-compose`. All these tools could be installed even on windows-based machine. i.e install [make tool on windows](https://gist.github.com/evanwill/0207876c3243bbb6863e65ec5dc3f058#make). You can use a hybrid approach like running some services (especially `Redis` container) inside a linux-based [virtual machine](https://www.vmware.com/pl/products/workstation-player.html) and the `golang app` on your local machine. Feel free to use whatever approach that better suit to your setup. Finally you can always [download golang](https://go.dev/doc/install) from official page.\n\n\n**[Step 1] -** Clone or download the repository on your local machine\n\n```shell\n$ git clone https://github.com/jeamon/demo-redis.git\n$ cd demo-redis\n```\n\n\n**[Step 2] -** Open and check the `config.yml` and `config.env` files\n\n*Update the content (especially the redis and app host \u0026 port values) based on your setup or leave it like it is.*\n\n\n**[Step 3] -** Build and/or run the project\n\n* **Method 1:** Use docker-compose to build and spin up the project\n\n```shell\n$ make docker.build\n$ make docker.run\n```\n\n* **Method 2:** Run the Redis in docker and the App locally\n\nGo inside the `config.yml` file and change the server host value to `host: \"127.0.0.1\"`\nThen change the `redis host` value to the exact `IP address` of the host where it is running.\nFinally do the same changes inside the `config.env` file for both `server host` and `redis host`.\n\n   * *create volume and start redis instance from your docker host*\n\n        ```shell\n        $ docker volume create db.demo.redis.data\n        $ docker run -d --name db.demo.redis -v db.demo.redis.data:/data -p 6379:6379 redis redis-server --requirepass \"\u003csecret\u003e\"\n        ```\n    \n   * *start the server on your local machine (depending if you have make or/and git tools)*\n\n        ```shell\n        $ make local.run\n        ```\n\n        ```shell\n        $ DRAP_REDIS_HOST=\u003cIP.ADDRESS.REDIS.HOST\u003e make local.run\n        ```\n        \n        ```shell\n        $ go run -ldflags \"-X 'main.GitCommit=$(shell git rev-parse --short HEAD)' -X 'main.GitTag=$(shell git describe --tags --abbrev=0)' -X 'main.BuildTime=$(shell date -u '+%Y-%m-%d %I:%M:%S %p GMT')'\" .\n        ```\n       \n        ```shell\n        $ go run .\n        ```\n    \n   * *delete the container and volume created before for redis on your docker host*\n\n        ```shell\n        $ docker rm -f db.demo.redis\n        $ docker volume rm db.demo.redis.data\n        ```\n\n   * *connect to redis server from another temporary redis-cli container (on your docker host)*\n\n        ```shell\n        $ docker run --rm -it --link db.demo.redis:redis-cli --name redis-cli redis sh\n        $ redis-cli -h db.demo.redis\n        $ auth default \u003csecret\u003e\n        ```\n\n\n**Step 4:** Check by performing basics requests (from `curl` or `postman` or `browser`)\n\n```shell\n## example of basic app checking\n$ http://\u003cserver-address\u003e:8080/\n\n## example of fetching app status info\n$ http://\u003cserver-address\u003e:8080/status\n\n## example of all books listing request\n$ http://\u003cserver-address\u003e:8080/v1/books\n\n## example of pulling in-use app settings\n$ http://\u003cserver-address\u003e:8080/internal/configs\n```\n\n```shell\n## example of book creation request\n\n$ curl -X POST http://\u003cserver-address\u003e:8080/v1/books \\\n   -H 'Content-Type: application/json; charset=UTF-8' \\\n   -d '{\"title\": \"golang programming\", \"description\": \"Pratical golang exercices\", \"author\": \"Jerome Amon\", \"price\": \"10$\"}'\n```\n\n\n## Contact\n\nFeel free to [reach out to me](https://blog.cloudmentor-scale.com/contact) before any action. Feel free to connect on [Twitter](https://twitter.com/jerome_amon) or [linkedin](https://www.linkedin.com/in/jeromeamon/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeamon%2Fdemo-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeamon%2Fdemo-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeamon%2Fdemo-redis/lists"}