Hacker News new | ask | show | jobs
Show HN: Metatype – an open-source HTTP/GraphQL query engine for APIs/data/WASM (github.com)
10 points by zifeo 1124 days ago
Hey everyone, we built Metatype [0] as a different way to build APIs and backends based on 3 parts:

1. a Python package to build virtual graphs connecting all components of your stack (think databases, third-parties, and existing systems)

2. an HTTP/GraphQL query engine built in Rust/Deno that authorizes and optimizes queries over the graphs

3. a CLI to provide a nice developer experience and fast feedback cycle

We developed this platform to tackle some of the challenges we often saw in tech teams we worked with:

- most developers (especially backend) still spend too much time on tasks with no real added value (crud, data validation, compliance, etc.)

- when growing a product, it is difficult keeping up with business needs and remaining agile/innovative with technology (especially when there is limited funding)

We believe it provides multiple advantages over more traditional approaches:

- it offers multiple runtimes [1] with pre-defined operations (e.g. Prisma) and can replace the needs for an ad-hoc backend

- when the project grows, you can easily introduce new APIs or break existing ones in smaller parts while keeping the same interface

- you can write complex business logic directly in Typescript, Python or WebAssembly and run them directly inside the query engine

- most of the frontend are today built on composable components, this brings a similar approach to backend development

- third-parties APIs can be easily integrated, providing you visibility and control over them

- it is interoperable with existing systems, and can be introduced step by step

- it can be easily self-hosted or customized according to your needs

The project is now in public beta, and is run in production by a few companies. We are looking to collect more feedback and early users to help us improve the platform.

For the tech curious reader, we also had to build a few new open source pieces to make this happen:

- a WASI runtime for Python [2] to run Python code inside WASM inside the engine

- a task runner [3] supporting live reload and managing dependencies as DAGs

- a way to inject secrets [4] from your preferred vaults into the engine

[0]: http://metatype.dev [1]: https://metatype.dev/docs/reference/runtimes [2]: https://github.com/metatypedev/python-wasi-reactor [3]: https://github.com/zifeo/whiz [4]: https://github.com/zifeo/lade

2 comments

> a WASI runtime for Python [2] to run Python code inside WASM inside the engine

This looks very interesting and relevant to our work. Can you please elaborate?

WMWare labs [1] managed to compile Python/Ruby/PHP into WASM distributions. This works if you want to run the language interpreter but is limited when you want your WASM runtime to run in parallel of your own program. This leads to the creation of the "reactor" concept by the community [2].

In the python WASI reactor, we load the libpython compiled for WASM and add a Rust reactor layer. Currently, it supports dynamic registration of Python lambdas and we are working on adding support for whole functions/packages.

[1] https://github.com/vmware-labs/webassembly-language-runtimes [2] https://github.com/bytecodealliance/wasmtime/blob/main/docs/...

The team will be watching and happy to answer any question :).