pie-doc

Pie: A Scalable and Modern Multi-Vendor eCommerce Platform

Here’s a breakdown of 10 key tasks for the development roadmap:

Task 1: User Authentication & Authorization System

Implement the core user system with role-based access control for Customers, Sellers, and Admins. This includes:

Task 2: Product Catalog Management

Build the product management system allowing sellers to:

Task 3: Shop Management System

Create the shop management functionality:

Task 4: Shopping Cart & Checkout Flow

Develop the core shopping experience:

Task 5: Order Processing System

Implement the order lifecycle management:

Task 6: Payment Integration

Set up the payment processing system:

Task 7: Admin Dashboard & Management Tools

Build the administrative interface:

Task 8: API Documentation & Testing

Create comprehensive documentation and testing:

Task 9: Deployment & DevOps Setup

Set up your deployment pipeline:

Task 10: Caching & Performance Optimization

Implement caching and optimize performance:

Project Overview

Welcome to Pie, an innovative multi-vendor eCommerce platform designed to simplify business and management operations. Firstly I will go with MVP which will meet the minimum requirements to run our initial business, which means I am prioritising the user fetching feature and the manager roll feature that will be developed first. Here I am planning version (v1) requirements.

System Design

The system should meet the following requirements:

Functional requirements

I will design the system for five diffrent role Customer, Seller, Admin

Customers

Seller

Admin

Non-Functional requirements

Extended requirements

Estimation and Constraints

Let’s start with the estimation and constraints.

Traffic

Let us assume we have 10K daily active users (DAU). If on average each user performs 10 actions (such as request a check available product, addtoCart, checkout, etc.) we will have to handle 100K requests daily.

\[10,000 \times 10 \space actions = 100,000 \space /day\]

What would be Requests Per Second (RPS) for our system?

100000 requests per day translate into 1.2 requests per second.

\[\frac{100,000 \space}{(24 \space hrs \times 3600 \space seconds)} = \sim 1.2 \space requests/second\]

Storage

If we assume each user comsume on average is 400 bytes, we will require about 0.04 GB of database storage every day.

\[100,000 \space \times 400 \space bytes = \sim 0.04 \space GB/day\]

And for 10 years, we will require about 146 GB of storage.

\[0.04 \space GB \times 10 \space years \times 365 \space days = \sim 146 \space GB\]

Bandwidth

As our system is handling 0.04 GB of ingress every day, we will require a minimum bandwidth of around 0.46 KB per second.

\[\frac{0.04 \space GB}{(24 \space hrs \times 3600 \space seconds)} = \sim 0.46 \space KB/second\]

High-level estimate

Here is our high-level estimate:

Type Estimate
Daily active users (DAU) 10,000
Requests per second (RPS) 1.2/s
Storage (per day) ~0.04 GB
Storage (10 years) ~146 GB
Bandwidth ~0.46 KB/s

Data Model Design

This is the general data model which reflects our requirements.

ERD

We have the following tables:

User

Stores core user data.

Customer

Holds customer-specific details.

Seller

Stores seller-specific details.

Contact

Manages multiple contact numbers for a user.

Address

Stores multiple addresses for customers, sellers, and shops.

Shop

Stores shop details.

Product

Stores product information.

Image

Manages all images dynamically for products, shops, categories, and more.

Category

Manages product categories, supporting hierarchy.

Orders

Tracks all customer orders.

What kind of database should we use?

We are developing a monolithic application, and we will use a single PostgreSQL database to store all of our data. While our data model is quite relational, keeping everything in one database is suitable for our current architecture. This allows us to leverage PostgreSQL’s powerful relational capabilities, including complex queries, transactions, and referential integrity, which are critical for our application.

Despite using a monolithic architecture, we can still ensure scalability and maintainability by organizing the database schema in a way that logically separates concerns. We will define clear ownership of tables and ensure that the application components interact with the database in a modular and efficient way. This approach enables us to take full advantage of PostgreSQL’s features while avoiding the complexity of managing multiple databases.

High-level design

Now let us do a high-level design of our system.

We will be using Monolith architecure while we are building the MVP. According to demand we will scale it horizontally and If it reach to limitations we will consider to build to microservice.

How is the service expected to work?

Our service operates as follows:

1️⃣ Customer Experience

2️⃣ Seller Responsibilities

3️⃣ Admin Supervision

Payments

Handling payments at scale is challenging, to simplify our system we can use a third-party payment processor like Razorpay, Stripe or SSLCommerz. Once the payment is complete, the payment processor will redirect the user back to our application and we can set up a webhook to capture all the payment-related data.

Notifications

We will send notifications through our server in future.

Identify and resolve bottlenecks

Let us identify and resolve bottlenecks such as single points of failure in our design:

To make our system more resilient we can do the following: (V2)

Technology Stack