How hiperhyped/hh_2 works
Project type and purpose
• This is a multi-platform full-stack Flutter application (“hh_2”) targeting mobile (Android, iOS), desktop (Windows, macOS, Linux) and web.
• It uses AWS Amplify for hosting, authentication and possibly data storage, and it also integrates with a custom PHP-based REST API (under the /api folder) for data operations.
Top-level file structure analysis
• lib/src contains the Flutter client code, organized into:
• config (AI, DB, XML, logging)
• models (business objects)
• services (utility functions)
• pages (UI screens/components)
• amplify/ holds AWS Amplify configuration and backend definitions (e.g., Cognito auth resources).
• api/ holds PHP scripts providing REST endpoints (login.php, search.php, DBService.php etc.)
• Platform folders: android/, ios/, web/, linux/, macos/, windows/ – autogenerated Flutter embedding code.
Key README insights
• Relies on Flutter’s standard multi-platform support and AWS Amplify.
Main components
a. Client (Flutter App)
– UI Layer: Flutter Widgets in lib/src/pages
– Business Logic & Data Layer: lib/src/services, lib/src/config (DB service, AI service, logging)
– Models: data classes in lib/src/models
b. AWS Amplify Backend
– Authentication (Cognito User Pool) from amplify/backend/auth
– Other Amplify services (e.g., S3, AppSync) if configured
c. Custom PHP API Server
– REST endpoints in /api
– Database access logic (DBService.php, DBUser.php, etc.)
d. Database
– Underlying RDBMS (MySQL, PostgreSQL) behind PHP scripts
e. External Services
– AI services (third-party or internal via lib/src/config/ai)
– AWS S3 for image storage (XML and S3 config under lib/src/config/xml)
Relationships and data flows
• User actions in the Flutter UI invoke methods in the services layer (e.g., db_service, ai_service).
• The services layer issues HTTP requests:
• To AWS Amplify (Cognito) for authentication and token management
• To PHP API endpoints for CRUD operations
• PHP API scripts interact with the database and return JSON payloads.
• Flutter parses JSON into Models and updates the UI.
• AI configuration modules may call external AI endpoints (e.g., OpenAI).
Architectural patterns and design principles
• Layered architecture in the Flutter client: UI → Services → API/DB → Models
• Separation of concerns:
• Amplify handles auth and cloud infra
• PHP API handles legacy data access and business rules
• Config-driven modules in lib/src/config for easy swapping of implementations (e.g., AI engines)
Essential elements checklist
• Clear component names (e.g., “Flutter UI”, “Cognito Auth”, “PHP REST API”)
• Arrowheads indicating request and response flows
• Annotations for major protocols and data formats (JSON over HTTPS, AWS SDK)