Platformatic v0.5.0 - GraphQL subscriptions & microservice tool!

Platformatic v0.5.0 - GraphQL subscriptions & microservice tool!

Platformatic v0.5.0 has been tagged and released on npm. It includes new features and a lot of bug fixes!

Thanks to all of you that welcomed Platformatic into the Open Source community with all your contributions. This release would not be possible without your help.

You can find the complete list to all pull requests included at: github.com/platformatic/platformatic/releas..

Notable Changes Video

Added GraphQL Subscriptions to Platformatic DB!

GraphQL Subscriptions are hard to implement and scale. Mercurius offers excellent support for them, however, we had to fix a couple of bugs to implement this feature (#895 and #896) to be able to have complete support for GraphiQL and authorization. Enjoy a simple demo:

As part of my Ph.D. in the Internet of Things, I worked a lot in implementing publish/subscribe systems at scale and MQEmitter was born. In Platformatic DB we also support mqemitter-redis for cross-process communication.

As in all Platformatic's modules, the support for subscriptions is easily layered so that you can customize them as you please. Publishing events when saving or deleting entities is done by @platformatic/sql-events, while @platformatic/sql-graphql leverage that module to create a GraphQL adapter.

Platformatic Service - new command with Video!

platformatic service start is a new command to start a Fastify plugin with all the Platformatic developer experience but without all the automated data mapping of Platformatic DB. It's the barebone Platformatic experience.

See a video of platformatic service start in action:

You can start your platformatic service start journey with the following config file:

server:
  hostname: "127.0.0.1"
  port: 3000

plugin:
  path: "./plugin.mjs"

and plugin.mjs file:

export default async function (app) {
  app.get('/', () => 'hello world!')
}

Note that hot reloading, automatic typescript compilation, automatic traffic shedding, and metrics are included.

Support authorization via JWT and Webhook at the same time in Platformatic DB - Video

This feature was live-coded by me on my weekly twitch stream!

You can watch how this was developed on the video below:

React Admin adapter for Platformatic DB!

The community is working hard to create an amazing Dashboard for Platformatic DB. Thanks to Giacomo Cerquone, we have released @platformatic/db-ra-data-rest to support React Admin frontends.

Docs and integration in the dashboard will follow soon. Would you like to contribute?

A special mention goes to Riccardo Fiorenza that is working hard to integrate React Admin as part of our dashboard: github.com/platformatic/platformatic/pull/255.

Fly.io deployment guide

At Platformatic, we are huge fans of fly.io and we love deploying things there. We have created a fantastic guide to deploy Platformatic DB to Fly.io: oss.platformatic.dev/docs/guides/deployment...

Transaction support in sql-mapper

Lastly, we have added support for transactions to @platformatic/sql-mapper, enabling you to do multiple database calls in isolation. Check it out:

const { connect } = require('@platformatic/sql-mapper')
const logger = pino(pretty())
async function main() {
  const pgConnectionString = 'postgres://postgres:postgres@127.0.0.1/postgres'
  const { db, entities} = await connect({
    connectionString: pgConnectionString,
    log: logger,
  })
  const result = await db.tx(async tx => {
    // these two operations will be executed in the same transaction
   const authorResult = await entities.author.save({
      fields: ['id', 'name'],
      input: { name: 'test'},
      tx
    })
    const res = await entities.page.save({
      fields: ['title', 'authorId'],
      input: { title: 'page title', authorId: authorResult.id },
      tx
    })
    return res
  })
}

Acknowledgements

Contributors to this release were: Abdullah Osama, Alex Ruheni, Dmitry Zakharov, Eckhardt (Kaizen) Dreyer, Giacomo Cerquone, Giacomo Lombardi, Ismajl Ramadani, Ivan Tymoshenko, Jacopo Riciputi, Leonardo Rossi, Manny, Matija Gašpar, Matteo Collina, Mikhail Cheremuhin-Rerberg, Mohamed Sohail, MzUgM, Riccardo Fiorenza, Salvatore Delpiano, Saptarshi Sarkar, Simon Plenderleith, Yagiz Nizipli, Zlatin Stanimirov, bacebu4, Marco Piraccini.

Thank you!