@samesake/postgres
@samesake/postgres is one backend package. It owns PostgreSQL-specific SQL and
implements the store, retrieval, candidate, vocabulary, and exact facet ports for
applications that choose this backend.
Public surface
Section titled “Public surface”createPostgresAdapterandPostgresAdapterown the connection and migrations.createPostgresBackendreturns the backend ports:retriever,enrichStore,candidates,vocab,facets,migrate, andclose.PostgresEnrichStore,PostgresRetriever,pgCandidates,pgVocab,createFacets, andbuildFilterSqlexpose the backend pieces for custom wiring.samesake(config)returns aSamesakeBundlewithenrich,resolve,search,facets,migrate, andclose.
import { samesake } from '@samesake/postgres';
const app = samesake({ url: process.env.DATABASE_URL!, collection, models: { embed, generate }, migrate: 'manual',});
await app.migrate();const result = await app.search('blue jacket', { limit: 20 });await app.close();The bundle is convenient when one backend should own all three capabilities. A
consumer that already has a retrieval or durability system can use @samesake/enrich
and @samesake/query directly with its own ports instead.