Registry / database / thunder-schema

thunder-schema

JSON →
library1.0.29jsnpmunverified

A TypeScript ORM for ClickHouse databases, providing type-safe model definitions, a powerful query builder, and migration support. Current stable version is 1.0.29. Released actively with regular updates. Key differentiators include full TypeScript-first approach, connection pooling, multi-tenancy support, and a built-in migration CLI. Unlike simpler ClickHouse clients, it offers a Django-like ORM experience with automatic type inference and advanced query operators.

npm install thunder-schema
INSTALL
IMPORT
SIG · THUNDER-SCHEMA
T
thunder-schema
databasejavascriptv1.0.29
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Model
import { Model } from 'thunder-schema'
import Model from 'thunder-schema'
Model is a named export, not default. Use named import syntax.
Field
import { StringField, NumberField } from 'thunder-schema'
const StringField = require('thunder-schema').StringField
ESM-only package. CommonJS require is not supported.
ConnectionManager
import { ConnectionManager } from 'thunder-schema'
import { ConnectionManager } from 'thunder-schema/connection'
ConnectionManager is exported from the main package, not a subpath.

Defines a User model with name and age fields, then queries all users from the database using the default connection.

import { Model, StringField, NumberField, ConnectionManager } from 'thunder-schema'; class User extends Model { schema = { name: new StringField(), age: new NumberField(), }; tableName = 'users'; } async function main() { // Use default connection (requires env variables) const user = new User(); const users = await user.objects.all(); console.log(users); } main().catch(console.error);
Debug
Known issues
breakingThe package was renamed from 'clickhouse-orm' to 'thunder-schema'. Old imports will break.
fix
Update your package.json dependency from 'clickhouse-orm' to 'thunder-schema' and change imports accordingly.
affects: <1.0.0
deprecatedUsing ConnectionManager as a global singleton without calling init() may lead to unexpected behaviour with default connections.
fix
Call ConnectionManager.init(config) before creating any model instances, or pass configuration to the model constructor.
affects: >=1.0.0
gotchaModel fields are defined as instances (new StringField()), not plain objects. Forgetting 'new' will cause runtime errors.
fix
Always use 'new' when defining fields in the schema object.
affects: >=1.0.0
gotchaThe package requires Node.js >=18.17.1. Older versions will fail to even load the module.
fix
Upgrade Node.js to version 18.17.1 or later.
affects: >=1.0.0
deprecatedUsing the old field type 'IntField' has been replaced by 'NumberField'. IntField is deprecated.
fix
Replace IntField with NumberField in your model definitions.
affects: >=1.0.20
Errors
Common errors & fixes
Error: Cannot find module 'thunder-schema'
Package is not installed or Node.js version is too old (<18.17.1).
fix
Run 'npm install thunder-schema' and ensure Node.js >=18.17.1.
TypeError: Class extends value undefined is not a constructor or null
Importing default export instead of named 'Model' import.
fix
Change 'import Model from "thunder-schema"' to 'import { Model } from "thunder-schema"'.
Error: Connection not configured. Call ConnectionManager.init() or provide config to model constructor.
Attempting to use a model without configuring a connection.
fix
Call 'ConnectionManager.init({ host, port, username, password })' before using models.
Error: Invalid field definition. Field must be an instance of Field class.
Defining a field using a plain object or calling Field constructor without 'new'.
fix
Use 'new StringField()' instead of 'StringField()' or a plain object.
Upgrade
Version history
1.0.29latest on npm
Audit
Dependencies
clickhouserequiredUnderlying ClickHouse client driver for database communication
Agent activity
14 hits · last 30 days
node
12
Meta
1
OpenAI (training)
1
Resources
thunder-schema — npm install thunder-schema · libregistry