@open-commune/core
v0.2.1
Published
Business domains, database schema and tRPC router. Holds the logic; knows nothing of transport.
Downloads
504
Readme
@open-commune/core
Business domains, database schema and tRPC router for Open Commune — the content platform for local government.
This package holds the logic and knows nothing of transport: no HTTP server, no framework. It is consumed by the Nuxt layer @open-commune/web, and can be embedded in any runtime that speaks tRPC.
Install
npm install @open-commune/coreRequires Bun — the database layer uses bun:sqlite.
Use
import { createCore, connectDb } from '@open-commune/core';
const db = connectDb({ url: './data/commun.db' });
const core = createCore({ db /* , storage, mailer */ });createCore returns the services and the tRPC appRouter; mount that router behind the HTTP adapter of your choice.
Entry points
| Import | Contents |
| --- | --- |
| @open-commune/core | services, repositories, DTOs, typed errors, the tRPC appRouter |
| @open-commune/core/collections/constants | field types, publication statuses, allowed MIME types |
| @open-commune/core/collections/utils | helpers over collection definitions and entries |
| @open-commune/core/drizzle | the migrations folder, applied at startup |
Migrations run automatically when the database is opened; the folder ships with the package.
Licence
AGPL-3.0-or-later.
