Many SaaS platforms need to run customer code securely and fast. Rather than building container infrastructure from scratch, you can use Depot's API to handle the heavy lifting. Here's how to build Go tooling that creates isolated projects, manages builds, and tracks metrics for your customer workloads.
A lot of our customers run into the same problem: they need to run code on behalf of their customers. Whether you're hosting user-generated Python scripts, processing custom containers, or running code in isolated environments, you end up needing fast, reliable container builds that don't become a bottleneck.
Rather than managing all the container orchestration complexity in-house, many of our customers outsource the container building to us and use our API for the heavy lifting. In this post, we'll walk through how to use the Depot API to set up and administer isolated project cache, report build metrics, and get build logs for your customer workloads.
We'll use Go to build tooling that creates and manages container builds for a multi-tenant SaaS platform.
Depot core API
The Depot core API uses buf.build, so it supports both Connect and gRPC protocols.
Thanks to Buf, we can automatically generate client libraries for many languages. In this example, we'll use Go as the backend language, but Buf can be used in many other languages.
Architecture overview
We'll build some tools to create isolated build environments for users. For a new user, we'll create a new project and a new project-scoped token. Next, we'll get container build metrics including durations. Finally, we'll retrieve the container's steps.
Getting started with the Go Client
... continue reading