Skip to main content
IndexedDB provides a powerful NoSQL database API built into every modern browser. BlazorEssentials.IndexedDb makes it easy to use from your Blazor WebAssembly applications with a strongly-typed C# API.

No Setup Required

Uses the browser’s built-in IndexedDB - no server or external dependencies.

Offline Ready

Data persists locally, enabling full offline functionality.

Type-Safe

Object stores are strongly typed with compile-time safety.

Indexed Queries

Create indexes for fast lookups on any property.

Installation

Quick Start

Define Your Entities

Use attributes to configure how entities are stored:
Models/TodoItem.cs

Create Your Database

Inherit from IndexedDbDatabase and add IndexedDbObjectStore<T> properties:
Data/AppDatabase.cs

Register and Use

CRUD Operations

Create

Read

Update

Delete

Indexes

Create indexes for fast lookups on frequently queried properties:
Query using indexes:

Key Ranges

Use KeyRange for range queries on indexed properties:

Best Practices

Choose key paths that uniquely identify your entities. Auto-incrementing integers or GUIDs work well for most cases.
Only create indexes on properties you’ll query frequently. Each index adds storage overhead and slows down writes.
When changing your schema, increment the Version property. IndexedDB will trigger an upgrade event to migrate existing data.

API Reference

IndexedDbDatabase

Base class for IndexedDB databases

IndexedDbObjectStore

Typed object store for CRUD operations

KeyRange

Range queries for indexed lookups

IndexAttribute

Define indexes on properties