A modern, real-time smart scale system built with React, TypeScript, and Firebase. This application provides intelligent product detection, automatic weighing, and seamless billing for fruits and vegetables.
- Real-time Product Detection: Automatically detects and identifies fruits and vegetables
- Smart Weighing: Instant weight measurement with high accuracy
- Dynamic Pricing: Real-time price calculation based on weight and product type
- Session Management: Track multiple items in a single shopping session
- Firebase Integration: Real-time data synchronization and persistence
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Code Splitting: Optimized bundle with lazy-loaded components
- Real-time Updates: Live data streaming from Firebase
- Error Handling: Robust error management and user feedback
- TypeScript: Full type safety and better development experience
- Modern Interface: Clean, intuitive design with Tailwind CSS
- Loading States: Smooth loading animations and feedback
- Toast Notifications: Real-time user feedback
- Confirmation Dialogs: User-friendly product confirmation flow
- Status Indicators: Clear visual feedback for scale and connection status
- React 19 - Modern React with latest features
- TypeScript - Type-safe JavaScript
- Vite - Fast build tool and dev server
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Accessible component primitives
- Lucide React - Beautiful icons
- Firebase Realtime Database - Real-time data synchronization
- Firebase Auth - User authentication
- Firebase Firestore - Document database
- Firebase Storage - File storage
- ESLint - Code linting
- PostCSS - CSS processing
- Terser - JavaScript minification
- SWC - Fast TypeScript/JavaScript compiler
- Node.js 18+
- npm or yarn
- Firebase project setup
git clone https://github.com/Jockey12https/SmartScale.git
cd SmartScale/Miniproject
npm install
Create a .env.local
file in the root directory:
# Firebase Configuration
VITE_FIREBASE_API_KEY=your_api_key_here
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_DATABASE_URL=https://your_project.firebaseio.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.appspot.com
VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
VITE_FIREBASE_APP_ID=your_app_id
- Create a new Firebase project at Firebase Console
- Enable Realtime Database
- Set up authentication (optional)
- Copy your Firebase config to the
.env.local
file
npm run dev
Open http://localhost:5173 to view it in the browser.
npm run build
npm run preview
- Push your code to GitHub
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy automatically
Miniproject/
βββ src/
β βββ components/ # React components
β β βββ ui/ # Reusable UI components
β β βββ BillingSystem.tsx
β β βββ ProductDetection.tsx
β β βββ ScaleDisplay.tsx
β β βββ WeightPricing.tsx
β βββ lib/ # Utility libraries
β β βββ firebase.ts # Firebase configuration
β β βββ scaleService.ts # Scale data management
β β βββ utils.ts # Helper functions
β βββ hooks/ # Custom React hooks
β βββ pages/ # Page components
βββ public/ # Static assets
βββ dist/ # Build output
βββ vercel.json # Vercel configuration
βββ package.json # Dependencies and scripts
npm run dev
- Start development servernpm run build
- Build for productionnpm run preview
- Preview production buildnpm run lint
- Run ESLintnpm run setup-firebase
- Setup Firebase configuration
- Click "Start Detection" to activate the scale
- Place your fruit or vegetable on the scale
- The system will automatically detect and weigh the item
- Review the detected product and weight
- Make corrections if needed
- Click "Confirm" to add to cart
- View all items in your cart
- Remove items if needed
- Proceed to checkout when ready
- Review your total
- Complete the transaction
- Start a new session
{
"SmartScale": {
"data": {
"timestamp": {
"weight": 1.5,
"item": "Apple",
"price": 2.99,
"timestamp": "1703123456789"
}
}
}
}
{
"sessions": {
"sessionId": {
"id": "sessionId",
"startTime": 1703123456789,
"endTime": 1703123456789,
"items": [...],
"total": 15.99,
"status": "completed"
}
}
}
- Code Splitting: Components are lazy-loaded for faster initial load
- Bundle Optimization: Manual chunking for better caching
- Tree Shaking: Unused code elimination
- Image Optimization: Optimized images and lazy loading
- Caching: Strategic caching for better performance
-
Firebase Connection Failed
- Check your environment variables
- Verify Firebase project configuration
- Ensure database rules allow read/write
-
Build Errors
- Clear node_modules and reinstall:
rm -rf node_modules && npm install
- Check TypeScript errors:
npm run build
- Clear node_modules and reinstall:
-
Deployment Issues
- Verify Vercel configuration
- Check environment variables in Vercel dashboard
- Ensure build command is correct
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
This project is licensed under the ISC License - see the LICENSE file for details.
Your Name
- GitHub: @Jockey12https
- Email: jithinsj123@gmail.com
- Firebase for real-time database
- Radix UI for accessible components
- Tailwind CSS for styling
- Vite for fast development experience
β Star this repository if you found it helpful!