dg.run

Example apps

The examples live in the dg-run/examples repository. Every folder is a small, complete app with its own README, source files and a prebuilt .zip. Upload the zip under My apps to see the app running, or copy the source into a project of your own.

Nine of them use dgclient from npm: they import createDg from the package and bundle it into the app at build time, with no paths pointing back into this repository. To change one, clone the repository and install its dependencies in that folder first. market-pwa and todo-pwa are purely client-side.

basic-example, pro-notes, fa-subscriptions and grocery-pwa use the React hooks of dgclient/react (dgclient 0.3.0 or newer); the other samples use the client directly.

Example SDK What it shows
list-crud dgclient A live list with create, read, update and delete on the database; open it in two tabs and they stay in sync
login-demo dgclient Sign in with dg.run in a few lines: signIn, user and signOut
subscribe-demo dgclient Plans and a subscription on one page: list plans, send the user to pay, read their plan and unlock a feature
basic-example dgclient Sign-in, a typed public guestbook and private notes, live updates, tags/roles, and real English and French pages for SEO
pro-notes dgclient A free tier, trial, monthly/yearly and lifetime plans, plus sign-in, private notes and an entitlement-gated export
fa-subscriptions dgclient The same billing flow in Persian (RTL), with USD and IRR plans
config-demo dgclient Remote config declared in the manifest, changed live from the dashboard and kept offline
logs-demo dgclient Logs, errors, repeated lines and batches in the owner's dashboard
market-pwa — A store page and an installed PWA at one address, with an install prompt and a service worker
todo-pwa — An offline-first React/Vite todo list stored in the browser with LokiJS
grocery-pwa dgclient A barcode and QR scanner with a public price catalog, a private shopping list and summary, remote config, and an installable PWA

Try an example

  1. Open one of the folders above on GitHub and download its ready-made .zip. No build is needed.
  2. Log in at /login with any email (code 55555 on a local marketplace), upload the zip under My apps, test it, and approve the version as admin in /admin/projects.
  3. Open the app at its own address — locally, http://basic-example.localhost:3000/ for basic-example.

To change an example, clone dg-run/examples, cd into its folder and run npm install to get dgclient from npm. npm run pack rebuilds the zip once esbuild, React and TypeScript are available; see the folder's README. market-pwa and todo-pwa have no SDK.

Where to start

  • The simplest start: list-crud, login-demo and subscribe-demo each show one feature in a short, plain TypeScript app.
  • A first look: basic-example covers the most ground: pages for people and search engines, sign-in, data, live updates and roles.
  • One feature at a time: config-demo and logs-demo are short, plain TypeScript apps.
  • Selling access: start with pro-notes, then see the Persian version in fa-subscriptions.
  • PWAs: market-pwa separates the store page from the installed app; todo-pwa keeps its data on the device; grocery-pwa scans barcodes and QR codes and uses the app backend.

For a new project, use npm create dg (see Start your first app) rather than copying a whole example. The SDK examples are also a working reference for sign-in and database and plans and subscriptions.