Bot/Mini App ──> Scraper (BullMQ) ──> AI (CLIP/pHash) ──> PostgreSQL (pgvector) <── API (oRPC)
| Path | Purpose |
|---|---|
apps/server |
Grammy Telegram bot, and BullMQ worker implementations. |
apps/web |
React 19 Telegram Mini App dashboard (Uber-style aesthetics). |
packages/api |
API Layer: oRPC router definitions and shared contract types. |
packages/utils |
Infrastructure: Prisma schema, database client, and business logic. |
packages/crypto |
Security: Session encryption and perceptual image hashing (pHash). |
- Use
@/alias for all internal imports; relative imports are forbidden in apps. - Prefer Bun APIs (
Bun.file,Bun.write, etc.) over Node.jsfsequivalents. - Treat Telegram IDs as JS safe integers (
number) in app code; convert toBigIntonly where required by Prisma/db types. - Run
buildscript only for changes inapps/webpackage. - Don't run
testcommand unless you change code related to these tests. - Use pre-defined types from libraries\Prisma generated files where is possible. Use Pick, Omit and other Typescript type-helpers to extract required values instead of creating own types with same information.
- Instead of
fetch->httpfrom@/starlight/utils/httpmodule - Align on pre-existing types from libraries and generated code; avoid creating redundant helper types or defensive type-safety checks for scenarios that cannot happen in trusted internal code.
- MUST use
bunfor package management. - DON'T use
tscortypecheckorcheck-types. - Run
lintcommand to check for linting errors. DON'T runformat— it's triggered automatically by other pipelines. - ALWAYS use scripts from package.json to create and apply migrations via Prisma. Never write migration files manually.