Build Pipeline
How Platrium code flows from API definitions to Go and Rust.
Welcome to Platrium's development pipeline! We utilize a strict Design-First approach driven by a Monorepo that uses the Nx Build System. This means we write our API specifications first, and then heavily automate the generation of our server stubs and client SDKs.
By automating the boring stuff, we ensure our Go backend and Rust SDK are always 100% perfectly in sync.
Here is a high-level look at how the pipeline works:
API Definitions in TypeSpec
Everything starts in the api/ folder. Instead of hand-writing thousands of lines of verbose OpenAPI YAML, we use TypeSpec.
TypeSpec feels like TypeScript but is designed specifically for defining APIs. You write clean, concise .tsp files, and our Nx pipeline automatically compiles them down into a massive, standardized openapi.yaml file located in api/rest/_generated/openapi.yaml.
This YAML file becomes the single source of truth for the entire platform.
The Generators
Once the OpenAPI YAML is generated, the pipeline splits into two distinct paths: the Server and the Client.
The Core Engine (Go Server)
For the backend, we use oapi-codegen. It reads the openapi.yaml and spits out strongly-typed Go interfaces and structs directly into the core/internal/restapi/_generated/ folder.
All the backend developers have to do is implement those interfaces! If the API design changes, the Go compiler will immediately fail if the backend implementation doesn't match the new generated interfaces.
The SDK (Rust Client)
For the client side, we use the openapi-generator-cli. This tool reads the exact same openapi.yaml and generates a fully functional Rust REST client inside sdk/_generated/.
This means our SDK developers never have to manually write HTTP requests, serialization logic, or error handling. They just call the generated Rust functions!
The Cross-Platform SDK
Because Platrium is designed to run everywhere, we built our SDK in Rust. But we don't expect mobile or web developers to write Rust!
To solve this, our pipeline automatically compiles the Rust SDK and binds it to other languages using UniFFI.
When you run the build commands (like nx run sdk:generate-ffi-android), the pipeline compiles the Rust code into massive .so binaries, automatically generates the Kotlin wrapper code, and drops everything into the sdk/_ffi/android/ folder, ready to be consumed by the Android app!