Docs / getting started

Introduction to DexBee

DexBee is a powerful TypeScript IndexedDB ORM (Object-Relational Mapping) library that brings SQL-like query builder syntax to IndexedDB in the browser. It provides a modern, type-safe way to work with client-side databases in web applications.

Key Features

🛠️ Type-Safe ORM

  • Full TypeScript support with strict type checking
  • Auto-completion and IntelliSense support
  • Compile-time error detection

🔍 SQL-Like Query Builder

  • Familiar SQL syntax for IndexedDB operations
  • Chainable query methods for complex queries
  • Support for aggregations and advanced filtering

🚀 Modern Architecture

  • Built with modern JavaScript features
  • Tree-shakeable for optimal bundle size (~14KB gzipped)
  • Promise-based async/await API
  • Browser-focused with ESM support

📊 Advanced Features

  • Optional schema migrations with dry-run validation
  • Transaction management with ACID compliance
  • Blob storage for Files, Images, and binary data
  • Data validation and default values
  • Index optimization

🎯 Developer Experience

  • Intuitive API design
  • Comprehensive error handling
  • Extensive documentation and examples

When to Use DexBee

DexBee is perfect for applications that need:

  • Offline-first functionality - Store and query data locally
  • Complex data relationships - Handle related data with ease
  • Type safety - Catch errors at compile time
  • Performance - Optimized queries and indexes
  • Scalability - Handle large datasets efficiently

Quick Example

import { DexBee, eq, Table } from 'dexbee-js'

// Define your schema
const schema = {
  version: 1,
  tables: {
    users: {
      schema: {
        id: { type: 'number', required: true },
        name: { type: 'string', required: true },
        email: { type: 'string', unique: true },
        createdAt: { type: 'date', default: () => new Date() }
      },
      primaryKey: 'id',
      autoIncrement: true
    }
  }
}

// Connect to database
const db = await DexBee.connect('myapp', schema)

// Query data with SQL-like syntax
const users = await db.table('users')
  .where(eq('name', 'John'))
  .orderBy('createdAt', 'desc')
  .limit(10)
  .all()

Architecture Overview

DexBee is built with a modular architecture that separates concerns:

  • Database Layer - Connection management and schema validation
  • Query Layer - SQL-like query building and execution
  • Transaction Layer - Safe transaction handling
  • Migration Layer - Dry-run validation and schema evolution
  • Type Layer - TypeScript definitions and validation

Next Steps

Ready to get started? Check out our Installation Guide to begin using DexBee in your project, or explore the API Reference for detailed documentation.