FaunaDB is a geo-replicated database in the style of Spanner and Calvin. It includes a GraphQL integration natively, is multi-tenant by default (using nested databases), and has a powerful query language based in lambda calculus called FQL.
Most interestingly is that it's bonkers easy to set up a new database for a project (ymmv, statment is subject to chance and experience, void where prohibited).
My use case for fauna is a Golang lambda function that I deploy on Netlify that runs once a day at 11am. I would like to store the Dev Tip that gets tweeted out somewhere so that I can prevent it from being tweeted again within a week or two of the last time it was tweeted out.
First, I created a
FaunaTweetResult type complete with
Then I instantiated a fake tweet that matches the output of the function I'm using to send the tweet in anaconda
Next comes the token fetch from the environment and client instantiation for fauna. You can create sub-clients using alternate secrets which is interesting but I didn't have a use case for it yet.
Finally we write some FQL looking code and pass in our faked tweet to insert a new document into our fauna database.
and that's it. We were successfully inserting docs into the database in about an hours worth of work, having never worked with the platform before.
It was pretty fun to throw my proverbial hat in the faunadb ring and I'll be working with it more in the future. My next task is to tackle querying so that I can develop a better mental model for how to architect data for this system.