@copypatch/server
v1.0.1
Published
Embedded and standalone backend server & CLI for CopyPatch
Maintainers
Readme
@copypatch/server
Node.js server and CLI for CopyPatch. Use it as the runtime that serves snapshots, handles editor authentication, and persists published or draft content in SQLite.
Install
pnpm add @copypatch/serverMinimal usage
import { createCopyPatchServer, initDatabase } from '@copypatch/server';
const config = {
dbPath: './copypatch.sqlite',
publicOrigin: 'http://localhost:5173',
};
const dbConnection = initDatabase(config.dbPath);
const server = createCopyPatchServer(config, dbConnection);
export default server.app;npx copypatch init --db ./copypatch.sqlite
npx copypatch serve --db ./copypatch.sqlite --origin http://localhost:5173Exports
@copypatch/server: server config, server factory, database helpers, auth helpers, content services, cache utilities, and middleware exports@copypatch/server/cli: CLI runners such asrunInit,runServe,runPassword, andrunMigratecopypatch: CLI binary
Requirements
- ESM-only package
- Node.js
>=20 - Runtime dependencies include SQLite (
better-sqlite3) and Hono
Links
- Docs: copypatch.vercel.app
- Source: github.com/Woffluon/CopyPatch
- Issues: github.com/Woffluon/CopyPatch/issues
License
MIT
