Architecture
SUDIGITAL runs on a single backend monorepo — sudi.engine — that serves all three products through one API, one database, and one authentication system.
System Overview
┌───────────────────────────────────────────────────────────────────┐
│ FRONTENDS │
│ │
│ sudigital.com (unified shell) neptu.sudigital.com pasar.sudigital.com
│ apps/web — unified dashboard apps/neptu apps/pasar │
│ (React/Vite) (React/Vite) (React/Vite) │
│ │
└──────────────┬────────────────┬──────────────────┬────────────────┘
│ │ │
▼ ▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ sudi.engine API │
│ (Elysia) │
│ │
│ /hub/* /neptu/* /pasar/* /v1/* │
│ missions ai strategies auth │
│ nft subscriptions bots users │
│ chat referrals alerts health │
│ blockchain payments markets │
│ xp api-platform automation │
│ │
├─────────────────────────────────────────────────────────────────┤
│ SERVICES │
│ │
│ Privy Auth Drizzle ORM OpenAI/Vertex ccxt/Jupiter │
│ (JWT) (PostgreSQL) (LLM) (Exchange) │
│ │
└──────────┬────────────────────────────────────┬─────────────────┘
│ │
▼ ▼
┌──────────────────────┐ ┌──────────────────────┐
│ PostgreSQL │ │ Worker │
│ (single DB) │ │ (background jobs) │
│ │ │ (cron tasks) │
│ users │ └──────────────────────┘
│ member_* tables │
│ neptu_* tables │ ┌──────────────────────┐
│ pasar_* tables │ │ Telegram Bot │
│ shared tables │ │ (raw Bot API) │
│ │ └──────────────────────┘
└──────────────────────┘Monorepo Structure
sudi.engine/
├── apps/
│ ├── api/ — Elysia REST API
│ ├── web/ — Unified member dashboard + main site
│ ├── neptu/ — Neptu frontend
│ ├── pasar/ — ThePasar frontend
│ ├── worker/ — Background jobs & cron
│ └── cli/ — Terminal dashboard
│
├── packages/
│ ├── shared/ — Types, constants, configs, errors
│ ├── contracts/ — Blockchain config, chain/token constants
│ ├── db/ — Drizzle ORM (PostgreSQL, 40+ schemas)
│ ├── ai/ — AI providers (OpenAI, Google Vertex; DeepSeek opt-in)
│ ├── auth/ — Privy auth (hooks, context, cross-subdomain SSO)
│ ├── solana/ — Solana client (programs, token, signing)
│ ├── evm/ — EVM chain client (contracts, ABIs, signing)
│ ├── nft/ — NFT, claim, tokenomics constants
│ ├── missions/ — Mission & chat constants
│ ├── integrations/ — Telegram bot + integration catalog
│ ├── logger/ — Pino structured logging
│ ├── ui/ — Shared UI components (React + TailwindCSS v4)
│ ├── neptu/ — Balinese calendar engine
│ ├── pasar/ — Pasar trading shared code
│ ├── graphify/ — Knowledge graph (graphology)
│ ├── miro-fish/ — Multi-agent prediction engine
│ ├── decision/ — System One (Laya) decision client
│ └── sanity/ — Sanity CMS client
│
└── docs/ — This documentation siteDependency Order
shared -> logger -> db -> ai -> neptu -> graphify -> miro-fish -> appsAuthentication
All products share one auth system via Privy on a single root domain:
- Users authenticate with wallet (Phantom, MetaMask) or social login
- Privy issues ES256/EdDSA JWTs; sudi.engine validates them on every request
- Privy stores its session in a first-party HttpOnly cookie scoped to
.sudigital.com, so the session is shared across every product subdomain - One user account works across all products — no separate registration per product
neptu.dayandthepasar.comare legacy aliases that redirect to their*.sudigital.comsubdomains, so the shared cookie always applies- The frontend never mirrors the JWT into a JS-readable cookie
Database Design
Single PostgreSQL database with domain-organized schemas:
Core (cross-cutting):
users— Unified user table (Privy auth, wallet address)audit_log— System-wide audit trailjob_queue— Worker job queuemarket_data— Shared market data
Missions, NFTs & engagement tables:
nft_collections,nft_traits— NFT systemmissions,mission_participants— Mission systemchat_sessions,chat_messages— Chatxp_accounts,stake_accounts— XP and staking
Neptu tables:
people— Public figures for astrology analysissubscriptions,payments— Billingreferrals— Referral systemai_usage— AI reading quota
ThePasar tables:
trading_connections,trading_balances— Exchange connectionsstrategies,strategy_versions,bots— Trading strategiesalerts,automation_tasks— Automation
API Design
Routes are organized by product domain:
GET /v1/auth/me — Current user (shared)
GET /v1/health — System health (shared)
POST /hub/missions — Create mission
GET /hub/nft/collections — List NFT collections
GET /hub/xp/balance — XP balance
GET /v1/ai/daily/:birthDate — Daily AI insight
POST /neptu/subscriptions — Create subscription
GET /neptu/calendar/wuku — Wuku calendar data
GET /pasar/strategies — List strategies
POST /pasar/bots — Create trading bot
GET /pasar/markets — Market dataUnified Member Dashboard
Authenticated member dashboards are unified in the web app (apps/web) behind a single shell. Members navigate the whole ecosystem without being redirected to a product subdomain; subdomains remain the home for public landing pages and deep product features.
Navigation model
The shell follows the standard Web2/Web3 split of two independent controls:
| Control | Scope | Source |
|---|---|---|
| Product switcher | Ecosystem context (Neptu / Pasar / platform) | Sanity siteSettings.products |
| Workspace switcher | Section scope (Dashboard / Admin / Developer) | App teams + role gating |
Terminology: an app switcher ("waffle") launches between distinct apps and leaves the shell (Google Workspace, Microsoft 365); a product switcher swaps product context inside a persistent shell (Notion, Linear, Vercel); a workspace/org switcher changes the data/tenant scope. sudi.engine uses the in-shell product switcher plus a separate workspace switcher — never two competing controls.
Routing
- The shared shell lives in
packages/ui(AppSidebar,TeamSwitcher,lib/workspace.ts,lib/workspace-preference.ts) and is prop-driven. - Product dashboard entry points render in-app at
/neptuand/pasarinapps/web, backed by the shared cross-product API client. productRoutesmaps a product id to its in-app route, so selecting a product stays on the web origin. When no in-app route exists the switcher falls back to the product's external URL.apps/websupplies routes for Neptu and Pasar and derives the active ecosystem from the first path segment viadetectEcosystem(packages/ui/src/lib/workspace.ts).- The last-selected workspace is persisted (
sudi:last-workspace) and resumed on root visits. - Each product subdomain's
/dashboardredirects to the unified dashboard whenVITE_WEB_URLis set; landing and deep routes stay on the subdomain until they are migrated.
Next Steps
- Products — detailed look at each product
- Tokenomics — how $SUDIGITAL connects the ecosystem