A comprehensive Sales, Inventory, and Tax Compliance management tool for small businesses in Rwanda.
Public URL - https://tracki-4c91b.web.app/login
- Multi-user Support: Role-based access control (Admin and sales representative)
- Sales Management: Record sales with automatic VAT calculations
- Tax Compliance: RRA VAT calculations and tax reports
- Data Export: Export reports to PDF and Excel formats
- Offline Support: Basic offline persistence for viewing data
- Mobile Responsive: Works seamlessly on desktop and mobile devices
- Frontend: React (Vite), React Router, Tailwind CSS
- Backend: Firebase (Authentication, Firestore, Cloud Functions, Cloud Storage)
- Key Libraries:
react-router-dom- Client-side routingjspdf&xlsx- Data exportreact-hot-toast- Notificationsdate-fns- Date utilities
Tracki/
├── src/
│ ├── components/
│ │ ├── common/ # Reusable UI components
│ │ ├── dashboard/ # Dashboard widgets
│ │ ├── reports/ # Report components
│ │ └── layout/ # Layout components (Navbar, Sidebar, PrivateRoute)
│ ├── contexts/
│ │ └── AuthContext.jsx # Authentication context
│ ├── hooks/
│ │ └── useAuth.js # Auth hook
│ ├── pages/
│ │ ├── Dashboard.jsx
│ │ ├── LoginPage.jsx
│ │ ├── RecordSale.jsx
│ │ ├── Reports.jsx
│ │ ├── Inventory.jsx
│ │ └── Settings.jsx
│ ├── services/
│ │ ├── firebase.js # Firebase initialization
│ │ ├── authService.js # Authentication service
│ │ └── firestoreService.js # Firestore operations
│ ├── utils/
│ │ ├── taxCalculator.js # RRA VAT calculations
│ │ └── exportUtils.js # PDF/Excel export
│ ├── App.jsx # Main app router
│ └── main.jsx
├── functions/ # Firebase Cloud Functions
├── firebase.json # Firebase configuration
├── firestore.rules # Firestore security rules
└── firestore.indexes.json # Firestore indexes
- Node.js (v18 or higher)
- npm or yarn
- Firebase account
- Firebase CLI (
npm install -g firebase-tools)
npm install-
Create a Firebase project at Firebase Console
-
Enable the following services:
- Authentication (Email/Password)
- Firestore Database
- Cloud Functions
- Cloud Storage (optional, for storing exports)
-
Get your Firebase configuration:
- Go to Project Settings > General
- Scroll down to "Your apps" and add a web app
- Copy the Firebase configuration object
-
Environment Configuration: Create a .env file in the root directory (do not commit this file). Add your Firebase config keys:
VITE_FIREBASE_API_KEY=your_api_key
VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
VITE_FIREBASE_PROJECT_ID=your_project_id
VITE_FIREBASE_STORAGE_BUCKET=your_project.firebasestorage.app
VITE_FIREBASE_MESSAGING_SENDER_ID=your_id
VITE_FIREBASE_APP_ID=your_app_id
- Go to Firestore Database in Firebase Console
- Create the database in production mode (we'll use security rules)
- Deploy Firestore rules and indexes:
firebase login
firebase init firestore
firebase deploy --only firestore:rules,firestore:indexes- In Firebase Console, go to Authentication
- Enable "Email/Password" sign-in method
- (Optional) Configure authorized domains
cd functions
npm install
cd ..You'll need to manually create the initial business and user data in Firestore:
-
Create a business document in the
businessescollection:{ "name": "Your Business Name", "ownerId": "user-uid-here", "rraVatRate": 0.18 } -
Create a user document in the
userscollection (doc ID = auth.uid):{ "email": "admin@example.com", "name": "Admin User", "businessId": "business-id-here", "role": "admin" }
npm run devThe application will be available at http://localhost:yourport
- Doc ID:
auth.uid - Fields:
email,name,businessId,role('admin' | 'standard')
- Doc ID:
businessId(unique ID) - Fields:
name,ownerId,rraVatRate(e.g., 0.18 for 18%)
- Doc ID:
productId(unique ID) - Fields:
businessId,name,price,currentStock
- Doc ID:
saleId(unique ID) - Fields:
businessIdrecordedByUserIdcreatedAt(Timestamp)items(Array of{productId, productName, quantity, pricePerItem})paymentMethodsubtotalvatAmounttotal
- Full access to all features
- Can view Reports and Settings
- Can manage inventory
- Can record sales
- Can view Dashboard
- Can record sales
- Can view inventory (read-only)
A scheduled function that runs every Friday at 9:00 AM (Rwanda time) to generate and email weekly sales summaries to admin users.
To deploy:
firebase deploy --only functions:sendWeeklySalesReportNote: The email functionality is stubbed. You'll need to:
- Set up an email service (SendGrid, Mailgun, etc.)
- Install the email service package
- Configure API keys in Firebase Functions config
- Uncomment and configure the email sending code in
functions/index.js
An HTTP function for testing report generation:
https://your-region-your-project.cloudfunctions.net/generateSalesReport?businessId=YOUR_BUSINESS_ID
The application includes basic offline persistence for Firestore. Data is cached locally and can be viewed offline. Full offline transaction support (with sync) requires additional implementation.
- PDF Export: Uses jsPDF to generate formatted sales reports
- Excel Export: Uses xlsx to generate spreadsheet reports
Both exports include:
- Transaction details
- Summary statistics (Total Sales, Total VAT, Grand Total)
- Date range information
Firestore security rules are configured to:
- Restrict access based on user authentication
- Enforce business-level data isolation
- Limit write operations based on user roles
npm run buildnpm run preview##Login Screen screenshots\Screenshot 2025-11-28 004950.png
##User Dashboard screenshots\Screenshot 2025-11-28 005027.png
- Firebase configuration errors: Ensure your Firebase config in
src/services/firebase.jsis correct - Permission denied errors: Check Firestore security rules and user authentication
- Offline persistence errors: Ensure IndexedDB is enabled in your browser
- Export not working: Check browser console for errors related to jsPDF or xlsx
- Full offline transaction support with sync
- Email notifications for low stock
- Advanced analytics and charts
- Multi-business support for users
- Receipt generation
- Barcode scanning for products
- Mobile app (React Native)
This project is private and proprietary.
For issues and questions, please contact the development team.