{"id":37154842,"url":"https://github.com/unicod3/horreum","last_synced_at":"2026-01-14T18:18:46.969Z","repository":{"id":86519949,"uuid":"455380684","full_name":"unicod3/horreum","owner":"unicod3","description":"Horreum, is an application to manage products and their stock informations.","archived":false,"fork":false,"pushed_at":"2022-02-08T06:19:33.000Z","size":640,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-13T21:59:56.012Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/unicod3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-02-04T00:55:21.000Z","updated_at":"2024-06-21T18:31:36.253Z","dependencies_parsed_at":"2023-11-28T09:00:32.006Z","dependency_job_id":null,"html_url":"https://github.com/unicod3/horreum","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/unicod3/horreum","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicod3%2Fhorreum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicod3%2Fhorreum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicod3%2Fhorreum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicod3%2Fhorreum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/unicod3","download_url":"https://codeload.github.com/unicod3/horreum/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/unicod3%2Fhorreum/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28430316,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-01-14T18:18:46.434Z","updated_at":"2026-01-14T18:18:46.961Z","avatar_url":"https://github.com/unicod3.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Logo](logo.png) Horreum\n\nFrom Wikipedia, the free encyclopedia;\n\n\u003e *A **horreum** (plural: horrea) was a type of public warehouse used during the ancient Roman period.*\n\u003e Although the Latin term is often used to refer to granaries, Roman horrea were used to store many other types of consumables; the giant Horrea Galbae in Rome were used not only to store grain but also olive oil, wine, foodstuffs, clothing and even marble...\n\u003e\n\u003e https://en.wikipedia.org/wiki/Horreum\n\nFollowing the ancient Roman correspondence Horreum, is an application to manage products and their stock informations.\n\n# Contents\n\n1. [Architectural Design](#architectural-design)\n2. [Project structure](#project-structure)\n3. [Database Diagram](#database-diagram)\n4. [Installation \u0026 Usage](#installation--usage)\n5. [Key Concepts](#key-concepts)\n\n   5.1 [Services](#services)\n\n   5.2 [Server](#server)\n\n   5.3 [Rest API](#rest-api)\n\n   5.4 [Events](#events)\n\n   5.5 [Migrations](#migrations)\n\n   5.6 [Testing](#testing)\n\n\n\n## Architectural Design\n\nEvery application prone to the architectural changes while time goes on and needs changes\nand Horreum no exception to that, to address those concerns Horreum uses [C4 Modelling](https://c4model.com/).\n\nIn order to keep the architectural changes manageable over time, I've used [C4-PlantUML](https://github.com/plantuml-stdlib/C4-PlantUML/)\nto document architectural structure, they can be found under `docs/c4model` folder.\n\nFor the sake of the demo I only designed `System Context` and `Container` Level.\n\n| 1.System Context                                            |                            2.Horreum Container                             |\n|-------------------------------------------------------------|:--------------------------------------------------------------------------:|\n| \u003cimg src=\"./docs/c4model/SystemContext.png\" alt=\"drawing\"/\u003e | \u003cimg src=\"./docs/c4model/HorreumContainer.png\" alt=\"drawing\" width=\"550\"/\u003e |\n\n\n## Project Structure\n\nHorreum uses [Standard Go Project Layout](https://github.com/golang-standards/project-layout) for the structural design.\n\n## Database Diagram\n\n\u003cimg src=\"./docs/DatabaseModel.png\" alt=\"drawing\"/\u003e\n\n## Installation \u0026 Usage\n\nIf you have the docker installed you can just run the command below, and it will do the rest\n```\ndocker-compose up\n```\n\nAfter you complete the installation steps Horreum spins up an http server\nat the port `8080` you can just hit the link below to get start to use swagger:\n\nhttp://localhost:8080/swagger/index.html\n\n\n## Key Concepts\n\n\n### Services\nThere are 4 internal services:\n\n- WarehouseService\n- OrderService\n- ArticleService\n- ProductService\n\nWhich implements their own interfaces:\n\n- WarehouseRepository\n- OrderRepository\n- ArticleRepository\n- ProductRepository\n\nAll the services implements CRUD operations over their related Struct.\n\n\n### Server\n\n`api/server` package lets Horreum to spin up a HTTP and a Streaming server.\n\nTo handle the dependency injection it also introduces a Handler struct which\ncan be used through the application runtime.\n\n```golang\ntype Handler struct {\n\tWarehouseService *warehouse.WarehouseService\n\tOrderService     *order.OrderService\n\tArticleService   *article.ArticleService\n\tProductService   *product.ProductService\n}\n```\n\n### Rest API\n\nHorreum uses Open API as api standard, every controller needs to have open api specs included\nby design, to give you a quick info you can see the below:\n\n\u003e What is the OpenAPI Specification?\n\u003e\n\u003e The OpenAPI Specification, formerly known as the Swagger Specification, is the world’s standard for defining RESTful interfaces. The OAS enables developers to design a technology-agnostic API interface that forms the basis of their API development and consumption.\n\u003e\n\u003e https://swagger.io/solutions/getting-started-with-oas/\n\n\n\n### Events\n\nAside from the CRUD operations; Horreum spins up an streaming message bus over channels\nthis helps Horreum to be more event driven.\n\nThus OrderService publishes a new Event whenever one of the below happens:\n\n- OrderCreated\n    - Handler: Decreases the product stock information accordingly\n- OrderUpdated\n- OrderDeleted\n    - Handler: Increases the product stock information accordingly\n\nTo provide streaming bus feature Horreum uses the `github.com/ThreeDotsLabs/watermill`\nprojects and wraps that under the `pkg/streamer` package.\n\n### Migrations\n\nHorreum uses `pkg/dbclient` package to handle migrations and database related tasks.\n\n`dbclient` under the hood wraps up `github.com/upper/db/v4` package and provides orm-like\napi to internal application.\n\nAnother aspect of the database is of course the managing the migrations, to do that\nHorreum uses `github.com/pressly/goose/v3` package to manage them.\n\nAll the generated migrations can be found under the `pkg/dbclient/migrations` folder.\n\n### Testing\n\nHorreum uses `github.com/stretchr/testify` to handle assertion inside the tests\nno need to mention that mocking is another important aspect of the testing to handle\nthat need Horreum uses `github.com/vektra/mockery` library which can automaticaly generate\nmocks over existing interfaces.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funicod3%2Fhorreum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Funicod3%2Fhorreum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Funicod3%2Fhorreum/lists"}