Welcome to Hysteria ORM
Hysteria ORM is a TypeScript-first ORM for SQL, MongoDB, and Redis. It provides a unified, expressive API for interacting with multiple database systems while maintaining type safety and developer productivity.
Why Hysteria ORM?
- Multi-Database Support: Work with SQL databases (PostgreSQL, MySQL, SQLite, MSSQL, Oracle, CockroachDB), MongoDB, and Redis using a consistent API
- TypeScript-First: Built with TypeScript for excellent IDE support and type safety
- Flexible & Expressive: Powerful query builder with an intuitive API
- Framework Agnostic: Use with any Node.js framework or standalone
- Production Ready: Battle-tested features including migrations, transactions, caching, and replication
Quick Example
import { SqlDataSource, Model, column } from 'hysteria-orm';
// Define a model
class User extends Model {
@column({ isPrimary: true })
declare id: number;
@column()
declare name: string;
@column()
declare email: string;
}
// Initialize data source
const dataSource = new SqlDataSource({
type: 'postgres',
host: 'localhost',
database: 'myapp',
models: {
user: User,
}
});
// instantiate the main connection
await dataSource.connect();
// Query your data
const users = await User.query()
.orderBy('name')
.many();
Getting Started
Ready to dive in? Start with our guides:
- Philosophy - Understand the design principles
- Installation - Get Hysteria ORM installed
- Setup - Configure your first data source
- SQL Guide - Work with SQL databases
- MongoDB Guide - Use MongoDB
- Redis Guide - Integrate Redis
Features at a Glance
SQL Databases
- Type-safe query builder
- Migrations & schema management
- Relations (eager loading, lazy loading)
- Transactions & connection pooling
- CTEs, JSON operations, and advanced queries
- Read replicas support
MongoDB
- Type-safe document operations
- Aggregation pipeline support
- Session & transaction support
- Change streams
Redis
- Key-value operations
- Pub/Sub support
- Connection pooling
Developer Tools
- Unified caching layer
- Environment configuration
- Query logging & performance monitoring
- AdminJS integration (experimental)
- OpenAPI schema generation (experimental)
Community & Support
- GitHub: github.com/Frasan00/hysteria-orm
- Issues: Report bugs or request features on GitHub Issues
- NPM: npmjs.com/package/hysteria-orm
License
Hysteria ORM is MIT licensed.
Let's get started! Head over to Installation to begin.