How tharshen2124/strayos-backend works
Main Components
A. API Layer
• Two main controller groups:
• Stray Pets Controller
• User Controller (with both Google OAuth and Legacy Auth)
B. Middleware Layer
• Auth Middleware as a security layer between API requests and controllers
C. Business Logic Layer
• Models component showing the data structures
• Utils component containing shared utilities:
• JWT handling
• Password hashing
• Error handling
• Response formatting
• Environment configuration
• Input validation
D. External Services Integration
• Cloudinary SDK integration for (likely) image handling
• Google OAuth service connection
E. Database Layer
• Database connection and management
F. Logging System
• Custom logging implementation with styles and variants
[Client Requests]
• ↓
[API Gateway]
• ↓
[Auth Middleware]
• ↓
[Controllers Layer]
• ↓
[Business Logic Layer]
• ↓
[Database Layer]
Specific Implementation Details
A. External Clients → API Gateway
• Supported HTTP methods
• Authentication requirements
B. API Gateway → Controllers
• Split into two main paths:
• Stray Pets management flow
• User authentication flow (both Google and Legacy)
C. Controllers → Models
• Data flow between controllers and models
• CRUD operations
D. Models → Database
• Database operations
• ORM or query patterns
E. Cross-cutting Concerns
• How logging intersects with all layers
• Demonstrate error handling flow
• Middleware intervention points
Important Elements to Highlight
A. Authentication Flow:
• Both Google OAuth and Legacy auth paths
• JWT token generation and validation
• Demonstrate middleware authentication checks
B. Data Flow:
• Request/Response cycle
• Error handling paths
• Logging points
C. External Service Integration:
• Cloudinary interaction for media handling
• Google OAuth service communication
Technical Stack Indicators
• Go runtime environment
• Database system (based on connection.go)
• JWT for authentication
• Cloudinary for media management
• Google OAuth for authentication
• Custom logging system
• The system's overall architecture
• Authentication and authorization flow
• Data flow between components
• Integration points with external services
• Cross-cutting concerns like logging and error handling