Setting up your environment

Init Command

SchemaJS provides with schemajs init as a way to easily initialize the boilerplate necessary for the database server to spin up. All you need to do is run schemajs init inside the folder where you would like your database schemas to be placed.

Foundational

To use SchemaJS effectively, your database implementation needs to follow specific structural patterns. This ensures that the engine can correctly interpret and execute your database logic.

We recommend you create a workspace folder. You can do this by running the following command:

cd documents && mkdir schemajs-workspace && cd schemajs-workspace

After creating the folder schemajs-workspace you will need to create a SchemaJS.toml inside it, which will contain all the configuration, and most importantly, the schemas you would like to load in the engine. For the sake of simplicity during this section, we will just load our public schema. Our SchemaJS.toml will look like this:

[workspace]
databases = [
    "./public"
]

and inside schemajs-workspace we will create the following folders

- ./public
- ./public/tables

You can do this by running the following command

mkdir -p public/tables

After having followed the steps above, your environment should look like this:

- schemajs-workspace
    - SchemaJS.toml
    - public
        - tables

Last updated