Build a full-featured e-commerce platform across multiple backend stacks (Node.js, FastAPI, Go) with shared React frontend to compare technologies.
Build a comprehensive e-commerce platform implemented across multiple backend frameworks while sharing a common React + Material UI frontend to understand the strengths and patterns of different backend technologies.
Implement a full-featured e-commerce platform with the following architecture:
**Frontend Layer**: React + TypeScript + Material UI (Port: 5173)
**Backend Layer (Choose One)**:
**Data Layer**:
When implementing this system, follow these principles:
1. **API-First Design**: All backends implement the same REST API contract defined by OpenAPI/Swagger specification
2. **Microservices-Ready**: Each backend runs independently on different ports for easy comparison
3. **Stateless Backend**: Session data in Redis, JWT tokens for authentication
4. **Caching Strategy**: Redis for sessions, cart, and database query results
5. **Security First**: JWT auth, RBAC, password hashing, input validation, rate limiting
Create normalized PostgreSQL schema (3NF) with these core tables:
Add indexes on foreign keys and frequently queried columns. Implement soft deletes for important data.
Configure Redis for these use cases:
Choose your backend stack and implement these core REST API endpoints:
**Authentication**:
**Products**:
**Cart**:
**Orders**:
**Reviews**:
Add these security measures:
1. **Authentication**: JWT tokens with expiration + refresh token mechanism
2. **Password Security**: Bcrypt/Argon2 hashing with minimum complexity requirements
3. **Authorization**: RBAC middleware (Customer, Admin roles) on protected routes
4. **Input Validation**: Schema validation (Zod for Node.js, Pydantic for FastAPI)
5. **Rate Limiting**: Redis-based per-user and per-IP limits
6. **CORS**: Configure allowed origins whitelist
7. **Headers**: Security headers (Helmet.js for Node.js)
Add caching with this strategy:
1. **Product Listings**: Cache with 5-minute TTL, invalidate on product updates
2. **Product Details**: Cache with 10-minute TTL, invalidate on specific product update
3. **User Sessions**: Redis with 24-hour TTL, sliding expiration
4. **Cart Data**: Redis with 7-day TTL for abandoned cart cleanup
Create React + TypeScript + Material UI frontend with:
**Technology Stack**:
**Key Pages**:
**User Authentication Flow**:
```
Frontend → POST /api/auth/login → Verify credentials in DB → Create session in Redis → Generate JWT → Return token + user data → Store token, redirect
```
**Add to Cart Flow**:
```
Frontend → POST /api/cart/items → Verify JWT → Check product stock in DB → Update Redis cart hash → Return updated cart
```
**Checkout Flow**:
```
Frontend → POST /api/orders → Verify JWT → Get cart from Redis → DB Transaction: (Create order, Create order_items, Update stock, Clear cart in Redis) → Return order confirmation
```
**Product Search Flow**:
```
Frontend → GET /api/products?search=xyz → Check Redis cache → Cache miss: Full-text search in DB + cache results → Return products
```
Use consistent response formats:
**Success Response**:
```json
{
"success": true,
"data": { ... },
"message": "Operation successful",
"meta": { "page": 1, "limit": 20, "total": 100 }
}
```
**Error Response**:
```json
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input data",
"details": [{ "field": "email", "message": "Invalid email format" }]
}
}
```
1. **Database**: Connection pooling, indexes on foreign keys, query optimization (prevent N+1), pagination
2. **Caching**: Redis for frequent data, TTL-based expiration, cache invalidation strategy
3. **API**: Response compression (gzip), field filtering, lazy loading for images
4. **Frontend**: Code splitting, lazy route loading, React Query caching, image optimization
**Local Development**:
```bash
docker-compose up -d
Frontend: http://localhost:5173
Node.js API: http://localhost:3000
PostgreSQL: localhost:5432
Redis: localhost:6379
```
**Database Migrations**:
```bash
npm run migrate:dev
alembic revision --autogenerate
alembic upgrade head
```
**Testing**:
```bash
npm test # Node.js
pytest # Python
npm test
```
When comparing backend implementations, measure:
1. **Performance**: Response times, throughput with load testing (Apache Bench/k6)
2. **Development Speed**: Time to implement same features
3. **Code Complexity**: Lines of code, maintainability
4. **Type Safety**: Compile-time vs runtime error catching
5. **Ecosystem**: Available libraries, community size
6. **Resource Usage**: Memory and CPU under load
Test with same database, same data, same Redis instance for fair comparison.
```
.
├── docker-compose.yml
├── backend-nodejs/
│ └── CLAUDE.md
├── backend-fastapi/
│ └── CLAUDE.md
├── backend-go/
│ └── CLAUDE.md
├── frontend-react/
│ └── CLAUDE.md
└── shared/
├── docs/
│ └── api-specification.yml
└── scripts/
└── seed-data.sql
```
**TypeScript for Node.js**: Type safety, better IDE support, easier refactoring, industry standard
**Prisma ORM**: Type-safe database client, excellent TypeScript integration, modern migrations
**Material UI**: Comprehensive component library, good documentation, customizable, accessibility built-in
**Redis for Cart**: Fast operations, automatic TTL for abandoned carts, reduces DB load, industry standard
Consider adding: Payment integration (Stripe), email notifications, real-time updates (WebSockets), product recommendations, wishlist, multi-currency, GraphQL alternative, mobile app, advanced analytics
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/e-commerce-multi-stack-architecture-guide/raw