# Platformatic v0.14.0 - buildServer API, fastify-user, and more


Hi Folks, Happy new year! Platformatic v0.14.0 is out with many bug fixes and improvements. Thanks to all of you that checked us out, testing [`Platformatic Cloud`](https://platformatic.cloud/) and are reporting bugs! Hopefully, we fixed some of them in this release!

You can find the full changelog at: https://github.com/platformatic/platformatic/releases/tag/v0.14.0

Thanks to everybody that contributed!

##  Start  Platformatic Service & DB programmatically 

In many cases, it's helpful to start Platformatic DB using an API instead of
command line, e.g. in tests, we want to start and stop our server.

The `buildServer` function allows that:

```js
import { buildServer } from '@platformatic/db'
const db = await buildServer('path/to/platformatic.db.json')

// // Or use a custom configuration
//
// const db = await buildServer({
//   server: {
//     hostname: '127.0.0.1',
//     port: 0
//   },
//   core: {
//     // Use an in-memory database for testing purposes
//     connectionString: 'sqlite://./db.sqlite'
//   },
//   dashboard: true,
//   authorization: {
//     adminSecret: 'secret'
//   }
// })

await db.listen()
const res = await fetch(server.url)
console.log(await res.json())
// do something
await db.stop()
```

This was implemented in https://github.com/platformatic/platformatic/pull/630

##  Allow custom schema to be configured

It's now possible to add a custom GraphQL schema during the startup:

```json
  {
    "core": {
      ...
      "graphql": {
        "schemaPath": "path/to/schema.graphql"
        }
      }
    }
  }
```

This was implemented in https://github.com/platformatic/platformatic/pull/632.

## fastify-user module

In this release, we extracted the `fastify-user` module from `@platformatic/db-authorization`. `fastify-user` provides a Fastify plugin to populate the `request.user` property from a JWT token (custom claims) or a webhook (response body).

To use it, invoke the extractUser method on the request object, or add this hook:

```js
const app = fastify()
app.register(fastifyUser, {
  jwt: {
    secret: <my-shared-secret>
  }
  // // or
  //   webhook: {
  //     url: `http://my-webhook-url/authorize`
  //  }
})

app.addHook('preHandler', async (request, reply) => {
  await request.extractUser()
})
```

This module was developed by [@marcopiraccini](https://github.com/marcopiraccini) and extracted in https://github.com/platformatic/platformatic/pull/612.

## Command Line Interface

We did plenty of improvements to our command line interface, check them out:

* create-platformatic: add ctags and clinic to gitignore by [@RafaelGSS](https://github.com/RafaelGSS) in https://github.com/platformatic/platformatic/pull/611
* fix(db): `db seed` should try all known config file names by default by [@btisdall](https://github.com/btisdall) in https://github.com/platformatic/platformatic/pull/603
* fix version check on create platformatic by [@malforsaja](https://github.commalforsaja) in https://github.com/platformatic/platformatic/pull/624
* feat: throw an error on seed command if there are migrations to apply by [@ivan-tymoshenko](https://github.com/ivan-tymoshenko) in https://github.com/platformatic/platformatic/pull/626
* fix: hide call stack on migration errors by [@ivan-tymoshenko](https://github.com/ivan-tymoshenko) in https://github.com/platformatic/platformatic/pull/625



