Installation
Install Hysteria ORM using your preferred package manager:
yarn add hysteria-orm
# or
npm install --save hysteria-orm
Peer Dependencies
- Make sure you have the correct database driver installed for your target database:
- PostgreSQL:
pg
- MySQL/MariaDB:
mysql2
- SQLite:
sqlite3
- MongoDB:
mongodb
- Redis:
ioredis
- PostgreSQL:
Example:
npm install pg mysql2 sqlite3 mongodb ioredis
Quick Setup with CLI
Hysteria ORM provides a CLI tool to quickly initialize your project with the standard configuration. This will create the necessary folder structure and configuration files.
Initialize with CLI
npx hysteria-orm init --type <database-type>
Available Database Types
postgres
- PostgreSQLmysql
- MySQLmariadb
- MariaDBsqlite
- SQLitecockroachdb
- CockroachDBmongodb
- MongoDBredis
- Redis
Example Usage
# Initialize with PostgreSQL
npx hysteria init --type postgres
# Initialize with MySQL
npx hysteria init --type mysql
# Initialize with SQLite
npx hysteria init --type sqlite
What the CLI Creates
The init command will create the following structure:
your-project/
├── database/
│ ├── index.ts # Database connection configuration
│ └── migrations/ # Migration files folder only if the connection is a sql database
The generated database/index.ts
file will contain the proper connection configuration for your chosen database type.
Next: Setup