A secure, multi-tenant web application for convenience store management with Firebase backend, featuring invoice generation, customer management, product tracking, and comprehensive security controls.
This application has been hardened against data breaches, unauthorized access, and credential leaks. See:
- π ZERO_DATA_BREACH_CHECKLIST.md - Complete security verification
- π SECURITY_AUDIT_REPORT.md - Detailed audit findings
- π‘οΈ web/SECURITY.md - Security implementation guide
- Professional invoice generation with store branding
- Automatic profit/margin calculations
- Invoice printing with QR codes
- Payment tracking (paid/pending/overdue)
- Invoice history and search
- Customer profiles with contact details
- Purchase history tracking
- Credit balance management
- Customer activity highlights
- Search and filtering
- Product catalog with pricing
- Stock level tracking
- Category organization
- Tax rate management per category
- Low stock alerts
- Real-time sales metrics
- Revenue and profit tracking
- Top customers and products
- Pending invoice count
- Recent activity feed
- Email/password authentication
- Email verification required
- User-specific data isolation
- Input sanitization (XSS/SQL injection protection)
- Rate limiting
- Secure Firestore rules
- Node.js 16+ and npm
- Firebase account (console.firebase.google.com)
- Git
git clone <your-repo-url>
cd convinence_store/webnpm install- Go to Firebase Console
- Create new project (or use existing)
- Enable Authentication β Email/Password
- Enable Firestore Database
- Get your Firebase config:
- Project Settings β General β Your apps β SDK setup
# Copy example env file
cp .env.example .env.local
# Edit .env.local with your Firebase credentials
nano .env.localAdd your Firebase credentials:
REACT_APP_FIREBASE_API_KEY=your_api_key_here
REACT_APP_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
REACT_APP_FIREBASE_PROJECT_ID=your-project-id
REACT_APP_FIREBASE_STORAGE_BUCKET=your-project.storage.app
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=your_sender_id
REACT_APP_FIREBASE_APP_ID=1:your_app_id:web:your_app_id
REACT_APP_FIREBASE_MEASUREMENT_ID=G-YOUR_MEASUREMENT_ID.env.local to version control! (Already blocked by .gitignore)
# Install Firebase CLI
npm install -g firebase-tools
# Login to Firebase
firebase login
# Initialize Firebase (if not already)
firebase init firestore
# Deploy security rules
firebase deploy --only firestore:rulesnpm startApp will open at http://localhost:3000
- Click "Sign Up"
- Enter email and password
- Verify email (check inbox/spam)
- Complete store profile setup
- Start managing your store!
convinence_store/
βββ .env.example # Environment variable template
βββ .gitignore # Git ignore rules (SECURITY CRITICAL)
βββ SECURITY_AUDIT_REPORT.md # Security audit findings
βββ ZERO_DATA_BREACH_CHECKLIST.md # Security verification
βββ web/ # React web application
β βββ .env.local # Firebase credentials (GITIGNORED)
β βββ firestore.rules # Firestore security rules
β βββ SECURITY.md # Security documentation
β βββ public/
β β βββ index.html
β βββ src/
β βββ auth/ # Authentication flows
β β βββ AuthContext.js # Auth state management
β β βββ Login.js # Login page
β β βββ Signup.js # Signup page
β β βββ EmailVerification.js # Email verification
β β βββ ProfileSetup.js # Store profile setup
β β βββ ProtectedRoute.js # Route guard
β β βββ ProfileGuard.js # Profile completion guard
β βββ pages/ # Main application pages
β β βββ Dashboard.js # Analytics dashboard
β β βββ Invoices.js # Invoice list
β β βββ CreateInvoice.js # Invoice creation
β β βββ PendingInvoices.js # Pending payments
β β βββ Customers.js # Customer list
β β βββ CustomerHistory.js # Customer details
β β βββ Products.js # Product catalog
β β βββ Profile.js # User profile
β βββ components/ # Reusable components
β β βββ Header.js # Navigation header
β β βββ CurrencySelector.js # Currency switcher
β βββ shared/
β β βββ config/
β β β βββ firebaseConfig.js # Firebase setup
β β βββ services/ # Business logic
β β βββ authService.js # Authentication
β β βββ customerService.js # Customer CRUD
β β βββ productService.js # Product CRUD
β β βββ invoiceService.js # Invoice CRUD
β β βββ categoryService.js # Category CRUD
β β βββ dataManagementService.js # Data cleanup
β βββ utils/ # Utility functions
β β βββ securityUtils.js # Security helpers
β β βββ invoicePrintUtils.js # Invoice printing
β β βββ currencyUtils.js # Currency formatting
β β βββ migrationUtils.js # Data migration
β β βββ serviceTestUtils.js # Testing utilities
β βββ styles/
β β βββ global.css # Global styles
β β βββ design-system.css # Design tokens
β βββ App.js # Root component
β βββ index.js # Entry point
βββ shared/ # Shared code (mobile/web)
βββ config/
β βββ firebaseConfig.js
βββ services/
-
Credential Protection
- All secrets in
.env.local(gitignored) - No hardcoded API keys
- Runtime config validation
- All secrets in
-
Firestore Security
- User-specific data collections
- Authentication required for all operations
- Email verification enforced
- Cross-user access blocked
-
Input Validation
- XSS protection (DOMPurify)
- SQL injection prevention (Firestore SDK)
- Email/phone validation
- Rate limiting
-
Authentication
- Email/password login
- Email verification required
- Profile setup enforced
- Protected routes
-
Data Isolation
- User-specific Firestore paths
- No shared collections
- Query scoping by user ID
Before deploying to production:
-
.env.localcreated with Firebase credentials - Firestore rules deployed (
firebase deploy --only firestore:rules) - Email verification enabled in Firebase Console
- Environment variables set in hosting platform
- Build artifacts not committed to git
- Security audit report reviewed
See ZERO_DATA_BREACH_CHECKLIST.md for complete verification steps.
Run this automated script before any deployment:
cd web
./pre-deploy.shThis ensures:
- β Environment variables are configured
- β Dependencies are installed
- β
Production build is created (
npm run build) - β Build is optimized and ready
Or build manually:
cd web
npm run buildπ See QUICK-DEPLOY-GUIDE.md for detailed deployment instructions
π https://web-p4jrkb90h-9bishals-projects.vercel.app
The app is successfully deployed and running on Vercel!
β Project Setup Complete
- Project:
web - Status: β Ready (Production)
- Platform: Vercel
-
Build First
β οΈ cd web npm run build -
Install Vercel CLI (if not already installed)
npm install -g vercel
-
Set Environment Variables (in Vercel Dashboard)
- Go to Project Settings
- Add all
REACT_APP_FIREBASE_*variables from.env.local
-
Deploy to Production
cd web vercel --prod -
Deploy Preview (for testing)
cd web vercel
-
Build First
β οΈ cd web npm run build -
Build Command (in Netlify Dashboard)
npm run build -
Publish Directory
build -
Environment Variables (in Netlify Dashboard)
- Site Settings β Build & Deploy β Environment
- Add all
REACT_APP_FIREBASE_*variables
-
Deploy
npm install -g netlify-cli netlify deploy --prod --dir=build
-
Build First
β οΈ cd web npm run build -
Initialize
firebase init hosting
-
Set Environment Variables
- Ensure
.env.localexists before building - Variables are baked into build
- Ensure
-
Deploy
cd web npm run build firebase deploy --only hosting
π¨ CRITICAL: After deploying, add your domain to Firebase:
- Go to Firebase Console
- Select your project
- Navigate to Authentication β Settings β Authorized domains
- Click Add domain
- Add your production URL:
- For Vercel:
your-app.vercel.app - For Netlify:
your-app.netlify.app - Custom domain:
yourdomain.com
- For Vercel:
Without this step, users will see authentication errors!
π For complete deployment guide, see:
# Unit tests
npm test
# Test Firestore services
node src/utils/serviceTestUtils.js
# Test data migration
node src/utils/migrationUtils.js# Check for hardcoded secrets
grep -r "AIzaSy" --exclude-dir=node_modules --exclude="*.env*" .
# Verify gitignore
git check-ignore .env.local
# Test Firestore rules
# Use Firebase Console β Firestore β Rules β Rules Playground- SECURITY.md - Security implementation guide
- SECURITY_AUDIT_REPORT.md - Audit findings
- ZERO_DATA_BREACH_CHECKLIST.md - Security verification
- MULTI_USER_IMPLEMENTATION.md - Multi-tenancy guide
Error: Firebase configuration is incomplete!
Solution:
- Ensure
.env.localexists inweb/directory - Verify all
REACT_APP_FIREBASE_*variables are set - Restart development server
Error: Missing or insufficient permissions.
Solution:
- Deploy Firestore rules:
firebase deploy --only firestore:rules - Verify email is verified (check Firebase Console β Authentication)
- Ensure user has completed profile setup
Error: Cannot find module 'firebase'
Solution:
rm -rf node_modules package-lock.json
npm install- Fork repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
Security Note: Never commit .env.local or build artifacts!
This project is proprietary and confidential.
π¨ DO NOT open public issues for security vulnerabilities!
Email: [[email protected]]
Open an issue on GitHub with:
- Steps to reproduce
- Expected vs actual behavior
- Screenshots (if applicable)
- Browser/OS information
- Multi-user authentication
- User-specific data isolation
- Invoice management
- Customer tracking
- Product catalog
- Category management
- Dashboard analytics
- Security hardening
- Mobile app (React Native)
- Advanced reporting
- Multi-store support
- Barcode scanning
- Inventory forecasting
- Automated reordering
- Supplier management
- Employee management
- POS integration
- Frontend: React 18
- Backend: Firebase (Firestore, Auth)
- Styling: CSS3 with custom design system
- Security: DOMPurify, rate limiting, input validation
- Deployment: Vercel / Netlify / Firebase Hosting
Version: 2.0
Last Updated: November 19, 2025
Security Status: π’ Production-Ready