A full-stack web application for ordering raw chicken meat products, inspired by Licious.in. This monorepo contains both the customer-facing application and the admin dashboard.
/ChickenViken/
├── /admin-app/ # Admin dashboard (React + Vite)
├── /user-app/ # Customer-facing app (React + Vite)
├── /server/ # Express backend (optional)
├── /scripts/ # Setup and utility scripts
├── /functions/ # Firebase Cloud Functions
├── .gitignore
├── README.md
├── DEPLOYMENT_GUIDE.md # Detailed deployment instructions
├── RENDER_WEB_SERVICE_GUIDE.md # Render-specific deployment guide
├── render.yaml # Render deployment configuration
└── .env.sample # Sample environment variables
- Frontend: React.js (with Vite)
- Backend (optional): Express.js
- Database: Firebase Firestore
- Authentication: Firebase Auth
- Hosting: Render
- CI/CD: GitHub + Render Git Integration
- Authentication: Login/Signup using Firebase Auth
- User Profile Management: Personal info, addresses (CRUD)
- Product Browsing & Ordering
- Cart Management with persistent storage
- Items stored in localStorage
- Pending items for non-logged-in users
- Quantity management and price calculation
- Payment Processing
- Phase 1: Mock payment UI inspired by BharatPe (for testing and design validation)
- Phase 2 (Final Iteration): Integrate real payment gateway (e.g., Razorpay, Stripe, Paytm)
- Responsive & Animated UI
- Secure Authentication for admin users
- Dashboard with Sales Analytics
- Order Management
- Inventory Management
- Real-time Charts & Reporting
-
Node.js and npm
- Install Node.js v16 or later from nodejs.org
- Verify installation:
node --version npm --version
-
Firebase Setup You need two Firebase projects:
a. User Firebase Project (
chickenviken-30bd9)- Used for user authentication
- User profiles and data
- Order management
- Cart persistence
b. Admin Firebase Project (
chickenviken-admin)- Used for admin authentication
- Product and inventory management
- Admin dashboard data
-
Clone the repository
git clone https://github.com/yourusername/ChickenViken.git cd ChickenViken -
Set up environment variables
Create .env files in both user-app and admin-app directories:
For user-app/.env:
# User Firebase Configuration VITE_FIREBASE_API_KEY= VITE_FIREBASE_AUTH_DOMAIN= VITE_FIREBASE_PROJECT_ID=chickenviken-30bd9 VITE_FIREBASE_STORAGE_BUCKET= VITE_FIREBASE_MESSAGING_SENDER_ID= VITE_FIREBASE_APP_ID= VITE_FIREBASE_MEASUREMENT_ID= # Admin Firebase Configuration (for product data) VITE_ADMIN_FIREBASE_API_KEY= VITE_ADMIN_FIREBASE_AUTH_DOMAIN= VITE_ADMIN_FIREBASE_PROJECT_ID=chickenviken-admin VITE_ADMIN_FIREBASE_STORAGE_BUCKET= VITE_ADMIN_FIREBASE_MESSAGING_SENDER_ID= VITE_ADMIN_FIREBASE_APP_ID= VITE_ADMIN_FIREBASE_MEASUREMENT_ID=For admin-app/.env:
# Admin Firebase Configuration VITE_ADMIN_FIREBASE_API_KEY= VITE_ADMIN_FIREBASE_AUTH_DOMAIN= VITE_ADMIN_FIREBASE_PROJECT_ID=chickenviken-admin VITE_ADMIN_FIREBASE_STORAGE_BUCKET= VITE_ADMIN_FIREBASE_MESSAGING_SENDER_ID= VITE_ADMIN_FIREBASE_APP_ID= VITE_ADMIN_FIREBASE_MEASUREMENT_ID= # User Firebase Configuration (for order management) VITE_USER_FIREBASE_API_KEY= VITE_USER_FIREBASE_AUTH_DOMAIN= VITE_USER_FIREBASE_PROJECT_ID=chickenviken-30bd9 VITE_USER_FIREBASE_STORAGE_BUCKET= VITE_USER_FIREBASE_MESSAGING_SENDER_ID= VITE_USER_FIREBASE_APP_ID=
-
Install dependencies for all applications
# Install root dependencies npm install # Install user-app dependencies cd user-app npm install # Install admin-app dependencies cd ../admin-app npm install # Install server dependencies (if using) cd ../server npm install
-
Firebase Setup
a. Deploy Firestore Security Rules:
# For user app cd user-app firebase deploy --only firestore:rules # For admin app cd ../admin-app firebase deploy --only firestore:rules
b. Create Initial Super Admin:
cd ../scripts node create-super-admin.js -
Initialize Development Data (Optional)
cd scripts node init-emulator-data.js
-
Start User App (Development)
cd user-app npm run devAccess at: http://localhost:5173
-
Start Admin App (Development)
cd admin-app npm run devAccess at: http://localhost:5174
-
Start Backend Server (Optional)
cd server npm run devAccess at: http://localhost:5000
For local development, you can use Firebase emulators:
-
Start Emulators
cd scripts .\start-emulators.bat # On Windows # OR ./start-emulators.sh # On Unix-like systems
-
Enable Emulators in Apps Set in your .env files:
VITE_USE_FIREBASE_EMULATORS=true
The project uses two sets of security rules:
-
User App Rules (
user-app/firestore.rules)- Users can only read/write their own user document
- Users can only create/read orders they own
- Products are read-only for all users
-
Admin App Rules (
admin-app/firestore.rules)- Only authenticated admins can access admin data
- Super admins have full access
- Regular admins have role-based access
- Run Firebase emulators for local development
- Use the user app to create and test the user experience
- Use the admin app to manage products, orders, and users
- Test changes in the emulator before deploying
ChickenViken is configured for deployment on Render.com using the following setup:
-
User App (
chickenviken-user-app)- Type: Web Service (Static Site)
- Build Command:
cd user-app && npm install && npm run build - Publish Directory:
user-app/dist
-
Admin App (
chickenviken-admin-app)- Type: Web Service (Static Site)
- Build Command:
cd admin-app && npm install && npm run build - Publish Directory:
admin-app/dist
-
Backend API (
chickenviken-api)- Type: Web Service
- Build Command:
cd server && npm install - Start Command:
cd server && npm run start
If you're deploying manually to Render or another platform:
-
Build the applications
# Build user app cd user-app npm install && npm run build # Build admin app cd ../admin-app npm install && npm run build
-
Serve the built applications
# Serve user app cd user-app npx serve -s dist # Serve admin app cd ../admin-app npx serve -s dist
For detailed deployment instructions, see:
- DEPLOYMENT_GUIDE.md - General deployment guide
- RENDER_WEB_SERVICE_GUIDE.md - Render-specific instructions
- render.yaml - Render configuration file
-
Firebase Connection Issues
- Verify your Firebase configuration in .env files
- Check if Firebase project IDs match
- Ensure Firebase rules are properly deployed
-
Build Errors
- Clear the node_modules and rebuild:
rm -rf node_modules npm install
- Check for environment variables
- Clear the node_modules and rebuild:
-
Runtime Errors
- Check browser console for error messages
- Verify Firebase rules allow the operation
- Check if you're using the correct Firebase project
- Fork the repository
- Create your feature branch:
git checkout -b feature/NewFeature - Commit your changes:
git commit -am 'Add NewFeature' - Push to the branch:
git push origin feature/NewFeature - Submit a pull request
/src/components- Reusable UI components (Cart, Navbar, ProductCard, etc.)/src/contexts- React Context providers (Auth, Cart)/src/firebase- Firebase configuration and utilities/src/hooks- Custom React hooks/src/pages- Application pages (Products, Cart, Checkout, etc.)/src/services- API and service integrations/src/utils- Utility functions
/src/components- Dashboard components and UI elements/src/contexts- Admin authentication context/src/firebase- Admin Firebase configuration/src/hooks- Custom admin hooks/src/pages- Admin dashboard pages (Orders, Inventory, etc.)/src/services- Admin services (Cloudinary, Orders)/src/utils- Admin utility functions
- Simple Express backend for handling API requests
- Integration with Firebase Admin SDK
- Admin user management scripts
- Firebase emulator configuration
- Seeding scripts for development data
The cart system uses React Context API and localStorage for persistence:
- Manages cart state with React hooks
- Persists cart items in localStorage
- Handles:
- Adding items to cart
- Updating item quantities
- Removing items
- Calculating totals
- Preserving pending items for non-logged-in users
- Persistence: Cart items are saved in localStorage to persist across sessions
- Guest Cart: Non-logged-in users can add items, which are stored as pending items
- Quantity Management: Increment/decrement item quantities, with automatic removal when quantity reaches zero
- Price Calculation: Automatic total calculation based on item prices and quantities
- Error Handling: Robust error handling for invalid items or localStorage issues
Recent updates to the project:
-
Deployment Configuration
- Updated render.yaml for proper deployment of static sites
- Added serve package to both apps for flexible deployment options
- Streamlined build and deployment commands
-
Documentation
- Enhanced README with detailed project structure
- Added comprehensive deployment guides
- Created deployment checklists for consistent deployments
- Documented cart implementation
-
User Experience
- Improved cart persistence mechanism
- Enhanced error handling for cart operations
- Added pending cart items for non-logged-in users
-
Project Structure
- Organized components for better maintainability
- Separated contexts for cleaner state management
- Improved error boundaries throughout the application