Skip to main content

Platform Architecture

The Ever Works Platform is organized as a Turborepo monorepo with pnpm workspaces.

Work Structure

ever-works/
├── apps/
│ ├── api/ # NestJS REST API (port 3100)
│ ├── web/ # Next.js admin dashboard (port 3000)
│ ├── cli/ # Standalone CLI (Commander.js + esbuild)
│ ├── internal-cli/ # Internal CLI (nest-commander)
│ ├── admin/ # Admin interface
│ ├── mcp/ # MCP (Model Context Protocol) server (port 3200)
│ └── docs/ # Docusaurus 3 documentation site (port 3000 dev)
├── docs/ # Markdown content rendered by apps/docs
├── packages/
│ ├── agent/ # Core business logic, plugins, pipeline, AI, database
│ ├── contracts/ # Shared TypeScript types
│ ├── plugin/ # Plugin SDK v1.0.0 (standalone, no NestJS deps)
│ ├── plugins/ # 39 plugins (AI, search, deploy, pipeline, prompt mgmt, etc.)
│ ├── monitoring/ # Sentry + PostHog integration
│ ├── tasks/ # Trigger.dev background jobs
│ └── cli-shared/ # Shared CLI utilities
├── .deploy/ # Dockerfiles & K8s manifests per app
├── compose.yaml # Docker Compose for the full stack
├── turbo.json # Turborepo pipeline configuration
├── pnpm-workspace.yaml # pnpm workspace definition
└── package.json # Root scripts and dev dependencies

API Modules

The NestJS API (apps/api/) is composed of the following modules, registered in api.module.ts:

ModuleDescription
AuthModuleJWT authentication, OAuth (GitHub, Google), registration, email verification
WorksModuleWork CRUD, AI generation, items, categories, tags, collections, import, scheduled updates, community PR processing
AiConversationModuleStateless streaming AI chat (NDJSON)
ScreenshotModuleProvider-agnostic screenshot capture
MailModuleEmail sending (SMTP, with provider abstraction)
SubscriptionsModuleSubscription plans, billing, usage tracking (Stripe)
NotificationsModuleUser notifications (in-app)
TriggerInternalModuleTrigger.dev webhook endpoints for background jobs
PluginsModulePlugin system — bootstrap, registry, lifecycle, settings, facades
TwentyCrmModuleTwenty CRM integration
MonitoringModuleSentry error tracking, PostHog analytics

Global guards and interceptors:

  • JwtAuthGuard — Protects all routes by default (opt out with @Public())
  • ThrottlerGuard — Rate limiting (3 tiers)
  • LoggingInterceptor, SentryInterceptor, PostHogInterceptor

@packages/agent

The @packages/agent package is the core shared library. It exports 21 subpackage entry points:

ExportPurpose
@packages/agent/generatorsData generation and processing
@packages/agent/items-generatorItem submission, DTOs, and schemas
@packages/agent/pipelinePipeline orchestrator service
@packages/agent/databaseTypeORM database configuration and connection
@packages/agent/entitiesAll TypeORM entity definitions
@packages/agent/dtoShared DTOs and validation
@packages/agent/gitGit operations (isomorphic-git, Octokit)
@packages/agent/work-operationsWork business logic
@packages/agent/importWork import from existing repos
@packages/agent/subscriptionsSubscription and billing logic
@packages/agent/notificationsNotification creation
@packages/agent/eventsEvent definitions and emitters
@packages/agent/tasksTrigger.dev task definitions
@packages/agent/cacheCaching (TypeORM-backed)
@packages/agent/configCentralized configuration
@packages/agent/servicesShared services
@packages/agent/pluginsPlugin bootstrap, registry, loader, settings, lifecycle
@packages/agent/community-prCommunity PR processing (discovery, AI extraction, data sync)
@packages/agent/comparison-generatorA vs B comparison generation
@packages/agent/facadesCapability facades (AI, Git, Search, Deploy, Screenshot, Content Extractor)
@packages/agent/utilsShared utility functions

Data Flow

Security

  • All API routes are protected by JWT authentication by default
  • Public endpoints are explicitly marked with @Public()
  • Rate limiting is applied globally with three tiers (see API Reference)
  • Helmet middleware for HTTP security headers
  • CORS configured via ALLOWED_ORIGINS environment variable
  • Input validation via class-validator DTOs with whitelist and forbidNonWhitelisted