Another evening, another round of Chai and Fries at pathan’s hotel, and my friend and I were back at it. This time, diving deeper into the nuts and bolts of architecture for his e-commerce company.
As we discussed the data model, it became clear that every layer of this system would be shaped by how we organize and structure data. The big question was:
- How many APIs do we need?
- What should the API responses look like?
- And, of course, what data types should we use to ensure efficiency and compatibility?
During this discussion, chai walay bhai came and said “Abhi 2 baja hai, 3 bajay hum kursi lailaiga, apna ghar jao” 😢
We looked at him innocently and came back to our topic, and started mapping out some key areas.
- Catalog APIs for fetching product details and categories.
- User APIs for authentication, profile management, and order history.
- Cart and Checkout APIs to ensure seamless transactions.
From there, the conversation shifted to API communication protocols. Should we stick with the tried-and-tested or lean into modern innovations? Here’s how we broke it down.
GraphQL:
A modern, flexible API that pulls only the data you need.
Perfect for dynamic stores, although latency and connection timeouts could pose challenges.
WebSockets:
Ideal for bidirectional communication, like real-time notifications or stock updates. But harder to scale and load balance effectively.
REST APIs:
Reliable and straightforward in our case.
Each option came with its pros and cons, and we had to balance scalability, performance, and simplicity. It’s fascinating how these decisions are never just technical, they’re about anticipating the needs of users and the business.
It’s almost 3:15 AM, and we saw Pathan bhai marching toward us, and my friend suddenly asked “pathan bhai, 1 chai or miljaigi?” and he replied “makhol na karo, apna ghar me ja ke peo” 😥
We realized we already drink 4 cups each and were just scratching the surface of the technicalities. We both thank pathan bhai leave.