8 releases

0.0.12 Aug 17, 2021
0.0.11 Aug 16, 2021

#6 in #service-mesh

21 downloads per month

MIT license

63KB
1.5K SLoC

Asbru - A Data-oriented Service Mesh



/!\ WIP: Asbru won't be usable until version 0.1.0 /!
/!\ The target is to have a MVP right now, so the code might be ugly sometimes, it's on purpose to create a prototype first. /!\

Asbru is an async_graphql Data-oriented Service Mesh generator: it'll generate an async_graphql project from a schema with resolvers, dataloaders, data-transformation. It'll create a Data-oriented service mesh from your schema so you'll just have to describe your microservices with your described schema to have a Data-Oriented Service Mesh like Airbnb's.

Asbru will be able to send metrics to apollo studio, use dataloaders patterns, store cache data into an external datastorage, be served serverless and even more.

Asbru is an opensource project based on Viaduct, an Airbnb's project presented here.

Tested at Rust version: rustc 1.53.0 (53cb7b09b 2021-06-17)

Rendered GraphQL

The rendered code is split accros three folders following an architecture inspired by the Domain Driven Design with 3 layers:

| main.rs
| schema.rs
| application/
|   entity/entity.rs
|   entity/query.rs
|   entity/mutation.rs
| domain/
|   entity/entity.rs
| infrastructure/
|   http.rs
|   db.rs
|   ...

infrastructure will contains every code and definitions structuring the whole application, each files should describe a high-level API which abstract the implementation, in practise, it might be coupled with the implementation. For instance, instead of using directly reqwest to do http call, we create a higher level API, which describe how to do a HTTP call, and we provide an implementation for it with reqwest.

domain will describe our domains data, which called are made to call an entity, the associated dataloaders.

application will describe entity with a GraphQL implementation to describe query, mutations, subscriptions.

Example

An interactive example is available with this configuration.

Available schema here:

Roadmap v0.1.0

  • ✅ Manage a configuration files.
  • ✅ Docker build
  • ❌ Codegen a async_graphql layout
    • ✅ Object generation layout
    • ✅ Modfiles
    • ✅ Cargo
    • ✅ Rust types on GraphQL scalars
    • ✅ Enum
    • ✅ Simple Query
    • ❌ Interfaces
    • ❌ Union
    • ❌ Mutations
    • ❌ Connections
  • ❌ Architecture & Connect to services with a directive (at Airbnb it's something like @serviceBackedNode).
    • ✅ serviceBackedQuery
    • ❌ serviceBackedNode
    • ❌ serviceBackedConnection

Roadmap v1.0.0

  • Infrastructure
    • ❌ Dataloaders
    • ❌ Intra-request cache
    • ❌ Tracing
    • ❌ Extensions (Apollo Studio)
  • GraphQL
    • ❌ Subscriptions
  • Directives
    • ❌ derivedField
  • Transport
    • ❌ GRPC

Crate features

No features right now, but soon.

References

Dependencies

~11MB
~228K SLoC