@exlinelabs/exlinecore-adapter-node
v0.1.1
Published
Database adapter for the ExlineCore admin panel framework. Supports SQLite, PostgreSQL, and MySQL/MariaDB via Prisma.
Downloads
326
Readme
@exlinelabs/exlinecore-adapter-node
Database adapter for the ExlineCore admin panel framework. Supports SQLite, PostgreSQL, and MySQL/MariaDB via Prisma.
Installation
npm install @exlinelabs/exlinecore-adapter-node prisma @prisma/clientQuick setup
Run the init script to copy the Prisma schema, seed file, and .env template into your project:
npx exlinecore-node-initThis creates:
prisma/schema.prisma- the database schemaprisma/seed.ts- seeds an admin user.envand.env.example- environment variable templates
Edit .env to set your database and JWT secret, then push the schema:
npx prisma db push
npx prisma generateOptionally seed an admin user:
npx prisma db seedDefault credentials: [email protected] / admin1234
Supported databases
Set DATABASE_PROVIDER in your .env file to switch databases. No code changes required.
# SQLite (default, no server needed)
DATABASE_PROVIDER=sqlite
DATABASE_URL=file:./dev.db
# PostgreSQL
DATABASE_PROVIDER=postgresql
DATABASE_URL=postgresql://user:password@localhost:5432/myapp
# MySQL or MariaDB
DATABASE_PROVIDER=mysql
DATABASE_URL=mysql://user:password@localhost:3306/myappUsage
import { createExlineCore } from '@exlinelabs/exlinecore'
import {
createAuthAdapter,
createUsersAdapter,
createSchemaAdapter,
createDynamicCrudAdapter,
} from '@exlinelabs/exlinecore-adapter-node'
await app.register(createExlineCore({
adapters: {
auth: createAuthAdapter(),
users: createUsersAdapter(),
schema: createSchemaAdapter(),
crud: createDynamicCrudAdapter(),
},
prefix: '/api',
}))