API Design considerations #71
Locked
jhbertra
started this conversation in
Architecture
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Recently, I've been doing a bit of reworking of the new Marlowe Run Server API, and thought it would be good to discuss some of the considerations here. Here are a few of the ideas I would like to propose we adopt. Most of them are focused on minimizing risk and friction due to changes:
/v1
afterapi/wallets
so that we can work with a versionedwallets
API. That way, when we create a breaking change to the API, which we undoubtedly will, we can simply create a newv2
version of the API without having to rework the existing one. Another benefit of this is that we can makePOST /wallets/centralized-testnet/restore
simply bePOST/wallets/v1
, because restoring from a mnemonic generated by the WBE is the only means of "posting" a wallet in v1 of the API,DTO
layer to the server. All the APIs should consume and produce trivially serializable types that are solely designed for the purpose of data transfer (Data Transfer Objects). This will make the API schemas cleaner, and will minimize the shared code between front end and back end. This will make dependency upgrades much simpler in the future, because there won't be the risk that changes in theplutus-apps
repo will cause our generated PureScript to break. This is also a lot more in alignment with the "share nothing" philosophy that is crucial to stability in a multi-repo scenario.Server
modules into two halves:Marlowe.Run.xxx
this module defines the core business logic of the application. The functions it exposes accept full domain types and return full domain types. They also operate without the assumption that they are in an HTTP server environment. This gives us the flexibility of plugging them into other runtime configurations, such as the Marlowe CLI.Marlowe.Run.xxx.Server
this module binds the functionality exposed byMarlowe.Run.xxx
to the API defined byMarlowe.Run.xxx.API
. Its jobs are to:Beta Was this translation helpful? Give feedback.
All reactions