{"id":18081123,"url":"https://github.com/thundergolfer/example-bazel-monorepo","last_synced_at":"2025-04-05T03:08:45.823Z","repository":{"id":43175319,"uuid":"179212915","full_name":"thundergolfer/example-bazel-monorepo","owner":"thundergolfer","description":"🌿💚  Example Bazel-ified monorepo, supporting Golang, Java, Python, Scala, and Typescript","archived":false,"fork":false,"pushed_at":"2023-07-23T22:57:01.000Z","size":603,"stargazers_count":334,"open_issues_count":15,"forks_count":34,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-04T12:55:25.373Z","etag":null,"topics":["bazel","bazel-monorepo","blaze","buck","build-tool","platform-engineering"],"latest_commit_sha":null,"homepage":"https://buildkite.com/thundergolfer-inc/the-one-true-bazel-monorepo","language":"Java","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/thundergolfer.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":"2019-04-03T04:53:27.000Z","updated_at":"2025-03-29T16:34:08.000Z","dependencies_parsed_at":"2024-06-21T17:59:52.744Z","dependency_job_id":"21c3408b-cffb-434f-bd9a-9a4853022b53","html_url":"https://github.com/thundergolfer/example-bazel-monorepo","commit_stats":{"total_commits":392,"total_committers":4,"mean_commits":98.0,"dds":0.173469387755102,"last_synced_commit":"7f3e3b4a104564f1cb20581f0c541fe64977777a"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thundergolfer%2Fexample-bazel-monorepo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thundergolfer%2Fexample-bazel-monorepo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thundergolfer%2Fexample-bazel-monorepo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thundergolfer%2Fexample-bazel-monorepo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thundergolfer","download_url":"https://codeload.github.com/thundergolfer/example-bazel-monorepo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247280269,"owners_count":20912967,"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":["bazel","bazel-monorepo","blaze","buck","build-tool","platform-engineering"],"created_at":"2024-10-31T13:13:00.622Z","updated_at":"2025-04-05T03:08:45.800Z","avatar_url":"https://github.com/thundergolfer.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eExample Bazel Monorepo\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://buildkite.com/thundergolfer-inc/the-one-true-bazel-monorepo\"\u003e\n        \u003cimg src=\"https://badge.buildkite.com/aa36b75077a5c69156bc143b32c8c2db04c4b20b8706b8a99b.svg?branch=master\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n----\n\n\u003e *Note:* Currently supporting the latest Bazel version as at mid June 2021, [4.1.0](https://github.com/bazelbuild/bazel/releases/tag/4.1.0) \n\nExample Bazel-ified monorepo, supporting *Golang*, *Java*, *Python*, *Scala*, and *Typescript*. \n\nCloud Infrastructure-as-Code is done using _Terraform_.\n\nI use this project to explore how Bazel works with different languages and\ndeveloper tools, and keep a record of best-practices I've learnt. So it is a work in progress.\nOthers can use it to check out the Bazel way of doing things and use parts\nas a reference implementation.\n\nRather than the typical To-Do list, this project's code uses the contrived scenario of a book shop and reading catalogue website called *Antilibrary*. 📗📕📒📚\n\n## Getting Started\n\n#### Prerequisites:\n \n- [**Install Bazel**](https://docs.bazel.build/versions/master/install.html) (Currently supporting ~= `4.x.x`)\n- **Python 2 or 3**. Should only be required to [do some bootstrapping under-the-hood](https://github.com/bazelbuild/bazel/issues/8446).\n- [**`yarn`**](https://yarnpkg.com/) or [**`npm`**](https://www.npmjs.com/) for the NodeJS and Typescript code\n\nBazel aims to be 'build anything, anywhere' system, so building and testing should be as simple as `bazel test //...`. If it's not, please [create an issue](https://github.com/thundergolfer/example-bazel-monorepo/issues/new/choose). \n\n## Why use a Monorepo?\n\nThe following few articles together provide a good overview of the\nmotivations behind maintaining a Monorepo. For heaps more information,\n[korfuri/awesome-monorepo](https://github.com/korfuri/awesome-monorepo)\nis a good place to go. \n\n* [*Why Google Stores Billions of Lines in a Single\n  Repository*](http://delivery.acm.org/10.1145/2860000/2854146/p78-potvin.pdf?ip=60.240.50.147\u0026id=2854146\u0026acc=OA\u0026key=4D4702B0C3E38B35%2E4D4702B0C3E38B35%2E4D4702B0C3E38B35%2E5945DC2EABF3343C\u0026__acm__=1558760299_19ae56a814d1fe05de26b4844a658e52)\n* [*Monorepos, please\n  do!*](https://medium.com/@adamhjk/monorepo-please-do-3657e08a4b70), by\nAdam Jacob, former CTO of [Chef](https://www.chef.io/)\n* [*Repo Style Wars: Mono vs. Multi*](https://gigamonkeys.com/mono-vs-multi/), by Peter Seibel\n* [*Advantages of Monorepos*](https://danluu.com/monorepo/), by Dan Luu\n\n### Related Projects\n\n* [github.com/lucperkins/colossus](https://github.com/lucperkins/colossus) - A demo using Bazel in monorepo fashion. Compared with this project, it goes far deeper on microservice architecture components and Kubernetes, and is not focused on Bazel.\n* [github.com/enginoid/monorepo-base](https://github.com/enginoid/monorepo-base) - Employs Bazel, gRPC, and Kubernetes like the above, and is similarly not as broad and deep on Bazel as this project.\n\n## Project Structure\n\n### *Golang* Support\n\nThere's Golang code in [`/cli`](/cli). It implements a simple CLI for the common 'Blind Date With a 📖' product.\n\n##### Dependency Management\n\nThird-party dependencies are managed in [`3rdparty/go_workspace.bzl`](/3rdparty/go_workspace.bzl).  \n\n### *Java* Support\n\nThere's a [Spring Boot](https://spring.io/projects/spring-boot) (with PostGres) application in [`/store-api`](/store-api) and some other Java code in [`/store/layoutsolver`](/store/layoutsolver).\n\n##### Dependency Management\n\nIts third-party dependencies are managed by [`rules_jvm_external`](https://blog.bazel.build/2019/03/31/rules-jvm-external-maven.html) in the [`WORKSPACE`](/WORKSPACE) (See the `# JAVA SUPPORT` section).\n\n### *Scala* Support\n\nThere's Scala code contained in [`scala-book-sorting`](/scala-book-sorting).\n\n##### Dependency Management\n\nIts third-party dependencies are managed\nby [`johnynek/bazel-deps`](https://github.com/johnynek/bazel-deps). The usage of that tool is wrapped up in a script\nas [`tools/update_jvm_dependencies.sh`](tools/update_jvm_dependencies.sh).\n\nTo use it, you update [`tools/dependencies/jvm_dependencies.yaml`](tools/dependencies/jvm_dependencies.yaml) and then run the script.\n\n\n### *Python* Support\n\nThere's Python code in the [`/book_sorting`](/book_sorting) and [`/scraping`](/scraping).\n\n[`bazelbuild/rules_python`](https://github.com/bazelbuild/rules_python) is used for the core `py_*` rules.\n\n##### Dependency Management\n\nIn order to add new third-party packages for Python, add them to [`3rdparty/requirements.in`](/3rdparty/requirements.in) and run `bazel run //3rdparty:requirements.update`.\n\n##### Gradual Type-Checking (MyPy)\n\n[thundergolfer/bazel-mypy-integration](https://github.com/thundergolfer/bazel-mypy-integration) is used to check any type annotations at `bazel build` time.\n\n### Infrastructure-as-Code (Hashicorp Terraform)\n\nThe [`infrastructure/`](/infrastructure) top-level folder contains Terraform defining various AWS resources and their configuration. \n\n----\n\n## Development\n\n### Build\n\n`bazel build //...`\n\n### Testing\n\n`bazel test //...`\n\n### Continuous Integration (CI)\n\nThis repository's CI is managed by [Buildkite](https://buildkite.com), the CI platform used by Pinterest and Canva to manage Bazel monorepos,\nas well as being [used by the Bazel open-source project itself](https://buildkite.com/bazel).\n\n### Deployment \u0026 Distribution\n\nDeployable artifacts are pushed to S3 under commit-hash-versioned keys.\nCurrently only the `store-api` deploy/fat JAR is deployable.\n\n[`graknlabs/bazel-distribution`](https://github.com/graknlabs/bazel-distribution) is used to publish Python packages to PyPi. \n\n### Build Observability + Analysis\n\nThis project is using [Buildbuddy.IO](https://buildbuddy.io/). Every build run locally or in CI get its own `https://app.buildbuddy.io/invocation/xyz123...` URL which analyses and records the build's information.\n\n### Linting\n\n[thundergolfer/bazel-linting-system](https://github.com/thundergolfer/bazel-linting-system) is used. [`./tools/linting/lint.sh`](tools/linting/lint.sh) will lint all source-code in the repo and [`./tools/linting/lint_bzl_files.sh`](tools/linting/lint_bzl_files.sh) will lint all Bazel files.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthundergolfer%2Fexample-bazel-monorepo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthundergolfer%2Fexample-bazel-monorepo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthundergolfer%2Fexample-bazel-monorepo/lists"}