Stack Overview
CardNexus is a multi-platform trading card inventory and sales management system built as a Turborepo monorepo.
Backend
| Technology | Purpose |
|---|---|
| Node.jsΒ + TypeScriptΒ | Runtime & Language |
| ExpressΒ | HTTP Server |
| oRPCΒ | Contract-first API framework |
| MongoDBΒ + MongooseΒ | Database & ODM |
| TSyringeΒ | Dependency Injection |
| VitestΒ | Testing |
| BiomeΒ | Linting & Formatting |
Key Patterns
- Layered Architecture: Handlers β Features β Domains β Views β Foundation
- Contract-First API: Define schemas in
@repo/api-dtos, implement in@repo/api - Result Pattern: Services return
Result<T, E>using neverthrowΒ - Event-Driven: Domain events for cross-cutting concerns
See the Backend Introduction for detailed architecture documentation.
Frontend
| Technology | Purpose |
|---|---|
| Next.js 15Β | React Framework (App Router) |
| Tailwind CSSΒ | Styling |
| JotaiΒ | State Management |
| TanStack QueryΒ | Server State |
| ZodΒ | Validation |
| ClerkΒ | Authentication |
Key Patterns
- Atomic Design: Component architecture principles
- Type-Safe API: oRPC client with full type inference
- Form Atoms: jotai-formΒ for form state
Mobile
| Technology | Purpose |
|---|---|
| React NativeΒ + ExpoΒ | Framework |
| NativeWindΒ | Styling (Tailwind for RN) |
| JotaiΒ | State Management |
| DrizzleΒ + SQLite | Local Database |
Key Patterns
- Atomic File Organization:
queries.ts,mutations.ts,ui.ts,effects.ts - Offline-First: SQLite for local persistence
- Template-Based Creation: Mutation atoms for inventory management
Infrastructure
| Service | Platform |
|---|---|
| Frontend | VercelΒ |
| Backend | AWS ECSΒ |
| Database | MongoDB AtlasΒ |
| Search | OpenSearchΒ |
| Queues | AWS SQSΒ |
| Storage | AWS S3Β |
| Background Jobs | Trigger.devΒ |
| Mobile Builds | EASΒ |
Local Development Stack
Docker Compose provides these services locally:
| Service | Port | Purpose |
|---|---|---|
| MongoDB | 27017 | Database |
| LocalStack | 4566 | AWS services (SQS, SNS, S3) |
| OpenSearch | 9200 | Search engine |
Monorepo Structure
/cardnexus
βββ apps/
β βββ frontend/ # Next.js web app (port 4200)
β βββ backend/ # Express API server (port 3000)
β βββ mobile/ # React Native app
β βββ admin/ # Vite admin app
β βββ cli/ # oclif CLI tool
βββ packages/
β βββ api/ # oRPC handlers
β βββ api-dtos/ # oRPC contracts (schemas)
β βββ db/ # Mongoose models
β βββ ui/ # Shared UI components
β βββ ...We use WallabyJSΒ locally to speed up testing - highly recommended.
Last updated on