Differential is an open-source application code aware service mesh (control-plane) and a set of adapters (client libraries) which connects your services together with first-class support for Typescript.
- Differential builds on the concepts developers are already familiar with, and doesn't require you to learn a new programming model.
- Services are collections of plain old javascript functions which can be deployed in almost any compute. Services ship their own type-safe Typescript clients.
- The control plane takes care of routing data between the functions, and recovering from transient failures, transparently.
- Create services out of plain old Typescript functions, and get type-safe clients for free.
- Adopt a service-oriented architecture without changing your codebase / programming model.
- Recover your workloads from crashes and network failures without custom code.
import { Differential } from "@differentialhq/core";
// You can get a token from console.differential.dev
const d = new Differential("MY_API_SECRET");
// Write your business logic as if it were local
function sum(a: number, b: number) {
return a + b;
}
function get(url: string) {
// ...even functions with side effects
return fetch(url).then((res) => res.json());
}
// Register your functions with the control-plane
const myService = d.service("my-service", {
functions: {
sum,
get,
},
});
// Start the service, and it will connect to the
// control-plane and listen for function calls from other places
myService.start();
import { Differential } from "@differentialhq/core";
// Import the types of the Differential service
import type { myService } from "./my-service";
// Initialize the Differential SDK with the same API secret
const d = new Differential("MY_API_SECRET");
// Create a client for the service.
// (Notice that you don't have to provide an endpoint. Clients talk to the control-plane)
const client = d.service<typeof myService>("my-service");
// call the remote functions as if they were local, with full type safety
client.sum(1, 2).then(console.log); // 3
client.get("https://api.differential.dev/live").then(console.log); // { status: "ok" }
- Build your first end-to-end Differential service in 2 minutes
- Sign up for Differential Cloud (managed version of Differential)
All documentation is hosted at docs.differential.dev. Here are some quick links to get you started:
This is a mono-repo for almost all of the Differential codebase. It contains the following repositories:
- Control Plane The control plane is the central command & control for a differential cluster. This is fully open source and can be run on your own infrastructure. We also offer a hosted version of the control plane at www.differential.dev.
- Typescript SDK The Typescript SDK is the main way to interact with Differential. It is used to define, run and call services.
- Admin Console The admin console is a web-based UI for Differential. It is used to visualize the service registry, view logs, and more.
- CLI The CLI is a command-line interface for Differential. It is used to interact with the control plane, deploy services, and more.
- Docs The docs are the main source of information for Differential. They are hosted at /docs.
We welcome contributions to Differential! Please see our contributing guide for more information.