Getting Started

Installation & Required

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.

REQUIREMENT

  • Bun Version 1.1 or above

Installation

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

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

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

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

Terminal

1