Skip to main content

SDKs

Two typed clients, TypeScript and Go, generated from the same API contract, and two SDKs with the runtime of the deployed application, Python and Java. Download them at zero.nnumbers.com.br/downloads.

Why a file, and not a public registry

The platform namespace does not resolve through npm install, go get, pip install or any Maven repository — that is an architectural decision. What is distributed is the real consumption model: the packed npm package, the Go package to vendor by copy (exactly how the CLI and the MCP server consume the Go SDK), the Python .whl and the Java jar.

TypeScript​

curl -fsSLO https://zero.nnumbers.com.br/downloads/zero-sdk-typescript.tgz
curl -fsSLO https://zero.nnumbers.com.br/downloads/SHA256SUMS
shasum -a 256 -c SHA256SUMS --ignore-missing
npm install ./zero-sdk-typescript.tgz

npm install @nnumbers/zero fails: the name is not in any registry. Commit the .tgz to the application's repository — package.json then points to file:./zero-sdk-typescript.tgz, and the platform does not inject the SDK into the build. See Installing the SDK.

import { ZeroClient } from '@nnumbers/zero';

const zero = new ZeroClient({
baseUrl: 'https://api.zero.nnumbers.com.br',
token: process.env.ZERO_TOKEN,
});

// deploy, with an idempotency key — repeating never duplicates
const deployment = await zero.createDeployment(service, {},
{ idempotencyKey: crypto.randomUUID() });

Go​

tar -xzf zero-sdk-go.tar.gz -C internal/
import "yourcompany.com/app/internal/zero"

client, err := zero.New(zero.Config{
BaseURL: "https://api.zero.nnumbers.com.br",
Token: zero.StaticToken(os.Getenv("ZERO_TOKEN")),
})

Python​

The package is not on PyPI: pip install nnumbers-zero fails, because the name does not resolve. It is distributed as a file, through the site:

curl -fsSLO https://zero.nnumbers.com.br/downloads/nnumbers_zero-0.1.0-py3-none-any.whl
curl -fsSLO https://zero.nnumbers.com.br/downloads/SHA256SUMS
sha256sum -c SHA256SUMS --ignore-missing
pip install ./nnumbers_zero-0.1.0-py3-none-any.whl
  • Requires Python 3.10 or newer.
  • The only dependency is cryptography.
  • Commit the .whl to the application's repository: the platform does not inject the SDK into the build.
  • In this version, the SDK carries the runtime of the deployed application: who signed in (organization login) and QueryMesh. The API client comes in a later version.

See Python, in Who Signed In, in Your Code.

Java​

The SDK is distributed as a file, through the site; it is not in any Maven repository:

curl -fsSLO https://zero.nnumbers.com.br/downloads/zero-sdk-0.1.0.jar
mvn install:install-file -Dfile=zero-sdk-0.1.0.jar \
-DgroupId=br.com.nnumbers.zero -DartifactId=zero-sdk -Dversion=0.1.0 -Dpackaging=jar
  • Requires Java 17 or newer.
  • Has no runtime dependencies at all.
  • Commit the jar to the application's repository (for example, in libs/).
  • In this version, the SDK carries the runtime of the deployed application: identity and QueryMesh.

See Java, in Who Signed In, in Your Code.

What both guarantee​

What follows applies to the two API clients, TypeScript and Go.

  • Idempotency — every mutation accepts a key; repeating the call never creates two resources.
  • Typed errors — the platform's error catalog becomes a type, with the code and the suggested action.
  • Live following — an operation's stream arrives as an iterable (TypeScript) or a channel (Go), without you assembling SSE by hand.

Fields that may be null​

A field the API may return as null is typed as nullable: T | null in TypeScript, a pointer in Go. The compiler now requires you to handle the null — in Go, check for nil before dereferencing; in TypeScript, narrow the type before using the value.

Networking Between Projects​

Both SDKs have the operations of networking between projects: networks, the environment in the network, permissions, project exposure, internal name, and Gateway internal entries.

const network = await zero.createNetwork(organization, { name: 'payments' },
{ idempotencyKey: crypto.randomUUID() });
await zero.attachEnvironmentNetwork(environment, { network_id: network.id });
await zero.setServiceInternalName(service, { name: 'api' }); // api.zero.internal

Two lists mix shapes, and the kind field says which each item is: a network's permissions (service_grant or gateway_entry_grant) and who comes into a project (service_grant or private_route). In TypeScript, the union narrows by kind, with no cast:

for (const item of (await zero.listNetworkAccessGrants(network.id)).items) {
if (item.kind === 'service_grant') console.log(item.target_service_name, item.port);
else console.log(item.entry_address);
}

In Go, the items arrive as json.RawMessage, and zero.DecodificarPermissaoDaRede and zero.DecodificarChegadaAoProjeto split them by kind. A kind your SDK version does not know comes back with no shape and no error, with the JSON in Bruto — the listing does not break because of a new type.

The network of an environment outside any network comes back null: network is null in TypeScript and nil in Go.

Inside the Application: Who Signed In​

The TypeScript package also carries the runtime of the application deployed with Organization IAM: NNumbers.init() and nn.auth.user(req), in @nnumbers/zero/app, and the React components and hooks in @nnumbers/zero/react (<UserMenu>, <LoginButton>, <LogoutButton>, <Authenticated>, <Unauthenticated>, useUser(), useAuth(), useOrganization()). It checks the identity the platform hands over on every request and returns the person — or null. The same server runtime is in the Python and Java SDKs; the React components are TypeScript only. The Go SDK is the management API client, and in another language the runtime protocol applies. See Who Signed In, in Your Code. If the organization has QueryMesh configured and the application turns on the querymesh capability, nn.querymesh.query(req, sql) queries on behalf of who signed in — see Query the Organization's QueryMesh.

Changing the address​

setCanonicalDomain (TypeScript) and SetCanonicalDomain (Go) change the project's public address. Besides the new address, the response carries:

FieldWhat it is
operation_idThe deployment that puts the new address live — follow it to the end. Null when the project has never deployed: the previous address is released immediately and there is nothing to follow
previousThe previous address. May be null

While the deployment runs, the previous address appears among the project's domains with the state releasing: it answers until the deployment with the new address becomes ready, and is then released.