Remote / foldkit-remote-drizzle
Put the Source behind RemoteServer
ts
import { Remote } from 'foldkit-remote'
import { RemoteServer } from 'foldkit-remote-server'
const Data = Remote.define({
entities: [Project],
})
const Server = RemoteServer.make({
entities: [ProjectSource],
})
RemoteServer.validate(Data, Server)
const handlers = RemoteServer.handlers(Server, principal)handlers now requires the DrizzleDatabase service because the Source does.
Provide your application's database once:
ts
import { Layer } from 'effect'
import { databaseLayer } from 'foldkit-remote-drizzle'
const DatabaseLive = databaseLayer(db)
// Useful in one process: tests, SSR, a worker, or a single service.
const RemoteClientLive = Remote.clientLayer(handlers).pipe(
Layer.provide(DatabaseLive),
)The adapter captures no connection. That keeps database ownership at the application boundary and makes the Effect requirement visible in the server composition.