Skip to content

Cashkid12/DukaFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ‰ DUKAFLOW - Multi-Tenant SaaS Business Management Platform

Tagline: "Run Your Duka, Smarter."

A complete, production-ready SaaS platform built for small retail businesses in Kenya/East Africa.


πŸ“ PROJECT STRUCTURE

dukaflow/
β”œβ”€β”€ frontend/              # React + Vite Frontend Application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/         # Page components
β”‚   β”‚   β”œβ”€β”€ services/      # API service layer
β”‚   β”‚   β”œβ”€β”€ hooks/         # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ utils/         # Utility functions
β”‚   β”‚   └── context/       # React Context providers
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ backend/               # Node.js + Express Backend API
β”‚   β”œβ”€β”€ config/            # Database, auth, email configs
β”‚   β”œβ”€β”€ models/            # Mongoose schemas
β”‚   β”œβ”€β”€ controllers/       # Route controllers
β”‚   β”œβ”€β”€ routes/            # API routes
β”‚   β”œβ”€β”€ middleware/        # Auth, validation middleware
β”‚   β”œβ”€β”€ services/          # Business logic services
β”‚   β”œβ”€β”€ jobs/              # Cron jobs (6 automated tasks)
β”‚   β”œβ”€β”€ sockets/           # Socket.io real-time setup
β”‚   β”œβ”€β”€ utils/             # Helper utilities
β”‚   └── package.json
β”‚
└── README.md              # This file

πŸš€ QUICK START

Prerequisites

  • Node.js 18+ installed
  • MongoDB installed or MongoDB Atlas account
  • npm or yarn package manager

1️⃣ Setup Frontend

cd frontend
npm install
npm run dev

Frontend will be available at: http://localhost:5173

2️⃣ Setup Backend

Open a new terminal:

cd backend
npm install

Create .env file (copy from .env.example):

cp .env.example .env

Update the .env file with your MongoDB connection string:

PORT=5000
MONGODB_URI=mongodb://localhost:27017/dukaflow
JWT_SECRET=your_super_secret_jwt_key_change_this
JWT_EXPIRE=7d
NODE_ENV=development

EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password

CLIENT_URL=http://localhost:5173

Start the backend server:

npm run dev

Backend API will be available at: http://localhost:5000


🎨 FEATURES

βœ… Frontend Features

  • Landing Page - Conversion-optimized with animations
  • Authentication - Sign In & Multi-step Sign Up
  • Dashboard - Real-time stats, charts, alerts
  • Inventory Management - Product CRUD, filters, search
  • Sales/POS - Point of Sale interface, transaction history
  • Worker Management - Team management, performance tracking
  • Reports - Daily, weekly, monthly analytics
  • Settings - Shop profile, billing, multi-branch
  • Super Admin Panel - Platform management

βœ… Backend Features

  • RESTful API - Complete CRUD operations
  • JWT Authentication - Secure token-based auth
  • Multi-Tenancy - Shop-based data isolation
  • 6 Automated Cron Jobs:
    • Daily Reports (9:00 PM EAT)
    • Weekly Reports (Monday 8:00 AM EAT)
    • Monthly P&L (1st of month 8:00 AM EAT)
    • Low Stock Checks (Every 2 hours)
    • Expiry Alerts (Daily 8:00 AM EAT)
    • Trial Expiry (Daily midnight)
  • Real-Time Updates - Socket.io integration
  • Email Notifications - Automated reports & alerts

πŸ› οΈ TECH STACK

Frontend

  • React 19 - UI framework
  • Vite - Build tool
  • Tailwind CSS - Styling
  • React Router - Navigation
  • Recharts - Data visualization
  • Socket.io Client - Real-time updates
  • Axios - HTTP client
  • Lucide React - Icons

