Simulation-first financial intelligence platform — market data · explainable signals · deterministic simulation trading
- System Purpose
- Current Product Surfaces
- Monorepo Structure
- Non-Negotiable Architecture Boundaries
- Read and Write Patterns
- Prerequisites
- Quick Start
- Environment Variables
- Development Commands
- Testing and Validation Workflow
- Simulation and Execution Safety
- Performance and Debugging Tips
- Docs Map
- Known Baseline Issue
- Contribution Checklist
- Troubleshooting
Aurox Intelligence is designed to:
- aggregate provider-backed market context
- compute deterministic signals and forecast context
- run auditable simulation trading across stocks, ETFs, and crypto
- expose route-driven, typed read models for workstation UI flows
Safety and correctness take priority over convenience:
- Safety
- Correctness
- Determinism
- Observability
- Performance
Web routes include:
/dashboard/market/markets/rankings/stocks,/stocks/[symbol]/fx,/fx/[pair]/signals/forecasts/portfolio/invest/invest/overview/invest/simulation/invest/portfolio/invest/orders/invest/live-readiness/invest/accounts/invest/broker-health/invest/broker-modes/invest/stocks,/invest/etfs,/invest/crypto/admin,/admin/monitoring/account,/account/profile,/account/settings,/account/activity/login,/signup
Simulation is the default execution target. Lanes define capital limits, asset scope, and execution policy per strategy. Live execution is gated behind a readiness check.
apps/
web/ # Next.js App Router UI + server orchestration
worker/ # Background worker runtime
packages/
api-contracts/ # Zod schemas and shared contracts
db/ # SQL repositories, migrations, read models
ingestion/ # Canonicalization + ingestion lifecycle
providers/ # External data provider adapters
signals/ # Pure signal logic (no I/O)
forecasting/ # Pure forecast logic (no I/O)
agents/ # Execution and orchestration workflows
ai-market-intelligence/ # Explainable market intelligence helpers
observability/ # Logging/telemetry scaffolding
design-tokens/ # Shared tokens/CSS themes
Aurox is backed by a structured knowledge base that maps financial domains, signal frameworks, and system architecture into a connected graph. The knowledge engine powers explainability across signals, recommendations, and risk decisions.
The platform is localized across multiple languages. All financial UI labels, risk copy, and signal explanations are translation-ready.
packages/providersowns all external provider calls.packages/dbis the only SQL/persistence boundary.packages/api-contractsis the contract source of truth.packages/signalsandpackages/forecastingstay pure.apps/weborchestrates routes/services/mappers/UI only.
Forbidden:
- provider calls in UI components
- direct SQL in routes/components
- duplicated contract schemas in app layer
- execution or risk logic in presentation components
Canonical read path:
Query -> Mapper -> Service -> Route -> UI
Canonical write path:
UI -> Server Action -> Zod Validation -> Domain Service -> Repository Transaction -> Revalidation
Keep these seams explicit when adding or changing features.
- Node.js
20+recommended pnpm(repo usespnpm@10)- PostgreSQL for full repository-backed behavior
- Install dependencies
pnpm install- Create local env
cp .env.example .envWindows PowerShell:
Copy-Item .env.example .envThe repository-root
.envis the single source of truth for shared runtime config and secrets. Bothapps/webandapps/workerread from it during development — you do not need per-app.envfiles..envis git-ignored and must never be committed.
- Generate a strong
AUTH_SECRET
AUTH_SECRET signs session tokens and is required for the web app to boot. The
placeholder in .env.example is intentionally too short. Generate a real one:
openssl rand -base64 32Set it in the root .env:
AUTH_SECRET=<paste-the-generated-value>- Verify the environment is loaded
pnpm env:checkThis prints which env files were found and confirms AUTH_SECRET presence
(yes/no only — it never prints secret values). It exits non-zero if a required
variable is missing.
- Run DB migrations
node packages/db/scripts/migrate.mjs- Start development
pnpm dev- Open the app
http://localhost:3000
pnpm devruns Turborepo, which first builds the internal@repo/*packages that the web app consumes as compileddist/, then starts the persistent dev servers.- The web dev/build/start scripts use
dotenv-clito inject the root.env(and an optional root.env.localoverride) into the process. Next.js then propagates those real env vars to its render workers — which is why a config-file loader is not sufficient here. NODE_ENVis forced per command (dev→ development,build/start→ production) viacross-env, so aNODE_ENVvalue accidentally left in.envcannot corrupt a production build. Do not setNODE_ENVin.env.- The worker loads the root
.envitself (via@next/env) and consumes the@repo/*packages directly from their TypeScript source throughtsx, so it does not depend on prebuiltdist/during development.
See .env.example for complete list. Key groups:
- Core app/runtime:
NODE_ENVAPP_BASE_URLNEXT_PUBLIC_APP_URLAUTH_SECRET
- Database:
DATABASE_URLDATABASE_URL_UNPOOLEDDIRECT_URL
- Providers:
MARKET_DATA_PROVIDERMARKET_HISTORY_FALLBACK_PROVIDERSMARKET_QUOTE_FALLBACK_PROVIDERS- Provider API keys (
POLYGON_API_KEY,FINNHUB_API_KEY, etc.)
- Broker execution safety:
BROKER_EXECUTION_PROVIDER(defaults tosimulation)BROKER_DRY_RUNBROKER_SANDBOX_MODEBROKER_ALLOWED_LIVE_MODE_IDS
Important:
- Never commit secrets or
.envfiles. - Keep simulation defaults unless live readiness is explicitly approved.
Root:
pnpm dev
pnpm build
pnpm typecheck
pnpm test
pnpm lint
pnpm cleanTargeted:
pnpm dev:web
pnpm build:web
pnpm typecheck:web
pnpm dev:worker
pnpm build:worker
pnpm typecheck:workerPackage-level examples:
pnpm --filter @repo/api-contracts typecheck
pnpm --filter @repo/db typecheck
pnpm --filter @repo/ingestion typecheck
pnpm --filter @repo/providers testWhen changing code, prefer smallest meaningful validation first.
Typical flow:
- Run targeted package checks for touched areas.
- Run
pnpm build:webfor route/UI/server changes. - Escalate to broader checks only when needed.
Suggested minimums by change type:
- Contracts changed:
pnpm --filter @repo/api-contracts typecheck
- DB/repository changed:
node packages/db/scripts/migrate.mjspnpm --filter @repo/db typecheck
- Provider logic changed:
pnpm --filter @repo/providers typecheckpnpm --filter @repo/providers test
- Dashboard/web route changed:
pnpm build:web
Simulation is the default execution mode.
Key expectations:
- deterministic accounting and order lifecycle
- transaction and snapshot auditability
- explicit risk and policy gates before any execution
- safe fallback behavior when provider or data paths degrade
Do not:
- bypass risk checks
- fake provider data
- enable autonomous live execution without readiness gates
Simulation persistence tables include:
app.simulation_accountsapp.simulation_portfoliosapp.simulation_positionsapp.simulation_ordersapp.simulation_transactionsapp.simulation_snapshots
- Prefer targeted query/service timings in development (
NODE_ENV=development). - Avoid adding expensive calls to broad routes (
/dashboard) unless needed for initial shell. - Use streaming boundaries and request-scoped dedupe for heavy sections.
- Cache only non-user-specific data globally; keep user-specific reads request-scoped.
- Watch
.next/dev/logs/next-development.logfor route timing and warning context.
For bottleneck analysis on dashboard-like pages:
- instrument loader/query/service timing
- identify dominant path (provider breadth, DB read model, history)
- apply one focused optimization
- re-measure and compare
Primary entry points:
- System Docs Master
- Current State Summary
- Architecture Overview
- Architecture Current State
- Architecture Best Practices
- Simulation Test Plan
Domain docs:
- Finance System Overview
- Signal Framework
- Risk Management
- Execution Layer
- Portfolio Construction
- Reporting Framework
- Broker Infrastructure
- AI in Finance
Live microtrading docs:
As of 2026-04-25, pnpm --filter @repo/web typecheck currently fails with existing issues in:
apps/web/components/signals/signal-score-badge.tsxapps/web/server/auth/service.test.tspackages/agents/src/execution/execution-mode-registry.ts
Treat these as baseline unless your change directly touches those areas. Verified passing on the same date:
pnpm --filter @repo/api-contracts typecheckpnpm --filter @repo/db typecheck
Before opening a PR:
- confirm boundaries are preserved (
providers,db,api-contracts, etc.) - keep changes scoped and reversible
- run targeted validation commands
- include any migration/risk implications in notes
- call out residual risks and follow-up tasks
PR summary should include:
- what changed
- why it changed
- commands run
- known unrelated failures
- rollback approach (if relevant)
The web app reads AUTH_SECRET from the repository-root .env. If it is missing
or shorter than 32 characters the app fails fast with an actionable message.
- Confirm the value is present and visible:
pnpm env:check
- If missing, generate one and add it to the root
.env:echo "AUTH_SECRET=$(openssl rand -base64 32)" >> .env
- Start fresh —
next devcaches env at process start:pnpm dev
Notes:
- The value must live in the root
.env(preferred) orapps/web/.env.local. - Never prefix it with
NEXT_PUBLIC_— that would expose the signing key to the browser bundle. - There is intentionally no insecure development fallback for
AUTH_SECRET.
This means a workspace package has not been built where a consumer expected
compiled output. The web app consumes @repo/* as built dist/; pnpm dev
builds those packages first via Turborepo (dev depends on ^build). The
worker consumes the same packages from source through tsx, so it does not need
dist/ in development.
If you still hit this:
pnpm build # builds all internal package dist/ once
# or just the one package:
pnpm --filter @repo/db buildThen re-run pnpm dev.
This repo targets the Node version used in CI (Node 24.x at time of writing). If you see syntax or ESM resolution errors that nobody else hits, check:
node -vand switch with your version manager (e.g. nvm use) to match.
pnpm dev runs turbo run dev (no --parallel). In Turborepo 2.x, --parallel
ignores task dependencies, which would skip the ^build step the web app needs.
The default turbo run dev already runs the dev tasks concurrently and
respects dependsOn, so do not re-add --parallel.
If command execution fails with filesystem permission errors, rerun outside restrictive sandbox or from a shell with proper workspace permissions.
If you see "another next dev server is already running":
- stop the existing process or choose another port
- on Windows:
taskkill /PID <pid> /F
Start by measuring loaders in development logs, then optimize the single slowest path. Typical hotspots:
- broad quote universe fetches
- expensive provider history reads
- DB read model cold path latency
Browser favicon caches aggressively:
- hard refresh
- clear site data
- verify file in
apps/web/public/and metadata icon config







