Getting started with Databunker

1. Databunker: Quick installation method

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 testing and development. For a production installation, follow this installation guide.

Connecting to Databunker

You can interact with Databunker using:

 

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.

 

3. Node.js 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

 

4. Convert existing project to use Databunker

If you intend to integrate Databunker into your existing project, you’ll need to transfer customer personal records to Databunker and utilize user tokens in UUID format in your primary database when referencing user records.

Converting sample project

In the following example, we’ll convert database schema to use user records stored in Databunker.

Original schema

Method 1: simple database reorganization

Using this method will require you to modify only the table of users. You will need to remove all personal data columns from the users table and leave it only with original userid/id and add usertoken. The usertoken' column will point to the user UUID record generated by Databunker.

Simple method

Advantages of this method

This method is suitable if you have a userid column linked from many tables or you have a very large database. Running the “alter table” command can take a lot of time to update your database structure.

Disadvantages of this method

One drawback here is that each user now has two identities. One userid and another usertoken.

Method 2: full database reorganization

You will have to go all over tables that have userid and add usertoken column instead. The usertoken is user identity in UUID format generated by Databunker.

Full reorganization

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

 

5. Support / Contact

You are welcome to email us at hello@privacybunker.io or join our slack channel: