Decision 01
Where should permissions be enforced?
- →
The choice
Role-based access in the API, using Django auth.
- →
What it gave
A customer cannot reach staff actions, whatever client they use.
08 / Backend
Products, carts and orders as a REST API, with roles, validation and a properly normalised schema.
E-Commerce API / Backend / 2024
02 / Overview
REST APIs for product, cart and order management with input validation and clean JSON responses. Authentication and role-based access control use Django's built-in auth system, on top of a normalised MySQL schema with ORM logic for stock updates and order totals.
E-Commerce API / how the parts connect
03 / The problem
An e-commerce backend has to keep stock, carts and orders consistent, reject bad input, and make sure customers cannot do what only staff should. Those rules belong in the API and the schema, not in each screen.
04 / How it works
A client calls a product, cart or order endpoint.
Input is checked; bad requests get a clear JSON error.
Django auth and roles decide what the caller may do.
The ORM updates stock and totals in a normalised MySQL schema.
05 / Key decisions
Decision 01
Role-based access in the API, using Django auth.
A customer cannot reach staff actions, whatever client they use.
Decision 02
A normalised MySQL schema with ORM logic.
Stock updates and order totals stay consistent.
06 / The flow
What it looks like from the side of the person using it — the path through E-Commerce API in 4 steps.
E-Commerce API / user flow
07 / Outcome