How pauljackways/petitionsite works
Main Components
a) Client Layer:
• External clients (Postman, Web Browsers) making HTTP requests
• Note about CORS middleware handling
b) API Gateway Layer:
• Express.js server (entry point: src/server.ts)
• Route handlers (src/app/routes)
• Authentication/Session management (src/app/services/session.ts)
c) Controller Layer:
• Separate controllers for different entities:
• Petition Controller
• User Controller
• Image Controllers (User/Petition)
• Support Tier Controller
• Supporter Controller
• Backdoor Controller (for testing)
d) Service Layer:
• Password handling (passwords.ts)
• Validation service (validation.ts)
• Session management (session.ts)
e) Model Layer:
• Database models for:
• Users
• Petitions
• Images
• Support Tiers
• Supporters
f) Storage Layer:
• MySQL Database (configured in src/config/db.ts)
• File Storage System (for images in storage/images)
Relationship Flows to Illustrate
• File storage flow for images
• Authentication/authorization flows
• Demonstrate how the validation service interacts with controllers
Specific Design Elements
Use these visual elements:
• Blue rectangles for primary services
• Green diamonds for controllers
• Red hexagons for middleware/security components
Important Architectural Aspects to Highlight
a) Security Layer:
• Session management
• Password handling
• Authorization checks
b) Data Management:
• MySQL database connections
• Image file handling
• Database schemas (from create_database.sql)
c) API Structure:
• RESTful endpoints (defined in api_spec.yaml)
• Status code handling (200, 201, 400, 401, 403, 500, 501)
Implementation Details to Note
• Configuration management (env variables, database config)
• TypeScript usage throughout the application
• Testing/development tools (Postman collections)
Additional Notes
• Keep the main flow clear and centered
• Related components together
• Clear separation between layers
• Notes about scalability points
• Potential extension points
Remember to emphasize:
• The RESTful nature of the API
• The separation of concerns (controllers, models, services)
• The dual storage system (DB + file storage)
• The security and validation layers
This will provide a comprehensive view of the system while maintaining clarity and usefulness for development and maintenance purposes.