stacks-database

Configure database drivers, migrations, and seeding in Stacks apps.

622|17|Updated Apr 26, 2022
One-click install
npx skills add https://github.com/stacksjs/stacks --skill stacks-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stacks-database
Source: https://github.com/stacksjs/stacks/tree/main/.claude/skills/stacks-database
Command: npx skills add https://github.com/stacksjs/stacks --skill stacks-database

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Managing database connections, migrations, seeding, and query building across Stacks apps can be noisy and error-prone. This Skill provides a unified pattern to configure drivers (SQLite/MySQL/PostgreSQL/DynamoDB), run migrations, seed data, and leverage the bun-query-builder for deterministic queries.

Core Features & Use Cases

  • Unified database configuration and driver management across environments.
  • Migrations, seeding, and SQL helpers that work with SQLite, MySQL, PostgreSQL, and DynamoDB.
  • Supports in-project config files (config/database.ts) and QB integration for reliable data access in production apps.

Quick Start

Configure your Stacks project to use the database package, then run migrations and seed data to verify a working setup.

Frequently Asked Questions about stacks-database

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

FAQPage Schema
How do I configure database connections for SQLite, MySQL, PostgreSQL, and DynamoDB in Stacks apps?

Database configuration in Stacks apps is managed through the config/database.ts file, which uses environment-based settings and driver detection to unify connections across SQLite, MySQL, PostgreSQL, and DynamoDB. It enables lazy initialization for reliable data access.

How do I run migrations and seed data in a Stacks project?

To run migrations and seed data in a Stacks project, configure your project to use the database package, then execute the migration and seeding workflows. This verifies a working setup and populates your database with deterministic initial records.

Does the Stacks database package work with a query builder for production data access?

Yes, the Stacks database package integrates with the bun-query-builder to enable deterministic queries. This integration provides reliable data access and unified query building for production Stacks applications.

What is the best way to manage database drivers across different environments in Stacks?

The best way to manage database drivers across environments in Stacks is by using the unified database configuration pattern. It handles driver detection and environment-based configuration automatically to simplify switching between SQLite, MySQL, PostgreSQL, and DynamoDB.

Do I need a YAML frontmatter in SKILL.md to use the Stacks database utilities?

Yes, the Stacks database Skill requires a YAML frontmatter containing a name and description in the SKILL.md file. This frontmatter is necessary to expose the utilities for driver detection and lazy initialization of the database.

Why does database seeding fail when switching drivers in my Stacks application?

Database seeding and migrations in Stacks require proper environment-based configuration in config/database.ts. If driver detection fails or the configuration is missing, the lazy initialization process cannot connect, causing seeding to fail.