Creating a Database
Use thecreate function to initialize a new Orama database instance:
Configuration Options
Thecreate function accepts several configuration options:
Schema (Required)
Defines the structure of your documents. See Schema for detailed information.Language
Specify the language for tokenization and text processing:Orama supports 30+ languages including English, Spanish, French, German, Italian, and many more.
See the supported languages list.
Sorting Configuration
Control which properties can be used for sorting:Custom Components
Replace default components with custom implementations:Plugins
Extend functionality with plugins:Custom ID
Provide a custom identifier for the database instance:Database Instance Properties
The created database instance contains several internal properties:| Property | Type | Description |
|---|---|---|
id | string | Unique identifier for the database instance |
schema | AnySchema | The schema definition |
data | object | Internal data structures (index, docs, sorting) |
tokenizer | Tokenizer | Tokenizer instance used for text processing |
index | IIndex | Index component for storing searchable data |
documentsStore | IDocumentsStore | Document storage component |
sorter | ISorter | Sorting component |
version | string | Orama version number |
Type Signatures
Frommethods/create.ts:76-95:
Database Lifecycle
The database instance is created with all necessary components initialized:- Tokenizer - Created based on language configuration
- Index - Initialized with the schema structure
- Documents Store - Ready to store documents
- Sorter - Configured with sortable properties
- Hooks - Registered from plugins
- afterCreate Hook - Executed after initialization
Internal Architecture
Orama databases contain the following internal data structures:- Radix trees for string full-text search
- AVL trees for numeric range queries
- Bool nodes for boolean filters
- Flat trees for enum types
- BKD trees for geospatial queries
- Vector indexes for similarity search
The database instance is immutable after creation. To modify the schema, you need to create a new database.
Next Steps
Schema
Define the structure of your documents
Documents
Learn about inserting and managing documents