How aathithiya-d/bookstagram works
Main Architectural Layers
• User-facing layer: React_Frontend
• Edge layer: API Gateway (apigateway)
• Service Discovery: Naming Server (namingserver)
• Microservices layer:
• Core monolith or composite service (Spring_Backend)
• Dedicated microservice for books (ms)
• Data layer: MySQL database(s)
Out Components and Responsibilities
a. React_Frontend
• Components: pages, admin & user UI, data fetching via axios/User.js
• Static assets: public/
• State & routing: react-router + Tailwind CSS
b. Naming Server (Eureka style)
• Registers all services at startup
• Enables service lookup by API Gateway and other services
c. API Gateway
• Single entry point for all client requests
• Routes to AuthenticationController, BookController, ChatController, etc., in Spring_Backend or to /ms endpoints
• Applies cross-cutting concerns: CORS, rate limiting, auth token forwarding
d. Core Backend Service (Spring_Backend)
• Handles user accounts, authentication (JWT), profiles, chat, communities, reviews, bookshelves
• Layers inside:
• Controllers (AuthenticationController, UserController, …)
• Services + impl (AuthServiceImpl, UserServiceImpl, …)
• Repositories (JpaRepository interfaces)
• DTOs, Models, Util (JwtUtil)
• Reads configuration (application.properties), connects to MySQL
e. Book Microservice (ms)
• Single responsibility: book catalog, inventory counts
• Own controllers, services, repos
• Independent deployment, own database schema or shared MySQL
f. Database(s)
• A single or multiple MySQL instances
• Schema separation per service (Spring_Backend vs. ms)
Interactions & Data Flows
• User’s browser → React_Frontend
• React HTTP calls → API Gateway (routes on /api/auth, /api/books, /ms/books, etc.)
• API Gateway → Service Discovery → appropriate service instance
• Services → read/write to MySQL
• Services communicate internally if needed (e.g., Spring_Backend calls ms for book details) via REST
Architectural Patterns
• Microservices with Service Discovery (Eureka style)
• API Gateway pattern for request routing and edge security
• Layered backend: Controller → Service → Repository
• JWT-based stateless authentication
• React single-page application as client
Detailed Elements to Capture
• React components → Axios calls to /api endpoints
• JWT token flow: login → receive token → attach to subsequent requests
• Discovery registration on service startup
• Gateway routing table (e.g., /auth → Spring_Backend, /ms/books → ms)
• Communication paths for chat and community features
Putting It All Together
[Browser: React_Frontend]
↓ HTTPS
[API Gateway] ←→ [Naming Server]
↓ ↓
┌────────────┐┌─────────────┐
│ Spring_ ││ BookService │
│ Backend ││ (ms) │
└────────────┘└─────────────┘
↓ ↓
[MySQL Database(s)]