Project Overview
Build a fully functional sample e-commerce application featuring:
- A responsive user interface (web) supporting product browsing, search, cart management, checkout, and user authentication.
- A backend API layer (REST) with endpoints for product catalog, cart operations, orders, and user management.
- A comprehensive testing strategy, including unit tests, integration tests, end-to-end (E2E) tests, and test fixtures.
- Use only in-memory mock databases and mock data/actions—no real database connections.
- UI: React with TypeScript, Styled Components for CSS-in-JS styling
- API: Node.js with Express, TypeScript
- Mock Data Layer:
- In-memory arrays as "databases" with repository pattern
- Repository modules exposing create/read/update/delete operations on mock data
- Pre-seeded mock data for products, users, carts, and orders
- Authentication: JWT-based flows using in-memory user store with bcryptjs password hashing
- Testing:
- Jest + React Testing Library for UI/unit tests
- Supertest for API integration tests against mocks
- Cypress for E2E tests with mocked APIs
- Code coverage reports generated
- Home page with featured products carousel and category navigation (mocked data)
- Product listing page with pagination, search, category filtering, and sorting (reads from mock store)
- Product detail pages with full product information and add-to-cart functionality
- Shopping cart with add/remove/update quantity, item management, and price calculations (mock actions)
- Checkout form with shipping address, payment method selection, and order summary (simulate order placement)
- User authentication flows (signup/login/logout) backed by mock user service
- Order history page showing past orders with status tracking
- Responsive design optimized for desktop and mobile devices
- Global state management for authentication and cart using React Context
Implement RESTful endpoints that operate solely on mock data stores:
POST /api/auth/signup– create new user in in-memory store with password hashingPOST /api/auth/login– validate credentials against mock store, return JWT tokenGET /api/auth/profile– get current user profile using JWT authenticationPOST /api/auth/logout– logout endpoint (client-side token removal)GET /api/products– return paginated mock product list with search and filteringGET /api/products/featured– return featured products for home pageGET /api/products/categories– return available product categoriesGET /api/products/:id– return single product details from mock listGET /api/cart– return current user's cart state from mock storePOST /api/cart– add item to user's mock cart with quantityPUT /api/cart/:itemId– update mock cart item quantityDELETE /api/cart/:itemId– remove item from mock cartDELETE /api/cart– clear entire cartPOST /api/orders– simulate order creation in mock orders store with cart processingGET /api/orders– return user's mock order historyGET /api/orders/:id– return specific order detailsPUT /api/orders/:id/cancel– cancel pending order
- Configure Jest for both UI and API tests with TypeScript support
- Provide comprehensive test coverage:
- UI unit tests for components (Header, ProductCard, Cart, etc.) using React Testing Library
- Hook tests for useAuth and useCart with mocked contexts
- API integration tests for all endpoints using Supertest with mocked data services
- Page-level tests for authentication flows, product browsing, and cart operations
- Cypress E2E tests covering complete user journeys with API interception
- Test utilities and setup files for consistent testing environment
- Coverage reports with detailed metrics
- Monorepo structure with
/clientand/serverfolders - Root-level package.json with workspace management:
dev(runs both client & server concurrently in development)build(builds both client and server)test(runs all Jest test suites)test:coverage(generates coverage reports)cypress:open(opens Cypress test runner)server:dev(runs server in development mode)client:dev(runs client in development mode)
- Mock data repositories initialize with realistic sample data
- Environment configuration for development and production
- Frontend: React with TypeScript, React Router for navigation, Styled Components for styling
- Backend: Express with TypeScript, JWT authentication middleware, CORS configuration
- Data Layer: Repository pattern with in-memory stores for users, products, carts, and orders
- Authentication: JWT tokens with configurable secrets, password hashing with bcryptjs
- API Design: RESTful endpoints with consistent response formats and error handling
- State Management: React Context for global state (auth, cart) with custom hooks
- Responsive Design: Mobile-first approach with styled-components breakpoints
- A fully functional e-commerce application ready to run locally
- Comprehensive README with setup instructions, API documentation, and testing guide
- Configuration files: ESLint, TypeScript configs, Jest setup, Cypress configuration
- Sample data and realistic product catalog with images and descriptions
- Complete test suite with high coverage demonstrating testing best practices
Implementation Notes
The application demonstrates modern full-stack development practices using TypeScript throughout, comprehensive testing strategies, and realistic e-commerce functionality while maintaining the requirement of using only mock data stores without external database dependencies.