3.6 KiB
3.6 KiB
Product Direction
- The core product is a personal-brand platform whose primary goal is to build trust and convert that trust into qualified inquiries or collaborations.
- Personal-brand identity, positioning, proof of work, communication expectations, and contact paths are higher priority than any single industry workflow.
- Industry behavior is implemented as replaceable templates. Food, consulting, design, photography, and future industries must not hard-code their terminology or fields into the shared brand model or shared UI.
- The food template is supported, but it is an example template rather than the product definition.
- Backend configuration is the source of truth for brand content, services, template selection, trust-building content, and industry-specific fields. The mini program only renders configuration and submits user input.
- Any delivered backend endpoint must have an automated test covering its authorization and successful behavior before it is considered complete.
- Keep personal-brand trust details explicit: biography, positioning, credentials, portfolio/proof, process, expectations, availability, contact methods, and clear follow-up status.
Engineering Architecture Rules
Backend boundaries
- NestJS controllers only handle transport concerns: authentication, DTO binding, status codes, and response shape.
- Domain behavior belongs in services; Prisma access must not be duplicated across controllers.
- DTOs are the runtime validation boundary. Do not use
Partial<T>or plain TypeScript interfaces as request bodies for validated endpoints. - Every protected endpoint must test missing credentials, invalid credentials or wrong role, and the successful authorized path.
- Public endpoints may only expose published content and must enforce brand isolation through the configured brand identifier.
Admin frontend boundaries
- React pages must be split by feature under
apps/admin/src/features/<feature>/; a page component should coordinate UI, not contain the entire application. - Shared API construction, authentication-aware
fetch, query keys, and error handling belong underapps/admin/src/lib/. - Shared visual elements belong under
apps/admin/src/components/; feature-specific forms and tables stay inside their feature module. - Routing belongs in
apps/admin/src/app/and navigation must use React Router. Do not use a local state variable as the primary page router. - A mutation must close or reset a form only after
onSuccess; failed requests must preserve user input and show an actionable error. - API base URLs must come from
VITE_API_BASE_URLwith a documented local fallback; no feature may hard-code an environment-specific host. - Admin session expiry must clear the token, notify the user, and return to the login screen consistently.
Formatting, testing, and delivery
- Prettier is the formatting source of truth. New or changed files must pass
pnpm format:check. - Before delivery, run relevant type checks, API integration tests, and frontend production builds. Do not claim an endpoint is delivered without a passing automated test.
- Prefer cohesive commits that complete a reviewable unit of work; do not submit speculative fragments while the feature is broken.
- When a code review identifies a recurring design issue, update this file or a focused architecture document before implementing the next related feature.
Codex Code Guidelines
中文回复
- 所有回复使用简体中文。
- 技术术语保留 English,首次出现可添加中文解释。
- 代码变量名保持 English,注释使用中文。
Git Commit
- 使用中文提交信息。
- 格式:
类型: 简短描述。