Installation of the local database
Creating a database
our recommanded options is to use our npm create verse.db@latest
to create a new database conenction but in installing database without create function
you can do everything manual if you want
Create a new database
First you need to create a new database using the following command
npm create verse.db@latest
you will have to answer this questions to setup the connection...
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: JSON Adapter
? Directory set data folder at: ./Data
? Enable Developer logs? Yes
? Developer logs path ./Logs
? Enable securing data? Yes
? Data Encrption secret ******
? Select a variant: JavaScript
? Package Manager type npm
[Successful]: Database connection setup successfully.
[Successful]: Database Logs Folder Setup Successfully.
[Successful]: First Log
[Info]: First Log
[Warning]: First Log
[Info]: Secret is added in an .env in /.secret dir in your database dir.
[Info]: Installing The needed packages.....
Installing the packages \
added 16 packages in 15s
[Successful]: Installation complete!
Name the connection
you need to name your connection a name without spaces
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
select an adapter
the avaliable adapters will show up for you to select one of them
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: (Use arrow keys)
> JSON Adapter
YAML Adapter
SQL Adapter
Set the DataPath
set the conenction path for the data file (Data Path) it's set by default to "./Data" you can just press Enter to select the default option
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: JSON Adapter
? Directory set data folder at: (./Data)
Enable Developer Logs
if you want to enable the developer logs to log any trafic happens with the database into a log files you can enable this options. it's set by default to (N) NO you can just press Enter to select the default option
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: JSON Adapter
? Directory set data folder at: ./Data
? Enable Developer logs? (y/N)
if you selected (y) Yes you will need to Enter the Logs Directory it's set by default to "./Logs" you can just press Enter to select the default option
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: JSON Adapter
? Directory set data folder at: ./Data
? Enable Developer logs? Yes
? Developer logs path (./Logs)
Securing Data
if you want to secure the data file with our encryption method and save the data in our secure file (.verse
) you can enable it by typing (y)yes
it's set by default to (N) NO you can just press Enter to select the default option
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: JSON Adapter
? Directory set data folder at: ./Data
? Enable Developer logs? Yes
? Developer logs path ./Logs
? Enable securing data? (y/N)
if you selected (y) Yes you will need to Enter the Encryption Secret it's set by default to "versedb" you can just press Enter to select the default option
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: JSON Adapter
? Directory set data folder at: ./Data
? Enable Developer logs? Yes
? Developer logs path ./Logs
? Enable securing data? Yes
? Data Encrption secret ******
Choosing a variant
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: JSON Adapter
? Directory set data folder at: ./Data
? Enable Developer logs? Yes
? Developer logs path ./Logs
? Enable securing data? Yes
? Data Encrption secret ******
? Select a variant: (Use arrow keys)
> JavaScript
TypeScript
Choosing your package manger to install the database package
if you are using any package manger you can select the one you are using to install the package with it
VERSE.DB
Powered by JEDI STUDIO.
? Connection name: dataname
? Database adapter type: JSON Adapter
? Directory set data folder at: ./Data
? Enable Developer logs? Yes
? Developer logs path ./Logs
? Enable securing data? Yes
? Data Encrption secret ******
? Select a variant: JavaScript
? Package Manager type (Use arrow keys)
> npm
yarn
bun
pnpm
and now you can see everything happens like MAGIC ✨ so you can start using the database as soon as it finish
How to use ?
after that there will be a file created for your connection contains an exported db
with the connection name just check it out
to use it import the exported db and and use it normaly
const { db } = require("./data-dir/.config/connection-name.versedb.js");
Notes*:
- Secret: The secret is saved in a dir called
./Data-Dir/.config/.secret
with a file called./Data-Dir/.config/.secret/.env
this file contains the encryption secret if you need it