ECOMMERCE
FULLSTACK APP - Admin Panel with Data Tables - AI-powered assistant - Checkout Process - WhatsApp notifications - Filters for query parameters - Cursor Pagination - Clean Architecture

Links
Created
Project README
Detailed documentation about this project
Technologies
Overview
VzCommerce is a lightweight, sales-focused ecommerce platform designed for small businesses that close deals through WhatsApp. Instead of forcing the entire checkout process inside the website, VzCommerce acts as a seamless bridge: customers browse a full product catalog, view price, stock and promotions, and once they decide to buy, the platform automatically routes the order to WhatsApp so the seller and customer can finalize payment, shipping, and details privately. On the admin side, sellers get a complete dashboard with real-time analytics powered by Chart.js, dynamic tables with pagination for managing products, and a dedicated orders panel. It also includes an integrated AI assistant specialized in digital business and sales to provide guidance, insights, and optimization tips.
What & Why
What
VzCommerce is a lightweight, sales-focused ecommerce platform designed for small businesses that close deals through WhatsApp.
Why
Many small sellers prefer finalizing their sales through WhatsApp, where they can negotiate, build trust, and adapt pricing or delivery on the fly. However, keeping a catalog updated manually, sending photos, prices, descriptions one by one is tedious and unscalable. VzCommerce was built to solve that gap: give customers a comfortable, organized place to explore the entire catalog, while preserving the seller's preferred workflow of closing the sale in private through WhatsApp.
The Challenge
The main challenge was to create an ecommerce platform that feels complete and professional, apply Clean Architecture with design patterns, and implement a robust testing strategy with +500 tests. At the same time, building a robust admin panel with real-time analytics, dynamic data tables, and an AI assistant required careful architecture, and clean, maintainable code.
Highlights
- Product Listings: Display of products with details such as name, description, price, and images
- Category Management: Categorizing products for easy navigation
- Shopping Cart: Add, remove, and manage products in a shopping cart
- Admin Authentication: Secure admin login
- Admin Panel: Administrative interface for managing products, categories, and orders with Data-Tables (tanstack/react-table)
- Checkout Process: Streamlined checkout process with token-based validation
- AI Assistant: Private admin AI to help manage the store
- WhatsApp Automated Message: WhatsApp notifications for order confirmations
- Image Handling: Image transformation, WebP conversion, and cloudinary uploads, and lazy loading for optimized performance
- Real-time Analytics: Track statistics of the store with Chartjs
- Modular Components: Reusable UI elements and organized architecture for maintainability
- Optimized Build Process: Streamlined workflows with Vite, TailwindCSS, and TypeScript configurations
- Secure API & Authentication: Robust route protection, session management, and user authentication
- State & Data Management: Centralized store with Redux Toolkit, React Query, and data validation schemas
- Flexible Routing & Admin Tools: Organized navigation, admin dashboards, and private pages
Features
- User authentication with JWT tokens and role-based access control (user/admin)
- Complete shopping cart with persistent state using Redux
- Advanced product search and filtering by category, price range, and query parameters
- AI-powered assistant for product recommendations and customer support (OpenAI GPT-4.1)
- WhatsApp notification system for order status updates via WhatsApp Web.js
- Admin dashboard with analytics, data tables, and CRUD operations for products/categories/orders
- Image upload and management for products with Cloudinary
- Responsive design optimized for mobile and desktop
- WhatsApp Web.js for session management with QR authentication
- Message states: PENDING → SENT → RESPONDED → COMPLETED
- AI Chat Interface in admin panel
- AI Insights Cards for business analysis
- Cloudinary direct upload with presets and automatic WebP conversion
- react-cropper for image resizing
- Browser-side compression before upload
- Multiple images per product (gallery)
- Real-time analytics with Recharts: Line Chart, Bar Chart, Pie Chart, Area Chart
- Dynamic tables with TanStack Table, sorting, filtering, pagination
Pages
Public Pages
/- Home page with featured products and carousel/products- All products list with filters/promotion- Products on promotion/featured- Featured products/new- New arrivals/categories/:category- Products filtered by category/search- Search results page/products/:id- Product detail page/checkout/:token- Checkout page with token validation/order/:id- Order confirmation page/login- Admin login pagePrivate Pages (Admin)
/private/admin- Main admin dashboard/private/admin/analytics- Real-time analytics with charts/private/admin/products- Product management with data tables/private/admin/categories- Category management/private/admin/order- Order management/private/admin/ai- AI assistant chat interface/private/admin/settings- Store configurationArchitecture
Type: Clean Architecture
The backend follows Clean Architecture with 4 clearly defined layers: Domain (Entities, Interfaces, DTOs), Application (Use cases, Business logic services), Infrastructure (External implementations - Prisma, APIs, Adapters), and Presentation (Routes, Controllers, Middlewares).
Principles
- Dependency Inversion: External layers depend on internal ones
- Testability: Each layer can be tested in isolation
- Separation of Concerns: Responsibilities clearly defined
Layers
Domain
Entities, Interfaces, DTOs (innermost layer)
Application
Use cases, Business logic services
Infrastructure
External implementations (Prisma, APIs, Adapters)
Presentation
Routes, Controllers, Middlewares
Design Patterns
| Pattern | Implementation | Location |
|---|---|---|
| Repository | Data access abstraction | infrastructure/repositories/* |
| Builder | Complex object creation | ProductBuilder, OrderBuilder, OrderItemBuilder |
| Adapter | Interface conversion | OrderSendMessageToCustomer.impl.ts |
| Factory | Test data generation | Test helpers |
| Middleware | Cross-cutting concerns | AuthMiddleware, ValidationMiddleware |
| Dependency Injection | Loose coupling | Constructor injection in services |
State Management
Hybrid state management strategy that separates server state from client state
| State Type | Technology | Use Case |
|---|---|---|
| Server State | TanStack Query (React Query) | Products, Categories, Orders, Auth data |
| Client State | Redux Toolkit | Shopping cart (needs persistence) |
| Form State | React Hook Form | All forms with Zod validation |
| UI State | React useState | Local component state |
React Query handles server state with automatic caching, background refetching, optimistic updates, and cache invalidation. Redux Toolkit is used exclusively for the shopping cart because it needs to persist across sessions (localStorage) and has complex synchronous logic with reducers.
Performance Optimizations
| Optimization | Implementation |
|---|---|
| Lazy Loading | React.lazy() + Suspense for routes and heavy components |
| Image Lazy Loading | Custom Lazy component with IntersectionObserver |
| Debounced Search | useDebounce hook (300ms delay) to avoid excessive API calls |
| Skeleton Loaders | Visual placeholders during data fetch |
| React Query Caching | staleTime: 5min, gcTime: 10min |
| Optimistic Updates | Immediate UI updates with automatic rollback on error |
| Image Optimization | WebP conversion, Cloudinary CDN |
| Component Memoization | React.memo where needed |
Security
| Feature | Implementation |
|---|---|
| JWT in Cookies | httpOnly, secure, sameSite cookies |
| Helmet.js | HTTP security headers |
| CORS | Configurable allowed origins |
| Rate Limiting | express-rate-limit (100 requests/15min) |
| bcryptjs | Password hashing |
| Zod Validation | Input validation on both client and server |
| Auth Middleware | Token verification on protected routes |
Testing Strategy
The backend has 59 test files with over 11,000 lines of test code
| Test Type | Coverage |
|---|---|
| Unit Tests | Services, DTOs, Entities |
| Integration Tests | Repositories, Controllers |
| E2E Tests | Full flows (auth → create → update → delete) |
| Black Box Tests | Testing without internal code access |
| Module | Unit | Integration | E2E |
|---|---|---|---|
| Auth | ✅ | ✅ | ✅ |
| Products | ✅ | ✅ | ✅ |
| Categories | ✅ | ✅ | ✅ |
| Orders | ✅ | ✅ | ✅ |
| Middlewares | ✅ | ❌ | ❌ |
API & Data Fetching
Query Parameters
Pagination:
pagelimitFilters:
searchcategorypriceMinpriceMaxinStockfreeShippingfeaturedpromotionnewsizeSorting:
sortBy (price | createdAt | discountPercentage)sortDir (asc | desc)Custom Hooks (22+)
useProducts- Fetch products with filtersuseProductsFilters- Filter state managementuseProductById- Single product fetchuseProductMutations- CRUD operationsuseCategories- Categories fetchuseCategoryMutations- Categories CRUDuseOrders, useOrderById- Orders fetchuseOrderMutations- Orders CRUDuseStoreCustomer- Store datauseAuthMutations- Login/LogoutuseSession- Session verificationuseCartActions- Cart managementuseCheckout- Checkout processuseAIMutations- AI chatuseDebounce- Avoid excessive requestsuseImageCropper- Image croppinguseMobile- Responsive detectionuseCheckoutForm- Checkout formuseProductForm- Product formuseOrderForm- Order formuseInstallments- Installment calculationuseImageUpload- Cloudinary upload
Project Structure
Type: Monorepo
client/src/components- React componentsclient/src/guards- Route guardsclient/src/hooks- Custom hooks (25+)client/src/layouts- Layout componentsclient/src/lib- Utilities, axios, zod schemasclient/src/pages- Page componentsclient/src/types- TypeScript typesclient/src/store- Redux storeclient/src/utilities- Utility functionsclient/src/data- API callsclient/src/routes- Application routesserver/src/AI- AI Assistant featureserver/src/Auth- Authenticationserver/src/Categories- Categories featureserver/src/Checkout- Checkout featureserver/src/Orders- Orders featureserver/src/Products- Products featureserver/src/StoreCustomers- Store customersserver/src/shared- Shared modulesserver/tests/context- Unit & integration testsserver/tests/apps- E2E & black box testsserver/tests/helpers- Factories, mocks, helpersserver/prisma- Prisma schema and migrationsInstallation
Clone the repositorygit clone https://github.com/ValentinZoia/e-commerce.gitNavigate to the client directorycd e-commerce/clientInstall client dependenciesnpm installNavigate to the server directorycd ../serverInstall server dependenciesnpm installSet up the databaseEnsure MongoDB is running and configure DATABASE_URL in .envGenerate Prisma clientnpm run prisma:generate
Learnings
Deepened understanding of state management at scale with Redux Toolkit and React Query; Learned how to implement Clean Architecture with clear separation of concerns (Controllers/Services/Repositories); Gained experience with AI integration patterns and API design for AI assistants; Improved skills in handling complex form validation and data transformation; Understood the importance of proper error handling and user feedback in e-commerce flows; Mastered WhatsApp Web.js integration for real-time notifications; Learned advanced MongoDB aggregation pipelines and indexed queries for efficient filtering; Gained experience building real-time analytics dashboards with Chart.js/Recharts.
Challenges
- Implementing a seamless checkout flow with multiple payment states and error handling - solved by breaking down the process into clear steps with validation at each stage
- Building an efficient product filtering system with multiple parameters - solved by using MongoDB aggregation pipelines and indexed queries
- Creating a responsive admin dashboard with complex data tables - solved by implementing pagination, sorting, and search on both frontend and backend
- Integrating WhatsApp notifications while handling API rate limits and message queuing