Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Mobile inventory management app for retail stores. Track products, manage stock levels, process sales, and generate reports - all from your smartphone.

Notifications You must be signed in to change notification settings

9bishal/Convinence-Store

Repository files navigation

πŸͺ Convenience Store - Multi-User Management System

A secure, multi-tenant web application for convenience store management with Firebase backend, featuring invoice generation, customer management, product tracking, and comprehensive security controls.


πŸ” SECURITY FIRST

This application has been hardened against data breaches, unauthorized access, and credential leaks. See:


✨ Features

🧾 Invoice Management

  • 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 Management

  • Customer profiles with contact details
  • Purchase history tracking
  • Credit balance management
  • Customer activity highlights
  • Search and filtering

πŸ“¦ Product Management

  • Product catalog with pricing
  • Stock level tracking
  • Category organization
  • Tax rate management per category
  • Low stock alerts

πŸ“Š Dashboard Analytics

  • Real-time sales metrics
  • Revenue and profit tracking
  • Top customers and products
  • Pending invoice count
  • Recent activity feed

πŸ”’ Security & Authentication

  • Email/password authentication
  • Email verification required
  • User-specific data isolation
  • Input sanitization (XSS/SQL injection protection)
  • Rate limiting
  • Secure Firestore rules

πŸš€ Quick Start

Prerequisites

1. Clone Repository

git clone <your-repo-url>
cd convinence_store/web

2. Install Dependencies

npm install

3. Configure Firebase

A. Create Firebase Project

  1. Go to Firebase Console
  2. Create new project (or use existing)
  3. Enable Authentication β†’ Email/Password
  4. Enable Firestore Database
  5. Get your Firebase config:
    • Project Settings β†’ General β†’ Your apps β†’ SDK setup

B. Set Environment Variables

# Copy example env file
cp .env.example .env.local

# Edit .env.local with your Firebase credentials
nano .env.local

Add 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

⚠️ NEVER commit .env.local to version control! (Already blocked by .gitignore)

C. Deploy Firestore Security Rules

# 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:rules

4. Run Development Server

npm start

App will open at http://localhost:3000

5. Create Your First Account

  1. Click "Sign Up"
  2. Enter email and password
  3. Verify email (check inbox/spam)
  4. Complete store profile setup
  5. Start managing your store!

πŸ—οΈ Project Structure

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/

πŸ›‘οΈ Security Features

βœ… Implemented

  1. Credential Protection

    • All secrets in .env.local (gitignored)
    • No hardcoded API keys
    • Runtime config validation
  2. Firestore Security

    • User-specific data collections
    • Authentication required for all operations
    • Email verification enforced
    • Cross-user access blocked
  3. Input Validation

    • XSS protection (DOMPurify)
    • SQL injection prevention (Firestore SDK)
    • Email/phone validation
    • Rate limiting
  4. Authentication

    • Email/password login
    • Email verification required
    • Profile setup enforced
    • Protected routes
  5. Data Isolation

    • User-specific Firestore paths
    • No shared collections
    • Query scoping by user ID

πŸ“‹ Security Checklist

Before deploying to production:

  • .env.local created 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.


πŸš€ Deployment

⚠️ CRITICAL: Always Build Before Deploying

Run this automated script before any deployment:

cd web
./pre-deploy.sh

This 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


Live Production URL 🌐

πŸ”— https://web-p4jrkb90h-9bishals-projects.vercel.app

The app is successfully deployed and running on Vercel!

Vercel Deployment

βœ… Project Setup Complete

  • Project: web
  • Status: ● Ready (Production)
  • Platform: Vercel

Quick Deploy Steps

  1. Build First ⚠️

    cd web
    npm run build
  2. Install Vercel CLI (if not already installed)

    npm install -g vercel
  3. Set Environment Variables (in Vercel Dashboard)

  4. Deploy to Production

    cd web
    vercel --prod
  5. Deploy Preview (for testing)

    cd web
    vercel

Netlify

  1. Build First ⚠️

    cd web
    npm run build
  2. Build Command (in Netlify Dashboard)

    npm run build
    
  3. Publish Directory

    build
    
  4. Environment Variables (in Netlify Dashboard)

    • Site Settings β†’ Build & Deploy β†’ Environment
    • Add all REACT_APP_FIREBASE_* variables
  5. Deploy

    npm install -g netlify-cli
    netlify deploy --prod --dir=build

Firebase Hosting

  1. Build First ⚠️

    cd web
    npm run build
  2. Initialize

    firebase init hosting
  3. Set Environment Variables

    • Ensure .env.local exists before building
    • Variables are baked into build
  4. Deploy

    cd web
    npm run build
    firebase deploy --only hosting

Post-Deployment: Firebase Configuration

🚨 CRITICAL: After deploying, add your domain to Firebase:

  1. Go to Firebase Console
  2. Select your project
  3. Navigate to Authentication β†’ Settings β†’ Authorized domains
  4. Click Add domain
  5. Add your production URL:
    • For Vercel: your-app.vercel.app
    • For Netlify: your-app.netlify.app
    • Custom domain: yourdomain.com

Without this step, users will see authentication errors!

πŸ“– For complete deployment guide, see:


πŸ§ͺ Testing

Run Tests

# Unit tests
npm test

# Test Firestore services
node src/utils/serviceTestUtils.js

# Test data migration
node src/utils/migrationUtils.js

Security Testing

# 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

πŸ“š Documentation


πŸ› Troubleshooting

Firebase Not Initialized

Error: Firebase configuration is incomplete!

Solution:

  • Ensure .env.local exists in web/ directory
  • Verify all REACT_APP_FIREBASE_* variables are set
  • Restart development server

Permission Denied (Firestore)

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

Build Fails

Error: Cannot find module 'firebase'

Solution:

rm -rf node_modules package-lock.json
npm install

🀝 Contributing

  1. Fork repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

Security Note: Never commit .env.local or build artifacts!


πŸ“„ License

This project is proprietary and confidential.


πŸ†˜ Support

Security Issues

🚨 DO NOT open public issues for security vulnerabilities!

Email: [[email protected]]

Bug Reports

Open an issue on GitHub with:

  • Steps to reproduce
  • Expected vs actual behavior
  • Screenshots (if applicable)
  • Browser/OS information

🎯 Roadmap

Completed βœ…

  • Multi-user authentication
  • User-specific data isolation
  • Invoice management
  • Customer tracking
  • Product catalog
  • Category management
  • Dashboard analytics
  • Security hardening

In Progress 🚧

  • Mobile app (React Native)
  • Advanced reporting
  • Multi-store support
  • Barcode scanning

Planned πŸ“‹

  • Inventory forecasting
  • Automated reordering
  • Supplier management
  • Employee management
  • POS integration

πŸ“Š Tech Stack

  • 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

About

Mobile inventory management app for retail stores. Track products, manage stock levels, process sales, and generate reports - all from your smartphone.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published