Skip to main content

Example monorepo

In the 101 course, we used aspect init to make a new empty project. That's good for product engineers, who prefer less cognitive load and can afford to focus on the single language they program in.

In the 201 course, we will use a full-featured "kitchen sink" monorepo: https://github.com/aspect-build/bazel-examples. Developer Infrastructure teams are usually tasked with productivity and maintenance of a big repo with many languages, so that's what we'll show you.

The repository has a primary (top-level) workspace, comprised of a Bazel Module in the root of the repository and various nested modules. There are also some additional nested workspaces, some with multiple modules, for code not part of the primary example workspace.

Exercise: Get the code

Clone the bazel-examples repository to your machine so you can follow along.

  • If you'd rather, you can pair up with someone near you.
  • Or, just follow along with the instructor who presents the content, and come back to clone the repo later.

If your training session has a teaching assistant, remember to reach out with questions in getting this repo functional.

Bits to note in this repo

A bunch of the root files we'll ignore for now.

Here are the files that matter for all languages:

  • MODULE.bazel / MODULE.bazel.lock
  • WORKSPACE.bazel
  • .bazelversion
  • .bazeliskrc

Folders to know about:

  • .aspect/ has settings for Aspect CLI (Optional)
  • tools/ has repo-level setup
  • logger/ is a multi-language example application

Demo

Here is what the application looks like once you've got everything working.

First, we startup the Go backend server:

Then we launch the Java client which produces log messages and sends them to the backend:

Now we can run our Python CLI to see the messages so far:

Finally, we can run a TypeScript web frontend and see the messages there too:

Here's what the app looks like in the browser after loading some messages:

Or we can boot up the iOS app and send/receive messages: