How code100x/dpin-uptime works
1. Repository shape
- This is a Turborepo monorepo with multiple runnable apps and shared packages.
- The main top-level boundary is between apps/* for deployable services and packages/* for reusable libraries/config.
2. Primary user-facing app: apps/frontend
- A Next.js App Router application (app/ directory) with a dashboard route and root page.
- It has its own components/, hooks/, lib/, global styles, and theme provider.
- hooks/useWebsites.tsx suggests the UI consumes website-related data, likely from the API layer.
- This is the main presentation layer in the system.
3. Backend API: apps/api
- A separate TypeScript service with index.ts, middleware.ts, config.ts, and types.d.ts.
- The presence of middleware and config indicates an HTTP API/service boundary rather than a UI app.
- It is the likely integration point for the frontend and the internal service layer.
4. Internal services/workers: apps/hub and apps/validator
- These are standalone TypeScript executables with their own package configs and entrypoints.
- From names alone, hub looks like a coordination/orchestration service, and validator looks like a validation/verification worker or service.
- Their exact responsibilities are not visible here, but architecturally they are separate backend boundaries from the API and frontend.
5. Persistence layer: packages/db
- This package contains a full Prisma schema, migrations, and seed script.
- That makes it the repo’s database abstraction and schema source of truth.
- The migration history shows the data model has evolved around features like disabled and payout, which are likely important domain concepts.
6. Shared domain/utilities: packages/common
- A small shared package for code reused across apps.
- In a diagram, this should sit as a shared library dependency feeding multiple services, not as a runtime service.
7. Shared UI library: packages/ui
- A reusable React component package with components like button, card, and code.
- This is distinct from apps/frontend/components, which are app-specific pieces.
- It’s the design-system boundary for shared presentation primitives.
8. Shared configuration packages
- packages/eslint-config centralizes lint rules across the repo.
- packages/typescript-config centralizes TS compiler settings for base, React library, and Next.js targets.
- These are build-time and developer-experience dependencies, not runtime services.
9. Frontend composition vs shared components
- The frontend mixes local app components (apps/frontend/components/Appbar.tsx, theme-provider.tsx) with shared UI primitives from packages/ui.
- This indicates a layered UI architecture: app-specific layout/navigation on top of reusable design components.
10. Data flow you should draw
- The most likely runtime flow is browser → Next.js frontend → API service → database.
- hub and validator likely participate in internal processing or validation around the same domain data, probably using the shared common and db packages.
- packages/db is the persistence boundary; the API and backend services are the consumers of that layer.
11. Build and execution model
- Turborepo coordinates builds, dev tasks, and caching across apps/packages.
- The repo is TypeScript-first across the board.
- The architecture is therefore a modular monorepo with separate deployables and shared libraries, rather than a single app with internal folders.
12. What is most important for an architecture diagram
- Show four deployable app nodes: frontend, api, hub, validator.
- Show shared libraries beneath them: common, db/Prisma, ui, plus config packages.
- Emphasize that db is a shared persistence module, ui is a reusable presentation module, and common is cross-cutting domain code.
- Treat hub and validator as backend components with distinct responsibilities, even though their implementation details are not visible from the tree.
Main entry points: frontend Frontend · turbo.json Turborepo · db Database · api API
Components 16
Apps
Deployable services and user-facing application
- Frontend · Main dashboard and presentation layer
apps/frontend - App routes · Root page and dashboard routes
apps/frontend/app - App UI · Layout, theme, and app-specific UI pieces
apps/frontend/components - Data hooks · Frontend data access and UI state hooks
apps/frontend/hooks - API · Backend API boundary for app and service clients
apps/api - Hub · Standalone backend coordination service
apps/hub - Validator · Standalone validation and verification service
apps/validator
Packages
Shared libraries, persistence, and tooling
- Common · Cross-cutting reusable code shared by services
packages/common - Database · Database schema, migrations, and seed data
packages/db - Prisma schema · Source of truth for the data model
packages/db/prisma/schema.prisma - Migrations · Database evolution and applied migration history
packages/db/prisma/migrations - UI kit · Shared presentation primitives for multiple apps
packages/ui - Primitives · Reusable button, card, and code components
packages/ui/src - ESLint config · Shared lint rules for the monorepo
packages/eslint-config - TS config · Shared TypeScript presets for base, React, and Next.js
packages/typescript-config
Other components
- Turborepo · Monorepo task runner and cache coordinator
turbo.json
Connections 27
- Turborepo → Frontend: builds · Coordinates tasks for the frontend app
- Turborepo → API: builds · Coordinates tasks for the API service
- Turborepo → Hub: builds · Coordinates tasks for the hub service
- Turborepo → Validator: builds · Coordinates tasks for the validator service
- Turborepo → Common: builds · Coordinates shared package tasks
- Turborepo → Database: builds · Coordinates database package tasks
- Frontend → App routes: contains · Next.js App Router pages and routes
- Frontend → App UI: contains · App-specific layout and theme components
- Frontend → Data hooks: contains · Client-side data hooks
- Frontend → UI kit: uses · Builds on shared UI primitives
- Frontend → API: calls · Fetches domain data from the backend API
- API → Database: reads/writes · Persists domain data through the database layer
- API → Common: uses · Shares domain code and utilities
- Hub → Common: uses · Shares domain code and utilities
- Hub → Database: uses · Coordinates work against the shared data model
- Validator → Common: uses · Shares domain code and utilities
- Validator → Database: uses · Validates against the shared data model
- Database → Prisma schema: defines · Prisma schema defines the data model
- Database → Migrations: evolves · Migration history tracks schema changes
- App UI → UI kit: wraps · App-specific components compose shared primitives
- Frontend → ESLint config: inherits · Uses shared lint configuration
- Frontend → TS config: inherits · Uses shared TypeScript configuration
- API → TS config: inherits · Uses shared TypeScript configuration
- Hub → TS config: inherits · Uses shared TypeScript configuration
- Validator → TS config: inherits · Uses shared TypeScript configuration
- UI kit → ESLint config: inherits · Uses shared lint configuration
- UI kit → TS config: inherits · Uses shared TypeScript configuration