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.


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 walks through one build from the command to the output, and 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.
- TypeScript: emitDeclarationOnly.
- 15 CFR 734.13, on eCFR, for source code and object code.
Want to go through this for your codebase?
Or write to contact@occludehq.com
Not ready to talk? Step through a session on a sample repository