A minimal Next.js + TypeScript application that calls the Open Mercato API via @open-mercato/client and renders the latest deals inside a simple React page.
- Node.js 18.18+ or 20.x
- npm 9+
-
Install dependencies
npm install
-
Configure the API key
cp .env.local.example .env.local
The sample env file already contains the default demo key you shared (
omk_7fb72cd6.4a98a415d4ab444b6b9ead8f75dad500ade109bb6beca257). Feel free to replace it with your own and restart the dev server whenever you rotate the credential. -
Run the dev server
npm run dev
Visit http://localhost:3000 to see the pipeline snapshot.
src/lib/deals.tsinstantiatescreateOpenMercatoClient, injects theOPEN_MERCATO_API_KEYaccess token, and exposes a typedfetchDealshelper. You can tweak theDEFAULT_QUERYobject to change the sort, status, or paging parameters passed to/customers/deals.src/app/page.tsxis a server component, so the API key never leaves the backend. It loads the deals at request time (export const dynamic = 'force-dynamic') and renders a compact stats grid and table.- Styling lives in
src/app/globals.cssto keep the example lightweight—feel free to swap in Tailwind or any other design system.
| Name | Required | Description |
|---|---|---|
OPEN_MERCATO_API_KEY |
✅ | Bearer token used by @open-mercato/client. The provided value in .env.local.example is used by default, but you should override it with your organization key when available. |
OPEN_MERCATO_API_BASE_URL |
⛔️ | Optional override for the API base URL. Defaults to https://demo.openmercato.com/api, falling back to the package’s built-in heuristics if unset. |
| Command | Description |
|---|---|
npm run dev |
Starts the Next.js dev server with hot reload. |
npm run build |
Creates an optimized production build. |
npm start |
Runs the production server (after npm run build). |
npm run lint |
Lints the project with ESLint (flat config powered by eslint-config-next). |
npm run type-check |
Runs tsc --noEmit for CI-friendly type safety. |
- Swap the demo token with an organization-specific key.
- Adjust
fetchDealsto request additional associations (people, companies) or wire up pagination. - Deploy to Vercel or your preferred host once you are happy with the UI.
