inmake DOCS
Docs / SDK / Quick start

Quick start

Start a session and read a store in ten lines.

The SDK ships prebuilt inside the Starter download together with its drop-core-lib types — you do not build it yourself. The section below is the package README's own quick start.

import { DropCore, getDropCoreAdmin } from 'drop-core-sdk';

DropCore.start({
  store: 'my-store-id',
  access_token: 'eyJhbGciOi...',     // server-issued access token
});

const admin = getDropCoreAdmin();
const store = await admin.store.get();          // StoreEntity
const orders = admin.store.orders;
await orders.load();
console.log(orders.items, orders.count);

DropCore.start registers the connection in a named session (default 'main') so module factories can later resolve it via DropCore.get(session). For multiple stores in one process, pass a session name:

DropCore.start({ store: 'a', access_token: tokenA }, 'a');
DropCore.start({ store: 'b', access_token: tokenB }, 'b');

const adminA = getDropCoreAdmin('a');
const adminB = getDropCoreAdmin('b');

A combined facade is available too — DropCoreInstance bundles all nine:

import { initDropCore, getDropCoreInstance } from 'drop-core-sdk';

// start a session and get the instance in one call…
const drop = initDropCore('my-store-id', 'eyJhbGciOi...');
// …the same with full options (env, target, identity_token, client)…
const demo = initDropCore({ store: 'my-store-id', access_token: 'eyJ…', env: 'demo' });
// …or build one over an already-started session
const same = getDropCoreInstance();   // DropCoreInstance

drop.admin.store;                     // -> Store
drop.process.order.make({...});
drop.promo.credits.value('uid');
drop.public.store.get();
drop.gen.seo.generate({...});

Don't confuse getDropCoreInstance(session?) with getDropCore(session) — the latter is the session registry lookup and returns the underlying DropCore connection (or undefined), not the facade bundle.

One barrel, three surfaces. The root index.ts used to be a stale fork of src/index.ts — a six-facade DropCoreInstance (no gen) and a local getDropCore that shadowed the registry lookup — which reached the esbuild bundle (npm run bundle → dist/drop_core_admin.js) and, because types named a nonexistent index.d.ts, the type resolution as well. Fixed 2026-08-03: the root file is now export * from './src' (plus drop-core-lib), and types points at the emitted lib/index.d.ts. All three surfaces — require, types, bundle — now describe what is on this page. Keep the root barrel a pure re-export.