News for hackers. Stuff that matters.

Show HN: Worldfixture – An OSS fake company your software can interact with

https://worldfixture.com/

If you're building something that uses Slack, GitHub, email, Stripe, S3 or similar services, developing it locally usually means connecting test accounts, manually filling those accounts with data, or mocking each service separately. WorldFixture gives the software a fake company to work against instead.

For example, imagine you're building a tool that tries to identify customers at risk of churning. You run "npx worldfixture up" and point your application at the local services.

It now sees Northstar Relay, a fake 99-person SaaS company with history. One customer might have an export problem being discussed by employees in Slack, a related fix being worked on in GitHub, an upcoming renewal mentioned in email, and an account and invoice in Stripe.

You can stream events to make it feel "Alive", you can advance the clock etc.. Another email might arrive, somebody might comment on the PR, a Slack conversation can continue, or a payment can go through. Your application sees those changes through the same APIs it was already using. You can reset the whole company and run the same scenario again.

There is no WorldFixture SDK that your application has to know about. Mail uses SMTP/IMAP, S3 is S3-compatible, and services such as Slack, GitHub and Stripe expose local APIs shaped like the real providers. WorldFixture gives you the URLs and credentials and you point your application at them.

I don't see this replacing normal unit tests or simple mocks. If you're testing a function that makes one API call, a mock is much easier. I built this for the point where what you're testing depends on state spread across several systems, or where you want to run an integration test, E2E test or demo against something that resembles an actual company.

Internally it is fairly simple. A world is essentially a large JSON artifact describing the company, its people, accounts, history and scheduled events. That state is loaded into the local services, and an event stream delivers things that happen as the clock moves.

I'm using existing open-source projects where possible rather than implementing every service myself. emulate.dev provides several of the provider APIs, SeaweedFS provides S3 and Cyrus provides mail. WorldFixture is the layer that gives them the same world, identities, history and clock.

This came out of another project of mine called DropLive. DropLive.io runs disposable demos of open-source projects. Once I had the software running reliably, I found that many of the demos still weren't very useful because all the software was empty. A CRM with no customers or an email client with no email technically works, but it doesn't really show you what the product does.

I started adding data, then needed the data to agree between services, then needed things to happen during the demo, and eventually realised that part should be its own project.

It's Apache 2.0 and runs locally. It's also very early. Provider support is incomplete, but I hope to add a lot more over the next few weeks.

I started with a SaaS company, but nothing stops you from adding other worlds and providers.

Looking forward to feedback.

( no comments | on HN )

There are no comments yet.