Setup Options

dcupl offers two setup approaches: Console + Loader (recommended) and SDK-only. Both use the same query API—your application code stays the same regardless of which you choose.

The Console manages your models and data sources visually. The Loader fetches everything at runtime from Console's CDN.

Why it's recommended:

  • Visual model editor – Define schemas without writing JSON
  • External data sources – Connect APIs, S3, databases directly
  • Environments – Dev, staging, production configs out of the box
  • Team collaboration – Non-developers can edit models and data
  • Version control – Draft → Published workflow for safe deployments

SDK-Only

Define models and load data directly in code. No external dependencies.

Use cases:

  • Quick prototypes and learning
  • Small, static datasets bundled with your app
  • Full programmatic control required

Comparison

Console + Loader (Recommended) SDK-Only
Packages @dcupl/core + @dcupl/loader @dcupl/core
Models Visual editor in Console Defined in code
Data Auto-fetched from URLs Inline or manual fetch
Environments Built-in (dev/staging/prod) Manual config
Versioning Draft → Published workflow Git only

Setup Code

import { Dcupl } from '@dcupl/core';
import { DcuplAppLoader } from '@dcupl/loader';

const dcupl = new Dcupl({
  config: {
    projectId: 'your-project-id', // From Console
    apiKey: 'your-api-key', // From Console
  },
});

const loader = new DcuplAppLoader();
dcupl.loaders.add(loader);

// Fetch configuration and data from Console CDN
await loader.config.fetch();
await loader.process({ applicationKey: 'default' });
await dcupl.init();

// Query your data
const list = dcupl.lists.create({ modelKey: 'Product' });
const results = list.catalog.query.items();
import { Dcupl } from '@dcupl/core';

const dcupl = new Dcupl();

// Define model in code
dcupl.models.set({
  key: 'Product',
  properties: [
    { key: 'name', type: 'string' },
    { key: 'price', type: 'number' },
  ],
});

// Load data inline
dcupl.data.set({
  model: 'Product',
  items: [
    { key: 'p1', name: 'Widget', price: 29.99 },
    { key: 'p2', name: 'Gadget', price: 49.99 },
  ],
});

await dcupl.init();

// Query your data
const list = dcupl.lists.create({ modelKey: 'Product' });
const results = list.catalog.query.items();

Migrating from SDK-Only to Console

  1. Create a project in Console
  2. Define models in the visual editor (or import existing JSON)
  3. Add data sources (URLs, file uploads)
  4. Get your projectId and apiKey
  5. Replace dcupl.models.set() with Loader setup
  6. Query code stays the same—no changes needed

Next Steps