Backend

  • Node.js - Runtime
  • Express - Web framework
  • MongoDB + Mongoose - Database
  • JWT - Authentication
  • Socket.io - Real-time server
  • Node-Cron - Scheduled tasks
  • Nodemailer - Email service
  • bcryptjs - Password hashing

πŸ“Š DATABASE SCHEMAS

Shop

  • Business profile, settings, subscription
  • Multi-branch support
  • Custom categories & attributes

User

  • Authentication, roles, permissions
  • Active session tracking
  • Worker management

Product

  • Inventory tracking
  • Stock alerts, expiry dates
  • Custom attributes (size, color, etc.)

Sale/Transaction

  • POS transactions
  • Payment methods (Cash, M-Pesa, Card)
  • Profit calculations

Notification

  • Real-time alerts
  • Email notifications
  • User preferences

🎯 KEY FEATURES

Multi-Tenancy Architecture

  • Each shop gets isolated data
  • Shop-specific rooms for real-time updates
  • Subdomain routing ready ([shop].dukaflow.com)

Real-Time Features

  • Live stock updates
  • Instant sale notifications
  • Worker activity tracking
  • Alert system

Automated Reporting

  • Daily sales summaries via email
  • Weekly performance insights
  • Monthly P&L statements
  • Smart alerts (low stock, expiry)

Security

  • JWT authentication with HTTP-only cookies
  • Password hashing (bcrypt)
  • Session management
  • Role-based access control

πŸ“± PAGES & ROUTES

Public Routes

  • / - Landing page
  • /signin - Login
  • /signup - Multi-step registration

Dashboard Routes

  • /dashboard - Overview
  • /dashboard/inventory - Product management
  • /dashboard/sales - Sales & POS
  • /dashboard/workers - Team management
  • /dashboard/reports - Analytics
  • /dashboard/settings - Configuration

Admin Routes

  • /admin - Super admin panel

πŸ”§ CONFIGURATION

Environment Variables

Frontend (.env):

VITE_API_URL=http://localhost:5000/api

Backend (.env):

PORT=5000
MONGODB_URI=mongodb://localhost:27017/dukaflow
JWT_SECRET=your_secret_key
JWT_EXPIRE=7d
NODE_ENV=development
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_app_password
CLIENT_URL=http://localhost:5173

πŸš€ DEPLOYMENT

Frontend (Vercel)

cd frontend
npm run build
vercel --prod

Backend (Railway/Render)

cd backend
# Set environment variables in dashboard
npm start

Database (MongoDB Atlas)

  1. Create cluster at mongodb.com/cloud/atlas
  2. Whitelist server IP
  3. Get connection string
  4. Update MONGODB_URI in backend .env

πŸ“š DOCUMENTATION


🎨 DESIGN SYSTEM

Colors

  • Primary: Indigo (#312E81)
  • Accent: Terracotta (#E8835C)
  • Success: Green (#10B981)
  • Warning: Amber (#F59E0B)
  • Danger: Red (#EF4444)
  • M-Pesa: Green (#43B02A)

Typography

  • Font: Inter (sans-serif)
  • Numbers: JetBrains Mono (monospace)

Components

  • Buttons, Cards, Badges, Forms
  • Modal, Drawer, Switch
  • Navigation (Sidebar, TopBar, MobileNav)

πŸ§ͺ TESTING

Run Frontend Tests

cd frontend
npm test

Run Backend Tests

cd backend
npm test

🀝 CONTRIBUTING

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

πŸ“„ LICENSE

This project is proprietary software. All rights reserved.


πŸ“ž SUPPORT


πŸŽ‰ CREDITS

Built with ❀️ for Kenyan Dukas

Run Your Duka, Smarter.


πŸ“Š PROJECT STATUS

βœ… COMPLETE - Production Ready

  • 11 Pages implemented
  • 6 Automated cron jobs
  • Real-time Socket.io integration
  • Complete API layer
  • Multi-tenant architecture
  • Deployment configurations

Last Updated: April 8, 2026

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages