# How to let developers build against code they cannot read

> Binaries, a service, declaration files, or a workspace with two sides: four ways to let someone compile and call code without reading it, and what each costs.

Source: https://occlude.dev/blog/build-against-code-you-cannot-read/ · 20 November 2026 · By Aman Sharma


There are four ways to let a developer compile against and call code they are not allowed to read: ship it to them compiled, put it behind a service, give them only its declarations, or let the build run where the code is while they work where it is not. The first three change your codebase to fit the boundary. The fourth changes where the build runs.

![Four approaches side by side. A compiled library gives the developer a binary and a header. A service gives them an API. Declaration files give them signatures. A two-sided workspace gives them signatures while the build reads the real source. Only the last builds and tests against the current code without a release step](https://occlude.dev/figures/call-without-reading.webp)

*Four ways to build against code you cannot read, and what the developer's build runs against in each.*

## The question as people ask it

On Software Engineering Stack Exchange, a team described developers who "will need to call but they should not see the underlying logic". The accepted answer was to treat that code "as if it was developed as a closed source software by a 3rd party vendor". That is the first option below, and the usual answer.

## Ship it compiled

Build the protected module separately and give everyone else the compiled form with a header or an interface: a `.so` or `.a` with a C header, a `.jar`, an `.aar`, a framework. Export rules lean the same way: US rules on deemed exports name source code and leave object code out.

It works for a stable library. It fails when people work next to that code every day, because the binary is out of date the moment the protected code changes, and every change becomes a release.

## Put it behind a service

Move the logic out of the codebase and call it over the network. The developer sees an API and never the implementation.

This is a real architecture change. It suits logic that should be a service anyway. It does not suit a pricing function called from a hundred places in a monorepo, because every call becomes a network call and every test needs the service running.

## Give them only the declarations

In typed languages, a module's signatures can be separated from its body. TypeScript's `emitDeclarationOnly` will "Only emit .d.ts files; do not emit .js files". C and C++ have headers. A developer with only the declarations gets autocomplete and type checking against the real interface.

They cannot run anything. The declarations compile; the program does not, because nothing implements them. Tests that exercise the protected code cannot run on their machine at all.

## Build where the code is

The three options above all move the boundary into the codebase. The fourth keeps the codebase as it is and moves the build.

The developer works in a workspace with two sides. Their side holds the files their task needs, plus declarations wherever their code imports a protected module. The build's side holds the whole repository. When they run `npm test`, it runs on the build's side, against the real code, and the output comes back with anything from the protected code taken out. A failure inside protected code shows as a protected module, next to the line in their own file that led there.

So the developer gets what declarations alone give, autocomplete and type checking against declarations, and also what none of the others give: a build and a test run against the current code, with no release step.

## Side by side

| | What the developer has | Their build and tests run against | When the protected code changes |
|---|---|---|---|
| Ship it compiled | A binary and an interface | The last released binary | A new release |
| A service | An API | The service, if they can reach it | Nothing, if the API holds |
| Declarations only | Signatures | Nothing: they cannot run it | New declarations |
| Build where the code is | Signatures | The real, current code | Nothing |

## Where Occlude fits

Occlude is the fourth option, run in your cloud. [How a build runs](https://occlude.dev/docs/builds/) walks through one build from the command to the output, and [Stubs](https://occlude.dev/docs/stubs/) says what the declarations contain and what they never do.

If the protected code is a stable library with a small interface, ship the binary. It is cheaper, and it has worked for decades.

## Sources

Each page last read on 28 November 2026.

- [Software Engineering Stack Exchange: Source Control Design for Proprietary Logic which includes Obfuscation](https://softwareengineering.stackexchange.com/questions/451159/source-control-design-for-proprietary-logic-which-includes-obfuscation).
- [TypeScript: emitDeclarationOnly](https://www.typescriptlang.org/tsconfig/emitDeclarationOnly.html).
- [15 CFR 734.13, on eCFR](https://www.ecfr.gov/current/title-15/subtitle-B/chapter-VII/subchapter-C/part-734/section-734.13), for source code and object code.
