- Project Overview
- Features
- Project Structure
- User Interface
- Component Architecture
- Development Practices
- Quick Start & Installation
AfriVazi is a full-stack e-commerce platform for authentic African wear, built with a Strapi backend (API) and a React + TypeScript + Vite frontend. The project is designed for easy deployment, scalability, and a seamless shopping experience.
Backend repo: AfriVazi Backend
- Product Catalog: Manage and browse products, categories, and sub-categories.
- Shopping Cart: Add, remove, and update products in a persistent cart.
- Order Management: Place orders and process payments via Stripe.
- Admin Panel: Powerful Strapi admin UI for content and user management.
- Authentication & Permissions: Role-based access via Strapi.
- Responsive Frontend: Modern, mobile-friendly React UI.
- API Integration: Secure, token-based communication between frontend and backend.
- Deployment Ready: Guides and configs for Render, PostgreSQL, and Vercel.
AfriVazi/
β
βββ api/ # Strapi Backend
β βββ config/ # Server configuration
β β βββ admin.js # Admin panel config
β β βββ api.js # API settings
β β βββ database.js # Database configuration
β β βββ middlewares.js # Custom middlewares
β β
β βββ src/
β β βββ admin/ # Admin panel customization
β β βββ api/ # API components
β β β βββ category/ # Category model/controller/routes
β β β βββ order/ # Order processing
β β β βββ product/ # Product management
β β β βββ sub-category/ # Sub-category management
β β βββ extensions/ # Strapi extensions
β β βββ index.js # App entry point
β β
β βββ .env # Environment variables
β βββ package.json # Backend dependencies
β βββ README.md # API documentation
β
βββ client/ # React Frontend
β βββ public/ # Static assets
β β βββ images/ # Image assets
β β
β βββ src/
β β βββ assets/ # Static assets
β β β βββ image/ # Image assets
β β β
β β βββ components/ # Reusable UI components
β β β βββ Card/ # Product card component
β β β βββ Cart/ # Shopping cart components
β β β βββ Categories/ # Category navigation
β β β βββ Contact/ # Contact form
β β β βββ FeaturedProducts/ # Featured products section
β β β βββ Footer/ # Site footer
β β β βββ List/ # Product listing
β β β βββ Navbar/ # Navigation bar
β β β βββ Slider/ # Image carousel
β β β
β β βββ hooks/ # Custom React hooks
β β β
β β βββ pages/ # Application pages
β β β βββ About/ # About page
β β β βββ Contact/ # Contact page
β β β βββ Home/ # Home page
β β β βββ Product/ # Single product view
β β β βββ Products/ # Product listing page
β β β
β β βββ redux/ # State management
β β β βββ cartSlice.js # Shopping cart state
β β β βββ store.js # Redux store
β β β
β β βββ App.jsx # Main App component
β β βββ main.jsx # Application entry point
β β βββ index.css # Global styles
β β
β βββ .env # Frontend environment variables
β βββ package.json # Frontend dependencies
β βββ tailwind.config.js # Tailwind CSS config
β βββ vite.config.ts # Vite configuration
β
βββ .gitignore # Git ignore file
βββ README.md # Project documentation (this file)
- Color Scheme:
- Primary:
#2879fe(blue) - Main brand color - Text:
#333- Main text color - Light Text:
#777- Secondary text - Border:
#e0e0e0- Border color - Background:
#f5f5f5- Light background - Error:
#ff4d4f- Error/validation - Success:
#52c41a- Success messages
- Primary:
-
Navbar
- Responsive navigation with mobile menu
- Logo and site navigation links
- Shopping cart icon with item counter
- Search functionality
-
Card
- Displays product information
- Product image with hover effects
- Price and title display
- Add to cart button
-
Cart
- Shopping cart drawer
- List of selected products
- Quantity adjustment
- Total price calculation
-
Categories
- Category navigation
- Responsive category menu
- Active state indicators
-
FeaturedProducts
- Showcase of selected products
- Responsive grid layout
- Quick view functionality
-
Footer
- Site navigation links
- Contact information
- Social media links
- Copyright information
-
Slider
- Image carousel for featured content
- Auto-rotation with manual controls
- Responsive image display
-
Home Page (
/)- Hero slider with featured products
- Categories section
- Featured products grid
- Newsletter signup section
-
Products Page (
/products)- Product listing with filters
- Category-based filtering
- Search functionality
- Pagination support
-
Product Detail (
/product/:id)- Product image gallery
- Detailed product information
- Add to cart functionality
- Related products
-
About Page (
/about)- Company information
- Mission and values
- Team section
-
Contact Page (
/contact)- Contact information
- Contact form with validation
- Business hours
- Location map
-
Redux Store
- Cart state management
- Product state
- UI state (modals, loading states)
-
Local State
- Form inputs
- UI interactions
- Component-specific state
-
API Integration
- Axios for HTTP requests
- Data fetching and caching
- Error handling
- React Router for client-side navigation
- Protected routes (if authentication is implemented)
- 404 error handling
- Scroll restoration
- Feature-based Structure: Components grouped by feature
- Shared Components: Reusable UI elements in shared directory
- Type Definitions: TypeScript interfaces and types
- API Services: Centralized API calls with axios
- Tailwind CSS: Utility-first styling
- CSS Modules: Component-scoped styles
- Responsive Design: Mobile-first breakpoints
- Design Tokens: Consistent spacing, colors, and typography
- Redux Toolkit: Global state management
- React Context: For theme and auth state
- Local State: For component-specific state
- Redux Persist: For persisting cart and user preferences
- API Errors: Centralized error handling
- Form Validation: Client-side validation
- Error Boundaries: Graceful error recovery
- Logging: Client-side error logging
- React 18 - Frontend library
- TypeScript - Type checking
- Vite - Build tool and dev server
- Redux Toolkit - State management
- React Router - Client-side routing
- Material-UI (MUI) - UI component library
- Tailwind CSS - Utility-first CSS framework
- Stripe.js - Payment processing
- Axios - HTTP client
- Strapi 5 - Headless CMS
- Node.js - JavaScript runtime
- PostgreSQL - Primary database
- MySQL - Alternative database option
- Stripe - Payment processing
- JWT - Authentication
- ESLint - Code linting
- PostCSS - CSS processing
- Git - Version control
- Node.js (v18 or later)
- npm (v8 or later)
- MySQL Server (v8.0 or later) or PostgreSQL (v12 or later)
- MySQL Workbench (recommended) or another database management tool
git clone https://github.com/bridgitkanini/AfriVazi.git
cd AfriVazicd api
npm install-
Create a MySQL Database
- Open MySQL Workbench
- Connect to your local MySQL server
- Create a new database:
CREATE DATABASE strapi_afrivazi;
- Create a database user (replace with a strong password):
CREATE USER 'afrivazi_user'@'localhost' IDENTIFIED BY 'your_secure_password'; GRANT ALL PRIVILEGES ON strapi_afrivazi.* TO 'afrivazi_user'@'localhost'; FLUSH PRIVILEGES;
-
Configure Environment Variables Create a
.envfile in theapidirectory with:# Database DATABASE_CLIENT=mysql DATABASE_HOST=127.0.0.1 DATABASE_PORT=3306 DATABASE_NAME=strapi_afrivazi DATABASE_USERNAME=afrivazi_user DATABASE_PASSWORD=your_secure_password # App HOST=0.0.0.0 PORT=1337 NODE_ENV=development # Security JWT_SECRET=your_jwt_secret ADMIN_JWT_SECRET=your_admin_jwt_secret API_TOKEN_SALT=your_api_token_salt
-
Install Dependencies
npm install mysql2 --save
-
Start the Backend
# Development mode npm run develop # Or for production # npm run build && npm start
- Admin panel: http://localhost:1337/admin
- API: http://localhost:1337/api
cd ../client
pnpm install # or npm install-
Configure Environment Variables Create a
.envfile in theclientdirectory:VITE_API_URL=http://localhost:1337/api VITE_UPLOAD_URL=http://localhost:1337 VITE_API_TOKEN=your_strapi_api_token # Get from Strapi Settings > API Tokens
-
Start the Development Server
# Development mode pnpm dev # or npm run dev # Production build # pnpm build # pnpm preview
- Frontend: http://localhost:5173
- Visit http://localhost:1337/admin
- Create your admin account
- Go to Settings > API Tokens
- Create a new API Token with full access
- Update the
VITE_API_TOKENin your client's.envfile
-
MySQL Connection Issues:
- Ensure MySQL server is running
- Verify database credentials in
.env - Check database user permissions
- Try using
127.0.0.1instead oflocalhost
-
Port Conflicts:
- Strapi: 1337 (API) and 1338 (Admin)
- Vite: 5173 (Frontend)
- Update ports in respective
.envfiles if needed
-
API Token Issues:
- Regenerate the token in Strapi admin
- Ensure the token has correct permissions
- Restart the frontend after updating the token
For deployment instructions, see Deployment Guide.
This project is licensed under the MIT License.
- Strapi Documentation
- React Documentation
- Vite Documentation
- Stripe Docs
- AfriVazi API Deployment Guide