Getting started with Databunker

Step 1. Starting Databunker in demo mode

The easiest way to get started with Databunker is to run it as a Docker container:

docker run -p 3000:3000 -d --rm --name databunker securitybunker/databunker demo

This command starts a local container with a DEMO root access key. It can be used for local testing and development.

Connecting to Databunker

You can interact with Databunker using:

Additional installation options

 

Step 2. Useful Databunker commands

Create a user record

curl -s http://localhost:3000/v1/user -X POST -H "X-Bunker-Token: DEMO" \
  -H "Content-Type: application/json" \
  -d '{"first":"John","last":"Doe","login":"john","phone":"4444","email":"user@gmail.com"}'

Fetch user records by email

curl -s -H "X-Bunker-Token: DEMO" -X GET http://localhost:3000/v1/user/email/user@gmail.com

Fetch user records by login

curl -s -H "X-Bunker-Token: DEMO" -X GET http://localhost:3000/v1/user/login/john

Other commands:

For a full list of commands, see the API document.

 

Step 3. View Node.js code examples

  1. Node.js example implementing passwordless login using Databunker: https://github.com/securitybunker/databunker-nodejs-passwordless-login

  2. Node.js example with Passport.js, Magic.Link and Databunker: https://github.com/securitybunker/databunker-nodejs-example

  3. Secure Session Storage for Node.js apps: https://databunker.org/use-case/secure-session-storage/#databunker-support-for-nodejs

Node.js modules

  1. @databunker/store from https://github.com/securitybunker/databunker-store

  2. @databunker/session-store from https://github.com/securitybunker/databunker-session-store

 

Step 4. Convert existing project to use Databunker

If you intend to integrate Databunker with your existing project, you’ll need to save customer personal records in Databunker. You can use user token, user email, user login, phone number, or a custom index to look for user details stored in Databunker.

Converting a sample project

Take a look at the following database schema. We will convert it to use user records stored in Databunker.

Original schema

Method 1: simple database reorganization

You will only need to modify the users table. Remove all personal data from this table, leaving only the original userid/id column, and add a usertoken column. The usertoken will point to the user UUID token generated by Databunker.

This method is suitable if you have a userid column linked from many tables or a very large database. As a result, running the “alter table” command can take a lot of time and may lock your database.

One disadvantage of this method is that each user now has two identities: one userid and one usertoken.

Simple method

 

Method 2: full database reorganization

You will have to modify all tables that use the userid column and use usertoken column instead. The usertoken will point to the user UUID token generated by Databunker.

This method will require more changes on your database level and in your application code.

Full reorganization

What’s next?