Database
Database-per-service model
The current repository uses a separate MySQL schema per service.
Schemas created by docker/mysql/init.sql
bookstore_auth_dbbookstore_user_dbbookstore_books_dbbookstore_order_dbbookstore_notification_dbbookstore_payment_db
Additional schema referenced in code
bookstore_analytics_db
This analytics schema is referenced by analytics-service, but not created in docker/mysql/init.sql.
Important tables
| Service | Tables |
|---|---|
| auth-service | auth_users, refresh_tokens |
| user-service | users |
| book-service | books, authors, categories, publishers, book_images, book_authors |
| order-service | orders, order_items |
| payment-service | payments, payment_items |
| notification-service | notifications |
| analytics-service | daily_metrics, book_sales, pending_order_items, processed_events |
Transaction strategy
order-servicepersists orders and publishes events after commitpayment-servicepersists payment state around Stripe interaction and then publishes outcome eventsanalytics-serviceuses deduplication rather than distributed transactions