# Andan Grocery E-Commerce System
A modern, full-stack grocery e-commerce platform built with the MERN stack, featuring M-Pesa integration and sophisticated UI/UX design.
- Modern UI/UX: Sleek design with Inter/Playfair Display typography
- User Authentication: JWT + Google OAuth integration
- Product Catalog: Advanced search, filtering, and categorization
- Shopping Cart: Persistent cart with real-time updates
- M-Pesa Integration: Secure mobile money payments
- Order Management: Real-time order tracking and history
- Responsive Design: Mobile-first approach with WCAG compliance
- Dashboard Analytics: Sales metrics and user insights
- Product Management: CRUD operations with inventory tracking
- Order Processing: Status updates and fulfillment management
- User Management: Customer support and account administration
- Promotion Tools: Discount codes and flash sales management
- Frontend: React 18, TypeScript, Tailwind CSS, Framer Motion
- Backend: Node.js, Express.js, TypeScript
- Database: MongoDB with Mongoose ODM
- Authentication: JWT, Passport.js, Google OAuth 2.0
- Payments: M-Pesa Daraja API
- State Management: React Query, Context API
- Validation: Zod, React Hook Form
andan-grocery/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Route components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── services/ # API services
│ │ ├── utils/ # Utility functions
│ │ └── types/ # TypeScript definitions
│ └── public/ # Static assets
├── server/ # Node.js backend
│ ├── src/
│ │ ├── controllers/ # Route handlers
│ │ ├── models/ # MongoDB schemas
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Custom middleware
│ │ ├── services/ # Business logic
│ │ └── utils/ # Server utilities
│ └── uploads/ # File uploads
└── shared/ # Shared types and utilities
- Node.js 18+
- MongoDB 5.0+
- M-Pesa Developer Account
- Clone the repository
git clone https://github.com/your-username/andan-grocery.git
cd andan-grocery- Install dependencies
# Install server dependencies
cd server
npm install
# Install client dependencies
cd ../client
npm install- Environment Setup
# Server environment
cp server/.env.example server/.env
# Client environment
cp client/.env.example client/.env- Start development servers
# Terminal 1 - Start MongoDB
mongod
# Terminal 2 - Start server
cd server
npm run dev
# Terminal 3 - Start client
cd client
npm run dev- Headings: Playfair Display (elegant serif)
- Body Text: Inter (modern sans-serif)
- Code: JetBrains Mono
- Primary: #27AE60 (Signature Green)
- Background: #FFFFFF (Pure White)
- Neutrals: #F6F9FC, #E5E7EB
- Accents: Blue, Orange, Red variants
- Grid System: 8pt base unit
- Container: 1140px max-width
- Padding: 24px standard
POST /api/auth/register # User registration
POST /api/auth/login # User login
POST /api/auth/google # Google OAuth
GET /api/auth/me # Get current user
POST /api/auth/refresh # Refresh token
GET /api/products # Get all products
GET /api/products/:id # Get single product
POST /api/products # Create product (admin)
PUT /api/products/:id # Update product (admin)
DELETE /api/products/:id # Delete product (admin)
GET /api/orders # Get user orders
POST /api/orders # Create order
GET /api/orders/:id # Get single order
PUT /api/orders/:id # Update order status
The system integrates with Safaricom's M-Pesa Daraja API for secure mobile payments:
- STK Push: Initiates payment request
- Callback Handling: Processes payment confirmations
- Transaction Verification: Validates payment status
- Receipt Generation: Creates digital receipts
- JWT Authentication: Secure token-based auth
- Password Hashing: bcrypt with salt rounds
- Input Validation: Zod schema validation
- Rate Limiting: API request throttling
- CORS Protection: Cross-origin request security
- Helmet.js: Security headers
# Run server tests
cd server
npm test
# Run client tests
cd client
npm test
# Run e2e tests
npm run test:e2e# Build client
cd client
npm run build
# Build server
cd server
npm run buildSee .env.example files for required environment variables.
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
For support, email muriuki.dev@gmail.com or join our Slack channel.