Code-Infrastructure-as-Code (CIaC): one source file, five targets, full simulation, no (required) infrastructure #36
Pinned
jrcalgo
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Most backend generators are optimized for getting you from zero to a working project. You generate the initial code, take ownership of it, and over time the generated structure and your application code can diverge enough that regenerating becomes difficult or undesirable.
CIaC takes a different bet. You write one .ciac file describing your system and keep that file as the architectural source of truth. CIaC is structured around services, APIs, records, event streams, workers, pipelines, and their infrastructure dependencies. The compiler owns the generated wiring, while your business logic lives in generated stubs that remain yours to edit and are preserved across builds.
One spec, five idiomatic targets
The same
.ciacfile compiles to functioning code in five languages, each idiomatic to its own ecosystem, byte-identical on every rebuild:net/httpServeMux@RestControllerdatabase/sqlpoolJdbcClientHere's
examples/multi-service-media.ciacfrom the repo: a real five-service system, not a toy: an upload API that charges through aBillingservice via a typed cross-service call, aTranscoderworker that consumes the resulting event and republishes success or failure, aNotifierthat emails on success and archives on failure, and aProgressFeedservice pushing live updates over WebSocket:That one file compiles to functioning code in five languages, each idiomatic to its own ecosystem, byte-identical on every rebuild:
Pick a target with a flag, nothing else changes.
Test the whole system before a container exists
The most exciting part: CIaC ships with a deterministic simulator that runs your generated code against in-memory fakes for the database(s), queue(s), object store(s), and email(s). No Docker, no infra in CI.
Here it is exercising the full upload -> charge -> transcode -> notify flow across all five services at once:
ciac sim examples/multi-service-media.ciac --target python --out ./build \ --scenario sim/multi-service-media.ciac-sim.json # [PASS] 28-m3-upload-charges-transcodes-notifiesWhen you're ready for the real thing,
ciac verifybuilds and boots the actual generated project, andciac build --deploy k8s(orterraform, orci) emits real deployment artifacts.Who is this (not) for?
CIaC fits best in systems that are naturally a typed graph of services, APIs, pipelines, and streams, just as the media example above displays.
It's a poor fit if your architecture doesn't map onto this ontology, or if you're working with existing handwritten services rather than starting fresh; CIaC assumes greenfield development.
Try it
Full walkthrough and language reference in the README and docs/.
All reactions