npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lorm/schema

v0.1.14

Published

Database schema abstractions for lorm - mobile-first framework

Downloads

55

Readme

🗄️ @lorm/schema

Database schema abstractions and adapters for the Lorm framework — providing type-safe database schema definitions with multi-adapter support.

📦 Optimized Bundle: ~15KB with modular adapters (5KB each) 🚀 Production-Ready: Enterprise-grade build configuration with minification 🎯 Multi-Database: Support for PostgreSQL, MySQL, SQLite, and more


🚀 Features

  • Multi-Database Support: PostgreSQL, MySQL, SQLite adapters
  • Type-Safe Schemas: Full TypeScript support with Drizzle ORM
  • Modular Architecture: Import only the adapter you need
  • Zero Configuration: Works out of the box with sensible defaults
  • Drizzle Integration: Built on top of Drizzle ORM for maximum compatibility
  • Tree-Shakeable: Optimized for minimal bundle size

🛠️ Usage

PostgreSQL

import { pgTable, uuid, varchar, timestamp } from '@lorm/schema/pg';

export const users = pgTable('users', {
  id: uuid('id').defaultRandom().primaryKey(),
  name: varchar('name', { length: 255 }).notNull(),
  email: varchar('email', { length: 255 }).unique().notNull(),
  createdAt: timestamp('created_at').defaultNow()
});

MySQL

import { mysqlTable, int, varchar, timestamp } from '@lorm/schema/mysql';

export const users = mysqlTable('users', {
  id: int('id').primaryKey().autoincrement(),
  name: varchar('name', { length: 255 }).notNull(),
  email: varchar('email', { length: 255 }).unique().notNull(),
  createdAt: timestamp('created_at').defaultNow()
});

SQLite

import { sqliteTable, integer, text } from '@lorm/schema/sqlite';

export const users = sqliteTable('users', {
  id: integer('id').primaryKey({ autoIncrement: true }),
  name: text('name').notNull(),
  email: text('email').unique().notNull(),
  createdAt: integer('created_at', { mode: 'timestamp' }).defaultNow()
});

📦 Available Exports

Main Package (@lorm/schema)

Re-exports PostgreSQL core by default:

import { pgTable, uuid, varchar } from '@lorm/schema';

Database-Specific Adapters

PostgreSQL (@lorm/schema/pg)

  • All drizzle-orm/pg-core exports
  • sql function from drizzle-orm

MySQL (@lorm/schema/mysql)

  • All drizzle-orm/mysql-core exports
  • sql function from drizzle-orm

SQLite (@lorm/schema/sqlite)

  • All drizzle-orm/sqlite-core exports
  • sql function from drizzle-orm

📦 Bundle Optimization

  • Modular Design: ~15KB base + ~5KB per adapter
  • Tree-Shaking: Import only the adapter you need
  • Minification: Production-ready compressed output
  • Code Splitting: Separate bundles for each database adapter
  • External Dependencies: Drizzle ORM externalized for optimal bundling

Bundle Sizes

| Export | ESM | CJS | Types | Notes | |--------|-----|-----|-------|-------| | Main | ~15KB | ~15KB | ~2KB | PostgreSQL by default | | PostgreSQL | ~5KB | ~5KB | ~1KB | Adapter-specific | | MySQL | ~5KB | ~5KB | ~1KB | Adapter-specific | | SQLite | ~5KB | ~5KB | ~1KB | Adapter-specific |


🔧 Database Support

Built on Drizzle ORM with support for:

  • PostgreSQL (Neon, Supabase, AWS RDS, etc.)
  • MySQL (PlanetScale, AWS RDS, etc.)
  • SQLite (Local development, Turso, etc.)
  • Custom adapters via Drizzle ORM ecosystem

🧩 Framework Integration

Designed specifically for:

  • Lorm Framework - Seamless integration with @lorm/core
  • React Native applications
  • Expo projects
  • Mobile-first development

💡 Best Practices

Import Optimization

// ✅ Good: Import specific adapter
import { pgTable, uuid } from '@lorm/schema/pg';

// ❌ Avoid: Importing unused adapters
import { pgTable } from '@lorm/schema';
import { mysqlTable } from '@lorm/schema/mysql'; // Unnecessary if using PostgreSQL

Schema Organization

// schema.js
import { pgTable, uuid, varchar } from '@lorm/schema/pg';

export const users = pgTable('users', {
  id: uuid('id').defaultRandom().primaryKey(),
  name: varchar('name', { length: 255 })
});

export const posts = pgTable('posts', {
  id: uuid('id').defaultRandom().primaryKey(),
  title: varchar('title', { length: 255 }),
  authorId: uuid('author_id').references(() => users.id)
});

export const schema = { users, posts };

📚 Related Packages

  • @lorm/core - Core framework functionality
  • @lorm/cli - Command-line interface for schema management
  • @lorm/client - Auto-typed HTTP client for mobile apps
  • @lorm/lib - Shared utilities and enterprise features

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

Apache License - see LICENSE for details.