Skip to content

A simulation platform for use during testing, during development and for high-fidelity application previews

Notifications You must be signed in to change notification settings

thefrontside/simulacrum

Repository files navigation

CircleCI License: MIT Created by Frontside Chat on Discord

Simulacrum

A simulation platform to supercharge acceptance testing, enable high-fidelity application previews, and free up development teams to make progress independently.

Modern applications have modern dependencies. Whether they run on the server or in the browser, they rely on external services to get their jobs done. But along with the power to focus our business logic and distribute it across so many different points comes a fundamental weakness: The entire experience, from development, to testing, to continuous integration is coupled to the very in-the-moment states of actual deployments. This becomes problematic when those deployments are down, rate limited, under active development, or not functioning as expected in any way.

Simulacrum removes these constraints from your process by allowing you to simulate external dependencies with a very high degree of reality.

Existing Simulators

Usage

Simulacrum is based on a client server architecture. The server can hold any number of simulations which you can create and control via the client. The following examples use JavaScript, but under the hood it is just connects over HTTP and so can be used from any language.

To create a simulation in a simulacrum server with one of its available simulators. In this case, we'll assume that there is an auth0 simulator on the server that we can use to create a simulation.

import { Client, createClient } from '@simulacrum/client';

let client = createClient('http://localhost:4000');
let simulation = await client.createSimulation("auth0");
// =>
// services:{
//   auth0:{
//     port: 4400 
//   }
// }
//

The resulting simulation has a list of service endpoints that you can use to configure whatever things needed for auth0.

To create a user that you can log in as, you would run the person scenario. This will create a person with realistic data.

let person = await client.given(simulation, "person");
person.name // => Paul Waters
person.email // => [email protected]

If you have an application that uses auth0, check out @simulacrum/auth0-simulator on how you can get started.

We also have complete examples for nextjs with auth0 react and nextjs with nextjs auth0.

Development

$ npm install
$ npm run build
$ npm test

About

A simulation platform for use during testing, during development and for high-fidelity application previews

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Languages