How congle99/e-commerce works
High-level components
a. Frontend
• Web client (React, Angular, Vue, or server-rendered templates)
• Mobile client (iOS/Android), if applicable
b. Backend/API
• API gateway or load balancer
• Microservices or a monolithic application (catalog, cart, checkout, orders, user management)
• Authentication/authorization service (OAuth, JWT)
c. Data stores
• Relational database (e.g., MySQL/PostgreSQL) for orders, users, products
• NoSQL store (e.g., Redis, MongoDB) for session data, shopping cart, caching
• Search engine (e.g., Elasticsearch) for product search
d. External services
• Payment gateway (Stripe, PayPal, Braintree)
• Email/SMS notification service (SendGrid, Twilio)
• CDN or object storage (AWS S3 + CloudFront) for static assets and images
e. Infrastructure & utilities
• Message broker or queue (RabbitMQ, Kafka) for asynchronous tasks (order confirmations, inventory updates)
• Monitoring/logging (Prometheus, Grafana, ELK stack)
• CI/CD pipeline for deployments
Relationships and interactions
• End-users interact with the frontend over HTTPS.
• The frontend calls the backend/API layer (REST or GraphQL).
• The API layer retrieves or updates data in the primary database or cache, sends tasks to queues, and invokes external services (payments, email).
• Background workers consume from queues, process long-running or asynchronous jobs (e.g., sending shipment notifications, recalculating inventory).
• A search index is kept in sync with product and catalog changes via event streams or change data capture.
• All static assets are served via CDN, reducing load on application servers.
Architectural patterns and design principles
• Separation of concerns: split catalog, cart, checkout, and user management into separate modules or services.
• API Gateway pattern: a single entry point to route requests to services and handle cross-cutting concerns (auth, rate limiting).
• Circuit breaker and retries when calling external services (payments, notifications).
• Event-driven design for decoupling: use message queues for asynchronous workflows.
• Caching layer in front of the database to improve read performance (e.g., Redis).