| name | project-architecture |
| description | BuildingAI monorepo project structure and architecture guide. Use when AI needs to understand project organization, locate files, understand package relationships, find where specific functionality is implemented, or navigate the codebase structure. Essential for any development task that requires understanding the project layout, import patterns, module organization, or cross-package dependencies. |
BuildingAI Project Architecture
Comprehensive guide to BuildingAI monorepo structure, packages, and development patterns.
When to Use
Use this skill when you need to:
- Locate where specific functionality is implemented
- Understand package relationships and dependencies
- Find the correct import paths and patterns
- Navigate module organization and structure
- Understand development patterns and conventions
- Know what each package provides and how to use it
Instructions
Understanding the Monorepo Structure
The BuildingAI project is a pnpm workspace monorepo with the following structure:
buildingai/
āāā packages/
ā āāā @buildingai/ # Shared packages
ā ā āāā ai-sdk/ # AI SDK (legacy)
ā ā āāā ai-sdk-new/ # AI SDK (Vercel AI SDK 6.x)
ā ā āāā base/ # BaseController, BaseService
ā ā āāā cache/ # CacheService, RedisService
ā ā āāā config/ # Configuration management
ā ā āāā constants/ # Shared constants
ā ā āāā db/ # TypeORM, entities, migrations
ā ā āāā decorators/ # Custom decorators
ā ā āāā di/ # Dependency injection utilities
ā ā āāā dict/ # Dictionary/configuration management
ā ā āāā dto/ # Shared DTOs
ā ā āāā errors/ # HttpErrorFactory
ā ā āāā eslint-config/ # ESLint configuration
ā ā āāā extension-sdk/ # Extension development SDK
ā ā āāā logger/ # Logging utilities
ā ā āāā pipe/ # Validation pipes
ā ā āāā types/ # TypeScript type definitions
ā ā āāā typescript-config/ # TypeScript configurations
ā ā āāā upgrade/ # Version upgrade scripts
ā ā āāā utils/ # Utility functions, HTTP client
ā ā āāā web/ # Frontend shared packages
ā ā ā āāā hooks/ # React hooks
ā ā ā āāā http/ # HTTP client
ā ā ā āāā services/ # Frontend services
ā ā ā āāā stores/ # State management (Pinia)
ā ā ā āāā types/ # TypeScript types
ā ā ā āāā ui/ # UI components
ā ā āāā di/ # Dependency injection utilities
ā ā āāā wechat-sdk/ # WeChat integration SDK
ā āāā api/ # Main NestJS API application
ā āāā core/ # Reusable business logic modules
ā āāā cli/ # CLI tooling
ā āāā client/ # Desktop client (Tauri + React)
āāā skills/ # AI skills for development guidance
āāā extensions/ # Plugin extensions (runtime loaded)
āāā public/ # Static web assets
āāā scripts/ # Build and utility scripts
Using Reference Files
For detailed information about each package, consult the corresponding reference file in
references/:
@buildingai Packages:
references/base.md - BaseController, BaseService
references/cache.md - CacheService, RedisService
references/config.md - Configuration management
references/constants.md - Shared constants
references/db.md - Database layer (TypeORM, entities)
references/decorators.md - Custom decorators
references/dict.md - Dictionary management
references/dto.md - Shared DTOs
references/errors.md - Error handling
references/logger.md - Logging utilities
references/utils.md - Utility functions, HTTP client
references/ai-sdk.md - AI SDK packages
references/web.md - Frontend packages
references/extension-sdk.md - Extension SDK
references/pipe.md - Validation pipes
references/types.md - TypeScript types
references/upgrade.md - Version upgrade scripts
references/di.md - Dependency injection utilities
references/wechat-sdk.md - WeChat integration SDK
Main Packages:
references/api.md - Main NestJS API application
references/core.md - Reusable business logic
references/cli.md - CLI tooling
references/client.md - Desktop client
Load these reference files when you need detailed information about a specific package's exports,
usage patterns, or implementation details.
Import Patterns
Backend (API/Core) Import Order:
@buildingai/* packages
@nestjs/* packages
@common/* (API only)
@modules/* (API only)
@core/* (API only)
- Third-party packages
- Relative paths
Path Aliases (API):
@common/* ā src/common/*
@modules/* ā src/modules/*
@core/* ā src/core/*
@assets/* ā src/assets/*
Development Patterns
Service Pattern:
- Extend
BaseService<Entity> from @buildingai/base for CRUD operations
- Use dependency injection with
@InjectRepository() for repositories
- See
references/base.md for available methods and features
Controller Pattern:
- Use
@ConsoleController(path, groupName) for admin APIs (auto auth + permissions)
- Use
@WebController(path) for frontend APIs (requires auth by default)
- Use
@Playground() decorator to get current user
- See
references/decorators.md and references/api.md for details
**Module Structure: src/modules/{module-name}/ with controllers, services, and DTOs
Quick Navigation
When implementing features, reference the appropriate package:
- Authentication:
references/decorators.md (@Playground()), references/api.md (guards)
- Database:
references/db.md (entities), references/base.md (BaseService CRUD)
- Error Handling:
references/errors.md (HttpErrorFactory)
- Caching:
references/cache.md (CacheService, RedisService)
- File Upload:
references/core.md (upload services)
- AI Functionality:
references/ai-sdk.md, references/api.md (AI modules)
- Frontend:
references/web.md (services, stores, UI components)
Skills Integration
This skill works with other skills:
postgresql-table-design - For database schema design
frontend-design - For frontend UI development
ai-sdk - For AI functionality implementation
When implementing features, reference the appropriate package reference file to understand what's
available and how to use it.