@appweaver/data
v2.4.1
Published
Appweaver - the backend framework for AI-first development (@data)
Readme
Description
@appweaver/data is the database module of Appweaver, built on
Prisma:
- Resources –
createModel,createServiceandcreatePolicy, the resource services with filtering, sorting, cursor pagination, aggregation and CSV export, and the transactions. - Auth data model –
createAuthModel,createAuthService, roles, permissions, API keys, one-time tokens, connected accounts and password hashing. - Files –
FileServicewith the File model, storing the files in anyStorageprovider. - Seeders –
createSeederand the database security store.
The framework models reach only the applications using them: the auth tables with an auth model, File with a model
declaring files, Seeder with a seeders directory.
Installation
npm install @appweaver/data @prisma/client prisma @prisma/adapter-pg # the driver adapter of your databaseThe client connects through the Prisma driver adapter of the database: @prisma/adapter-pg (PostgreSQL),
@prisma/adapter-mariadb (MySQL / MariaDB), @prisma/adapter-better-sqlite3 (SQLite, @prisma/adapter-libsql on Bun)
or @prisma/adapter-mssql (SQL Server). prisma is a dependency, since weaver migrate runs it in production.
// src/resources/post/model.ts
import { createModel } from '@appweaver/data';
export default createModel({
name: 'Post',
scalars: {
title: { type: 'string', minLength: 1, maxLength: 200 },
body: { type: 'string' }
}
});Run weaver generate after changing a model to refresh the generated types and the Prisma schema.
Documentation
- Appweaver README – getting started, configuration, and the overview of every package
- Agent skill – the complete framework reference shipped to every scaffolded project
License
Appweaver is MIT licensed.
