Database

Prisma

We highly recommend using the Prisma database ORM for its amazing TypeScript generator and extremely simple schema definition format.
You can read more about using Prisma in the documentation here.

Database Provider

Whichever ORM you decide to use, it can be injected with the DatabaseProvider located in your app/providers folder.
1
import { Provider, Symbols, cli } from "@masqueradejs/backstage"
2
import { PrismaClient } from "@prisma/client"
3
import { container } from "tsyringe"
4
5
import { Database } from "../contracts"
6
7
export class DatabaseProvider extends Provider {
8
/**
9
* Define a database driver to use in your application.
10
* Uses Prisma as default.
11
*/
12
public register(): void {
13
cli.debug(`Database Provider booting...`)
14
container.registerSingleton<Database>(Symbols.Database, PrismaClient)
15
}
16
}
17
Copied!
Copy link