Skip to main content

What Are Apps?

Apps in EnSync represent your services or applications that publish and subscribe to events. Each app has unique credentials for authentication and encryption.

App Components

Every app consists of three key components:
ComponentTypePurpose
appIdPublic identifierIdentifies your app in the EnSync network
appKeySecret credentialAuthenticates your SDK client connections
appSecretPrivate keyDecrypts events sent to your app

Creating Apps

Apps are created in the EnSync Dashboard or programmatically via the API. When you create an app, you receive:
  • appKey (for authentication)
  • appId (public identifier)
  • appSecret (for decryption)
See Create Access Key in the API Reference for programmatic creation.

How Apps Work

Publishing Events

When you publish an event, you specify recipient appIds:
await client.publish(
  "order/created",
  ["partner-app-id-1", "partner-app-id-2"],
  { orderId: "123", amount: 99.99 }
);
EnSync encrypts the event for each recipient using their appId.

Subscribing to Events

Your app subscribes to events using its appKey:
const client = await EnSyncClient.create({
  appKey: "your-app-key",
  appSecret: "your-app-secret"
});

await client.subscribe("payment/*");
EnSync decrypts events using your appSecret.

App Permissions

Apps have two types of permissions:
  • send: Event paths this app can publish to
  • receive: Event paths this app can subscribe to
{
  "send": ["order/*", "inventory/*"],
  "receive": ["payment/*", "refund/*"]
}
Permissions are enforced by EnSync. Attempting to publish or subscribe to unauthorized event paths will fail.

Multiple Workers

You can run multiple workers (client instances) with the same appKey to scale horizontally. EnSync coordinates event delivery across workers automatically.
// Worker 1
const client1 = await EnSyncClient.create({ appKey, appSecret });

// Worker 2 (same appKey)
const client2 = await EnSyncClient.create({ appKey, appSecret });

// Both workers receive events in parallel