跳转到内容

Project Structure

此内容尚不支持你的语言。

Product Factory is a pnpm monorepo managed with Turborepo. The codebase is organized into three top-level directories: apps/ for deployable applications, packages/ for shared libraries, and docs/ for internal engineering documentation.

Directory Layout

├── apps/
│ ├── web/ # Marketing site + blog + user dashboard
│ ├── admin/ # Admin console
│ ├── platform/ # Platform workspace (future)
│ ├── docs/ # Documentation site (Starlight)
│ ├── worker-gateway/ # API gateway (Hono + Cloudflare Workers)
│ ├── worker-auth/ # Authentication service
│ ├── worker-billing/ # Billing and credits service
│ ├── worker-ai/ # AI service (provider management, chat, completions)
│ ├── worker-content/ # Content management service
│ ├── worker-support/ # Support ticket service
│ └── worker-admin/ # Admin backend service
├── packages/
│ ├── shared-types/ # Zod schemas, API contracts, type definitions
│ ├── app-utils/ # Shared middleware, API helpers, auth utilities
│ ├── ui/ # React + Radix UI component library
│ ├── auth-core/ # Legacy auth package kept only for old tests/reference
│ ├── billing-core/ # Billing repository and domain logic
│ ├── ai-core/ # AI provider/model repository and gateway client
│ ├── content-core/ # Content repository and domain logic
│ ├── support-core/ # Support ticket repository and domain logic
│ ├── project-core/ # Project/app-key management
│ ├── email-templates/ # React Email templates
│ └── db-schema/ # Drizzle ORM table definitions and database factory
├── docs/ # Internal engineering docs (specs, plans)
└── turbo.json # Turborepo pipeline configuration

Apps

Frontend Apps

AppPortPurpose
web4322Marketing pages, blog, user dashboard, login/register
admin4321Admin console for managing all platform resources
docs4323Product documentation (this site)

All frontend apps use Astro 5 with React Islands for interactive components.

Worker Services

WorkerPurposeDatabase
worker-gatewayAPI gateway, session verification, request routingNo dedicated D1 database
worker-authBetter Auth handler, user profilesauth-db
worker-billingCredits, subscriptions, orders, checkoutbilling-db
worker-aiAI provider management, chat, completions, usageai-db
worker-contentBlog posts, banners, friend linkscontent-db
worker-supportSupport tickets, messages, notificationssupport-db
worker-adminProject management, user management, logsadmin-db

All workers use Hono as the HTTP framework and Cloudflare D1 for data storage via Drizzle ORM.

Packages

Shared packages follow the @repo/<name> naming convention and are linked via pnpm workspaces.

PackagePurpose
shared-typesZod schemas for API validation, TypeScript types, shared constants
app-utilsMiddleware (auth, CORS, rate limiting), API client helpers, Turnstile verification
uiReact component library built on Radix UI primitives with Tailwind CSS
db-schemaDrizzle ORM table definitions, createDb() factory, test helpers
auth-coreLegacy package only; runtime auth lives in worker-auth + Better Auth
billing-coreCredits, subscriptions, orders, pricing plan repositories
ai-coreAI provider, model, API key, usage repositories
content-coreBlog post, banner, friend link repositories
support-coreTicket, message, notification repositories
project-coreProject and app-key management
email-templatesReact Email templates for transactional emails

Build System

Turborepo manages the build pipeline. Key commands:

CommandDescription
pnpm devStart all apps and workers in development mode
pnpm buildBuild all packages and apps
pnpm testRun all test suites
pnpm typecheckType-check all packages and apps
pnpm lintRun Biome linting and formatting checks