OptimaDB is built on top of Bun’s APIs to take advantage of their high performance.
Future versions of OptimaDB will also support Node.js and Deno, though the same level of performance cannot be guaranteed.
1 - Download and install the package
To get started with OptimaDB, you need to install the package using Bun. This will add @inflector/db
to your project dependencies, allowing you to use all of OptimaDB's features in your Bun application.
Terminal
1
2 - Define a Schema in schema.ts
Create your database schema by defining tables and their columns in schema.ts
. Each table is created using the Table
function, and you can specify column types such as uuid
, email
, and password
. This schema will be used by OptimaDB to structure and validate your data.
typescript
1
2
3
4
5
6
7
3 - Create Your first Database
Now, initialize your database by creating an instance of OptimaDB
and passing your schema to it. This sets up your database with the tables and columns you defined, making it ready for use in your application.
typescript
1
2
3
4
5
6
7
8
9
10
11
4 - Run your program using Bun
To start your application and initialize your OptimaDB database, run your main TypeScript file using Bun. This will execute your code, set up the database according to your schema, and make your tables available for use.
Terminal
1