Custom adapters

how it works a.k.a. writing your Adapters.

Adapter is an object with 2 properties:

When you pass SomeDataModel to databases[] or resources[], AdminBro will automatically run all the registered adapters and check their corresponding BaseDatabase.isAdapterFor or BaseResource.isAdapterFor methods. If Adapter returns true AdminBro feeds it (in the constructor) with SomeDataModel.

To write your own adapter, you have to create these 2 classes and implement all methods like find, create, etc.

HINT: You can also write only a Resource class (extending BaseResource) and pass its instance to AdminBroOptions#resources like this:

class MyApiAdapter extends BaseResource {
  //... all abstract methods from BaseResource

const adminBro = new AdminBro({
  resources: [User, {
    resource: new MyApiAdapter(),
    options: {

AdminBro will see, that what you passed is already a BaseDatabase instance, so it wont need to be wrapped by an Adapter.


Proudly built and maintained by SoftwareBrothers

Software House with a passion for both JavaScript and TypeScript.

See what we do See what we believe in

Proudly built and maintained by