Minimal Example
This is the smallest useful Capsule shape for a developer who wants one app, one manifest, and one successful enclave run.
Use this page after the parent instance is already prepared. The example keeps the manifest small, keeps the application boundary simple, and uses the Capsule API only from inside the enclave.
Minimal capsule.yaml
Start with the smallest manifest that still expresses the runtime boundary clearly.
version: "v1"
name: "hello-capsule"
target: "hello-capsule:enclave"
sources:
app: "hello-capsule:latest"
defaults:
cpu_count: 2
memory_mb: 4096
ingress:
- listen_port: 8000
egress:
allow:
- "api.openai.com"
- "169.254.169.254"
api:
listen_port: 18000
aux_api:
listen_port: 18001
18000 or 18001 through ingress.Minimal Application Integration
Your application talks to Capsule over localhost HTTP, not through direct Nitro SDK integration.
const capsuleBase = "http://127.0.0.1:18000";
export async function loadCapsuleContext() {
const [identity, entropy] = await Promise.all([
fetch(`${capsuleBase}/v1/eth/address`).then((r) => r.json()),
fetch(`${capsuleBase}/v1/random`).then((r) => r.json()),
]);
return {
enclaveAddress: identity.address,
randomBytes: entropy.random_bytes,
};
}
Build And Run Commands
Assuming the parent instance is already prepared, these are the commands most developers need.
Build the normal application image
Run docker build -t hello-capsule:latest . and make sure the container shape already works.
Build the Capsule release image
Run capsule-cli build -f capsule.yaml.
Run the enclave
Run sudo capsule-cli run -f capsule.yaml -p 8000:8000.
Verify the endpoint and local Capsule calls
Call the app endpoint from outside the enclave and confirm the app can still call the Capsule API on 127.0.0.1:18000 internally.
docker build -t hello-capsule:latest .
capsule-cli build -f capsule.yaml
sudo capsule-cli run -f capsule.yaml -p 8000:8000
# Example external call
curl http://127.0.0.1:8000
# Then inspect logs if needed
docker logs <capsule-shell-container>
Next step: after this minimal flow works, move to App Template or Examples and replace the toy shape with your actual service.