A comprehensive React frontend for managing restaurant finances, including sales tracking, purchase management, expense tracking, and detailed reporting.
- Real-time Overview: Today's sales, expenses, and profit
- Weekly/Monthly/Yearly Breakdown: Quick access to different time periods
- Interactive Charts: Visual representation of profit trends
- Quick Actions: Direct links to add sales, purchases, or expenses
- Ingredient Tracking: Record ingredient purchases with quantities and costs
- Date-based Organization: Track purchases by date
- Cost Calculation: Automatic total cost calculation
- Form Validation: Ensures data integrity
- Daily Sales Entry: Record sales with descriptions
- Quick Amount Buttons: Predefined amounts for faster entry
- Date Tracking: Organize sales by date
- Flexible Descriptions: Add context to sales entries
- Categorized Expenses: Electricity, water, rent, salaries, etc.
- Non-food Expenses: Track operational costs separately from food purchases
- Detailed Descriptions: Add context to expense entries
- Quick Amount Selection: Predefined amounts for common expenses
- Multiple Time Filters: Daily, weekly, monthly, yearly views
- Financial Summary: Total income, expenses, and profit calculations
- Data Tables: Detailed lists of sales, purchases, and expenses
- Interactive Charts: Bar charts for financial overview
- Export-Ready: Clean data presentation for external analysis
- React 19: Modern React with hooks and functional components
- React Router: Client-side routing for SPA navigation
- Tailwind CSS: Utility-first CSS framework for responsive design
- Heroicons: Beautiful SVG icons from the Tailwind CSS team
- Recharts: Composable charting library for data visualization
- Axios: HTTP client for API communication
- Node.js (v16 or higher)
- npm or yarn package manager
-
Clone or navigate to the project directory
cd restaurant -
Install dependencies
npm install
-
Start the development server
npm start
-
Open your browser Navigate to
http://localhost:3000
The frontend is designed to work with a Django REST API backend. The API endpoints expected are:
POST /api/auth/login/- User loginPOST /api/auth/logout/- User logout
GET /api/purchases/- List purchases with optional date filtersPOST /api/purchases/- Create new purchaseGET /api/purchases/total_purchases/- Get purchase totals for date range
GET /api/sales/- List sales with optional date filtersPOST /api/sales/- Create new saleGET /api/sales/total_sales/- Get sales totals for date range
GET /api/expenses/- List expenses with optional date filtersPOST /api/expenses/- Create new expenseGET /api/expenses/total_expenses/- Get expense totals for date range
GET /api/dashboard/- Get dashboard summary data
Update the API base URL in src/services/api.js:
const API_BASE_URL = 'http://localhost:8000/api'; // Change to your backend URLThe app uses token-based authentication. Tokens are stored in localStorage and automatically included in API requests.
- Enter your username and password
- The app will remember your session using localStorage
- View today's financial summary
- Access quick actions for adding entries
- View profit trends chart
- Navigate to "Add Purchase"
- Enter ingredient name, quantity, and unit cost
- Select purchase date
- View calculated total cost
- Submit to save the purchase
- Navigate to "Add Sale"
- Enter sale amount and description
- Select sale date
- Use quick amount buttons for common values
- Submit to record the sale
- Navigate to "Add Expense"
- Select expense category from dropdown
- Enter amount and description
- Select expense date
- Submit to record the expense
- Navigate to "Reports"
- Select time filter (daily/weekly/monthly/yearly)
- View financial summary cards
- Analyze data tables and charts
- Export data as needed
src/
βββ components/
β βββ Navigation.js # Main navigation component
βββ pages/
β βββ Login.js # Authentication page
β βββ Dashboard.js # Main dashboard with overview
β βββ AddPurchase.js # Purchase entry form
β βββ AddSale.js # Sales entry form
β βββ AddExpense.js # Expense entry form
β βββ Reports.js # Reports and analytics page
βββ services/
β βββ api.js # API service functions
βββ utils/
β βββ helpers.js # Utility functions
βββ App.js # Main app component with routing
βββ index.css # Global styles with Tailwind
- Modify
tailwind.config.jsfor theme customization - Update
src/index.cssfor global styles - Component-specific styles are in Tailwind classes
- Update API endpoints in
src/services/api.js - Modify request/response handling as needed
- Add new API functions for additional features
- Add new pages in
src/pages/ - Create reusable components in
src/components/ - Extend utility functions in
src/utils/helpers.js
npm start- Start development servernpm build- Build for productionnpm test- Run testsnpm eject- Eject from Create React App
- ESLint configuration included
- Prettier formatting recommended
- Component-based architecture
- Responsive design principles
- Chrome (recommended)
- Firefox
- Safari
- Edge
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
For issues or questions:
- Check the documentation
- Review the code structure
- Create an issue with detailed information
Built with β€οΈ using React and Tailwind CSS