← Back to engineering journal

What Building an E-Commerce App Taught Me.

Building an e-commerce application looked simple at first: products, cart, login and checkout. Then every feature started interacting with every other feature.

PROJECT PrinceStore
FRONTEND React + Vite
BACKEND Node + Express
DATABASE MySQL
STYLING Bootstrap
Live Project →

An e-commerce application is not really a shopping cart project. It is a state-management, authentication, database, API and business-logic project disguised as a shopping website.

When I started building PrinceStore, I initially thought about the interface. Product cards. Navbar. Hero section. Cart. Checkout.

But once the application started behaving like a real product, the difficult questions appeared.

What happens when a user logs out? What happens to the cart? What happens when a product is removed? What happens when an order is created?

FIELD NOTE 001

Building the interface is only one part of building an application. The real complexity appears when features interact.

01 / THE IDEA

It started as a normal e-commerce website.

The goal was simple: create a complete shopping experience where users could browse products, authenticate, manage a cart, maintain a wishlist and place orders.

But I didn't want another static shopping page.

I wanted the application to behave like an actual product.

PRODUCT FLOW PRINCESTORE
User
 ↓
Register / Login
 ↓
Browse Products
 ↓
Product Details
 ↓
Cart
 ↓
Wishlist
 ↓
Checkout
 ↓
Order
 ↓
Order Success
02 / ARCHITECTURE

The UI was only the beginning.

The application needed multiple layers.

01 / CLIENT React Vite · Components · Context
02 / SERVER Node + Express REST API · Auth · Orders
03 / DATA MySQL Users · Products · Orders

The frontend handled the user experience. The backend handled business logic and API requests. MySQL handled persistent application data.

Keeping those responsibilities separated made the application easier to reason about.

REQUEST FLOW FULL STACK
React
  ↓
Axios
  ↓
Express Route
  ↓
Controller / Logic
  ↓
MySQL
  ↓
JSON Response
  ↓
React State
  ↓
UI Update
03 / AUTHENTICATION

Login is not just a form.

A login screen looks simple. Email. Password. Button.

But authentication creates application state.

AUTH FLOW USER
Login Form
    ↓
POST /api/auth/login
    ↓
Backend Validation
    ↓
Database Check
    ↓
Authentication Result
    ↓
Frontend State
    ↓
Authenticated User

Once authentication exists, almost every other feature needs to understand who the current user is.

Cart. Wishlist. Orders. Profile. Logout.

That is why authentication is an application-wide concern, not just a login-page feature.

04 / PRODUCTS

Products are the center of the shopping experience.

The product system needed to support more than displaying a name and price.

PRODUCT MODEL MYSQL
products
──────────────
id
name
description
price
image
category
stock
created_at

The frontend could then request the products through an API.

API GET
GET /api/products

That separation meant the UI didn't need to know how the database stored the products.

05 / CART

The cart exposed the real state-management problem.

A cart seems simple until multiple pages need access to it.

Product page adds an item. Navbar shows cart count. Cart page changes quantity. Checkout reads cart contents.

Suddenly several components need access to the same state.

SHARED STATE REACT
CartContext
     │
     ├── Navbar
     │
     ├── ProductCard
     │
     ├── ProductDetails
     │
     ├── Cart
     │
     └── Checkout

This is where a shared context became useful.

Instead of passing cart data through multiple levels of components, the application could expose cart operations through a common context.

06 / WISHLIST

Then another state system appeared.

Wishlist functionality looked similar to the cart, but it represented a different concept.

A cart means: "I intend to purchase this."

A wishlist means: "I want to remember this."

APPLICATION STATE CONTEXTS
Application
    │
    ├── AuthContext
    │
    ├── CartContext
    │
    ├── WishlistContext
    │
    └── OrderContext

Separating these responsibilities kept the application logic easier to understand.

07 / ORDERS

Checkout is where everything finally meets.

Checkout was one of the most important parts of the application because it connected several systems.

CHECKOUT FLOW SYSTEM
Authenticated User
        ↓
Cart
        ↓
Address
        ↓
Order Data
        ↓
POST /api/orders
        ↓
Backend
        ↓
Database
        ↓
Order Created
        ↓
Success Page

This taught me something important: features should not be designed independently when they ultimately participate in the same business flow.

08 / ADMIN

Someone has to control the catalog.

A real store cannot depend on manually editing database rows every time a product changes.

That introduced an admin side.

ADMIN OPERATIONS CRUD
Create Product
       ↓
Read Products
       ↓
Update Product
       ↓
Delete Product

This was also a useful lesson in authorization.

Authentication answers: "Who are you?"

Authorization answers: "What are you allowed to do?"

09 / PROBLEMS

The bugs were more educational than the features.

01 Images weren't loading

The database contained product information but image references were not always being stored or resolved correctly.

02 Localhost stopped working

Production required changing API configuration, environment variables and deployment settings.

03 State became complicated

Cart, authentication, wishlist and orders all needed consistent state management.

04 The UI was not the hard part

Connecting the UI to reliable backend and database behavior was where most of the engineering work appeared.

10 / LESSONS

The biggest lesson was architecture.

Before this project, it was easy to think of features as isolated screens.

Login. Cart. Products. Checkout.

Building the entire flow changed that.

THINKING IN SYSTEMS FULL STACK
UI
 ↓
State
 ↓
API
 ↓
Business Logic
 ↓
Database
 ↓
Persistent Data

Every layer has a responsibility. Every layer can fail. And every layer needs to communicate clearly with the next one.

That is much closer to real software engineering than simply building pages.

11 / FINAL THOUGHT

The project became bigger than the shopping website.

I started with the idea of building an e-commerce website.

I ended up learning about:

WHAT I LEARNED ENGINEERING
React
State Management
Authentication
REST APIs
Express
MySQL
Database Design
CRUD
Authorization
Deployment
Debugging
Production Problems

The most valuable part wasn't the final UI.

It was understanding how all the pieces communicate.

A real application is not a collection of pages. It is a system.

FIELD NOTE / 001 Don't just build
another project.
Build something
that teaches you.
PREVIOUS ARTICLE ← I Don't Want a Pretty Portfolio ALL ARTICLES Back to Engineering Journal →

Have something
worth building?

Need a developer or want to discuss an interesting project? Let's build something useful.

Contact Prince →