On this page
Goal: from git clone to a working dashboard with your name in it, in under 30 minutes. The step-by-step version with checks per step is From clone to a running app.
Prerequisites#
- macOS, Linux, or WSL2.
- Docker Desktop (or compatible) — for Postgres, Redis, RustFS (the S3-compatible object store).
- Node 26.13.1 (
.nvmrc;package.jsonengines>=26.13.0 <27). - pnpm 12.23.0 (
packageManagerpin;npm install -g pnpm@12.23.0, since Node 26 has no Corepack). - Python 3.10+ — only for
scripts/audit/*.pyaudit scripts.
First-time setup#
git clone https://github.com/younetgroup/yng-mso-platform.git
cd yng-mso-platform
cp .env.example .env
# No edits needed: start-dev.sh replaces the placeholder NEXTAUTH_SECRET,
# SESSION_SECRET, ENCRYPTION_KEY, RLS_CONTEXT_HMAC_KEY and CUBE_API_SECRET
# with generated values. All other defaults work for local dev.
pnpm install
# Starts Postgres/Redis/RustFS, migrates, seeds, then runs `pnpm dev` detached
# (logs: .dev-server.log; stop: ./scripts/stop-dev.sh; --foreground streams logs).
# Occupied ports: set WEB_PORT / PG_PORT / REDIS_PORT in .env first.
./scripts/start-dev.sh
Open http://localhost:3000. Sign in with one of the seeded accounts documented in scripts/CREDENTIALS.md. Those are deterministic seed passwords for dev/staging only — and the file is tracked in git, so treat every password in it as public: never reuse one elsewhere, and rotate/override each account before any non-local deployment .
What you got#
A sample org (brands, orders across TTS / Shopee / Lazada, creators, inventory). Migrations: packages/schema/drizzle/ (numbered, applied in order). RLS policies: packages/schema/sql/rls-policies.sql, mandatory for every org-scoped table.
Running the gate locally#
Run the canonical complete local gate before any push:
pnpm run verify # format → types → lint → test → build/topology → security → data/RLS → audits
audit:all in package.json is the one list of static audits; do not re-list them.
verify:data (scripts/audit/data-reconciliation.ts) reconciles metric surfaces against live data, and verify:rls probes effective non-superuser roles, so both need the local data plane up and seeded (./scripts/start-dev.sh). The pre-push hook is a fast non-DB subset. CI additionally runs fresh-database gates and an isolated Playwright smoke; run pnpm run test:e2e for operator journeys touched by your change.
Never --no-verify.
Common dev tasks#
| You want to… | Do this |
|---|---|
| Add a database table | Edit packages/, export from packages/. Run pnpm -. Add RLS policy + indexes. |
| Add a tRPC route | New file under apps/. Register in root.. Use orgProcedure / brandProcedure. Every mutation calls a rateLimit* helper. |
| Add a queue job | Add it to the shared durable-job contract, enqueue web-originated work with enqueue in the domain transaction, then add the worker processor/wiring. Define stable colon-free job ID, idempotency, retry and DLQ classification. |
| Add a connector | Follow Add a data source; a worked marketing example is Add a connector. |
| Add Vietnamese copy | Add the key to packages/ AND en.. Never hardcode in JSX. |
| Add an icon | Edit packages/. Never inline an SVG in a page component. |
| Debug a SQL query | pnpm - opens Drizzle Studio against local Postgres. |
| Test a feature in the browser | . (or - for E2E/live logs). Follow the Verification section of AGENTS. before claiming "done". |
Where to read next#
- engineering/README.md: coding, testing, review and release standards, and the tutorials.
- CONTRIBUTING.md: PR workflow and commit format.
- AGENTS.md: the rulebook; agent-rule-map.md indexes every
§Nrule and its pack. - architecture/README.md: system architecture.
- status.md: what ships.
- SECURITY.md: threat model and accepted risks.
- RELEASE-CHECKLIST.md: pre-release gates.
Troubleshooting#
pnpm installfails with peer-dep errors. Make sure pnpm is the exact version pinned inpackage.json#packageManager(npm install -g pnpm@12.23.0).pnpm devsays port 3000 is in use. OverrideWEB_PORTin.env, restart./scripts/start-dev.sh.i18n-hardcoded-viregression. You added a string with Vietnamese diacritics directly in JSX. Move it topackages/i18n/src/messages/{vi,en}.tsand reference viat(). If you intentionally refactored several files at once and counts genuinely decreased, refresh the baseline:python3 scripts/audit/i18n-hardcoded-vi.py --update-baseline.- Postgres "permission denied for table X". RLS blocked an unscoped path. Use
orgProcedure/brandProcedureor wrap the complete short DB unit inrunWithRlsContext; a baresetOrgContextoutside a transaction does not enforce or persist context.