stacks-orm

Define database models and execute queries with Stacks ORM.

2|Updated Jul 8, 2026
One-click install
npx skills add https://github.com/bughq/bughq --skill stacks-orm-bughq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stacks-orm
Source: https://github.com/bughq/bughq/tree/main/.claude/skills/stacks-orm
Command: npx skills add https://github.com/bughq/bughq --skill stacks-orm-bughq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @stacksjs/orm, @stacksjs/events, @stacksjs/payments, bun-query-builder.

What problem does it solve?

This Skill simplifies complex database interactions by providing a unified, type-safe interface for defining models, managing relationships, and executing queries within the Stacks framework.

Core Features & Use Cases

  • Model Definition: Easily define models with built-in support for traits like billable, taggable, and two-factor authentication.
  • Relationship Management: Automatically handle complex database relationships including hasMany, belongsToMany, and polymorphic associations.
  • Use Case: When building a new feature, use this Skill to define a Product model with Stripe integration and search indexing, allowing you to focus on business logic rather than boilerplate database code.

Quick Start

Use the stacks-orm skill to define a new model named Order with belongsTo relationships to User and Product.

Frequently Asked Questions about stacks-orm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I define database models with type safety in TypeScript?

Type-safe database models are defined by declaring schema structures and applying automated traits like billable or taggable, ensuring data consistency through lifecycle hooks without manual boilerplate.

Does Stacks ORM support both SQLite and PostgreSQL databases?

Yes, Stacks ORM supports both SQLite and PostgreSQL databases, allowing you to execute transactional queries and manage schemas across either database system using a unified interface.

How do I manage complex database relationships like polymorphic associations?

Complex database relationships including hasMany, belongsToMany, and polymorphic associations are automatically handled by the ORM framework, reducing manual query builder configuration for relational mapping.

Can I integrate Stripe billing directly into my TypeScript ORM models?

Yes, Stripe billing can be integrated directly into TypeScript ORM models by applying the built-in billable trait, automating payment integration alongside standard schema management.

What's the best way to execute transactional queries across relational models?

Executing transactional queries across relational models is best handled through a unified ORM interface that ensures type safety and consistency during schema management and complex data interactions.

Do I need a separate query builder for complex queries in Stacks ORM?

No, a separate query builder is not needed because the ORM includes bun-query-builder for transactional execution, allowing you to focus on business logic rather than boilerplate database code.