The Amazon Ad Console engine is designed to be portable. This guide covers integrating it into the amph-v2 project.
- amph-v2 running Next.js 16 + Zustand 5
- Same TypeScript configuration (
@/*path alias) - Same dependency versions (React 19, Zustand 5)
The engine layer has zero external dependencies — it is pure TypeScript.
# From Amazon-ad-console root:
cp -r src/engine/ad-console /path/to/amph-v2/src/engine/ad-consoleThis gives amph-v2:
amph-v2/src/engine/ad-console/
├── core/
│ ├── types.ts # All domain interfaces
│ ├── engine.ts # Pure business logic
│ └── scenarios.ts # Training data
├── features/
│ ├── drills/ # Navigation coaching
│ ├── profiles/ # Multi-user profiles
│ ├── trainer/ # Certification
│ ├── bulk/ # CSV import
│ ├── reports/ # Report generation
│ ├── missions/ # Scenario challenges
│ └── integrity/ # Data quality
├── store.ts # Composed Zustand store
├── index.ts # Public API
├── engine.ts # Backward-compat re-export
└── types.ts # Backward-compat re-export
If you want the full UI:
cp -r src/components/AdConsole /path/to/amph-v2/src/components/AdConsoleamph-v2 uses an engine registry pattern. Add the ad-console module:
// amph-v2/src/engine/registry.ts
import { useAdConsoleStore } from './ad-console/store';
export const engines = {
// ... existing engines
'ad-console': {
store: useAdConsoleStore,
name: 'Amazon Ads Console',
version: '3.5.0',
},
};Create a page in amph-v2's app router:
// amph-v2/src/app/(training)/ad-console/page.tsx
import { AdConsole } from '@/components/AdConsole/AdConsole';
export default function AdConsolePage() {
return <AdConsole />;
}The engine supports selective imports:
import { useAdConsoleStore } from '@/engine/ad-console/store';import { calc, simulateDays, normalizeCampaign } from '@/engine/ad-console/core/engine';
import type { Campaign, Metrics } from '@/engine/ad-console/core/types';import { runIntegrityCheck } from '@/engine/ad-console/features/integrity/engine';
import type { IntegrityReport } from '@/engine/ad-console/features/integrity/types';import { createDrillsSlice } from '@/engine/ad-console/features/drills/store';
import { createIntegritySlice } from '@/engine/ad-console/features/integrity/store';amph-v2/src/engine/
├── listing-audit/
│ ├── types.ts
│ ├── engine.ts
│ └── scenarios.ts
├── keyword-research/
│ ├── types.ts
│ └── engine.ts
├── str-triage/
│ ├── types.ts
│ ├── engine.ts
│ └── scenarios.ts
├── registry.ts
└── scoring.ts
amph-v2/src/engine/
├── ad-console/ # NEW — the full module
│ ├── core/
│ ├── features/
│ ├── store.ts
│ └── index.ts
├── listing-audit/ # existing
├── keyword-research/ # existing
├── str-triage/ # existing
├── registry.ts # updated
└── scoring.ts # existing
The ad-console uses global CSS (globals.css). For amph-v2 integration:
Convert the global styles to CSS modules:
/* amph-v2/src/components/AdConsole/AdConsole.module.css */
.app-layout { display: flex; height: 100vh; }
.app-sidebar { width: 220px; background: var(--surface-100); }
/* ... */Import the ad-console styles in amph-v2's global stylesheet:
/* amph-v2/src/styles/globals.css */
@import '../../components/AdConsole/styles/ad-console.css';The ad-console already uses CSS custom properties (--ink-100, --surface-200, etc.). Map these to amph-v2's design tokens:
/* amph-v2/src/styles/variables.css */
:root {
--ink-100: #0F1111;
--ink-200: #565959;
--surface-100: #FFFFFF;
--surface-200: #F7F8F8;
/* ... match amph-v2's existing palette */
}cd amph-v2
npm run dev
# Navigate to /ad-consoleVerify:
- Dashboard loads with 4 default campaigns
- Campaign manager shows filtering and search
- Campaign detail shows all tabs (Overview, Targets, Search Terms, etc.)
- Add/remove keywords works
- Bid adjustments save correctly
- Simulation generates cascading metrics
- All 5 drills work end-to-end
- Reports generate and export as CSV
- Integrity check runs and shows issues
- State persists during session (Zustand in-memory)
The engine layer imports only:
zustand— for store creation (can be replaced with any state manager)- TypeScript standard library —
Date,Set,Math,Array,JSON
It does NOT import:
- React
- Next.js
- Any UI library
- Any database/ORM
This means the engine can also run in:
- Node.js scripts
- Web Workers
- Server-side API routes
- CLI tools