How erd-codegen/ts-node-knex works
Main Components
a. Client Layer:
• External API consumers
• Swagger/OpenAPI documentation interface (visible from the /api-doc endpoint)
b. API Gateway Layer:
• AWS API Gateway (as mentioned in the serverless deployment)
• Lambda Functions integration points
c. Application Services Layer (Microservices):
• User Service (/apps/user)
• Article Service (/apps/article)
• App Service (/apps/app) - Documentation and health checks
d. Core Layer (/packages/core):
• Authentication Service
• User Service
• Article Service
• Repository Layer
• Database Access Layer
e. Database Layer:
• MySQL Database (using Knex.js as ORM)
• Database Tables:
• Users
• Articles
• Comments
• Tags
• User Follows
• Article Favorites
Architectural Patterns to Highlight
a. Microservices Architecture:
• Clear boundaries between user, article, and app services
• Independent deployment capabilities
b. Clean Architecture:
• Controllers
• Services
• Repositories
• Database Access
• DTOs for data transformation
c. Infrastructure Components:
• AWS Lambda functions
• API Gateway configuration
• CDK deployment stack
Database Layer
Use these visual elements:
• Blue: External interfaces
• Green: Application services
• Yellow: Core services
• Red: Database layer
• Gray: Infrastructure components
• Rectangles: Services and components
• Hexagons: Lambda functions
Key Relationships
• Authentication flow between services
• Article creation and management flow
• User management and following relationships
• Comment and favorite functionality
• Tag management system
Additional Elements
• Error handling flow
• Middleware pipeline
• Configuration management
• Logging system
• Testing infrastructure
Infrastructure Details
• AWS deployment architecture
• Docker container relationships
• Development vs Production environments
Remember to highlight the serverless nature of the deployment and how it integrates with AWS services, as this is a key architectural feature of the system.