A comprehensive sales reporting system consisting of a React frontend and Node.js backend for sales agents to log their shop visits, record customer contacts, and track sales activities through a chat-based interface.
This project is organized as a monorepo with separate repositories for frontend and backend:
- 📱 Frontend: sales-report-client - React/TypeScript application
- 🖥️ Backend: sales-report-server - Node.js/Express API server
- Node.js (v16 or higher)
- npm (v7 or higher)
- A Supabase account with a configured database
- GitHub CLI (optional, for automated repository creation)
-
Create GitHub repositories:
./create-github-repos.sh
-
Clone the repositories:
git clone https://github.com/IAmDuck-Jelly/sales-report-client.git git clone https://github.com/IAmDuck-Jelly/sales-report-server.git
-
Set up the backend:
cd sales-report-server npm install cp .env.example .env # Edit .env with your Supabase credentials npm run dev
-
Set up the frontend:
cd ../sales-report-client npm install cp .env.example .env # Edit .env with your Supabase credentials npm run dev
-
Create repositories manually on GitHub.com:
sales-report-client(public)sales-report-server(public)
-
Push the code to each repository:
# For client cd client git remote add origin https://github.com/IAmDuck-Jelly/sales-report-client.git git push -u origin main # For server cd ../server git remote add origin https://github.com/IAmDuck-Jelly/sales-report-server.git git push -u origin main
Create server/.env:
PORT=3002
NODE_ENV=development
SUPABASE_URL=your-supabase-url
SUPABASE_SERVICE_KEY=your-supabase-service-key
CORS_ORIGIN=http://localhost:5173Create client/.env:
VITE_API_URL=http://localhost:3002/api
VITE_SUPABASE_URL=your-supabase-url
VITE_SUPABASE_ANON_KEY=your-supabase-anon-key
VITE_SUPABASE_SERVICE_ROLE_KEY=your-supabase-service-role-key
VITE_DEVELOPMENT_MODE=true- Chat-based Data Entry: Intuitive conversational interface
- Location Tracking: Automatic GPS coordinate capture
- Shop Autocomplete: Smart search functionality
- Customer Contact Management: Record and manage contacts
- Phone Number Handling: Automatic phone number management
- Responsive Design: Works on desktop and mobile
- RESTful API: Complete API for sales activities
- Authentication: Employee ID validation
- Data Validation: Comprehensive input validation
- Database Integration: Supabase integration
- Error Handling: Robust error handling and logging
- Security: Helmet.js and CORS configuration
- Frontend Documentation: See client/README.md
- Backend Documentation: See server/README.md
- Database Schema: See database-schema.md
- Deployment Guide: See DEPLOYMENT.md
-
Start both servers:
# Terminal 1 - Backend cd sales-report-server npm run dev # Terminal 2 - Frontend cd sales-report-client npm run dev
-
Access the application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:3002/api
- Health Check: http://localhost:3002/api/health
-
Test with employee ID:
EMP001
The application uses Supabase (PostgreSQL) with these key tables:
sales_agents- Sales agent informationcustomer- Customer/shop informationsales_daily_activities- Daily sales activitiescustomer_contacts- Contacts at customer locationsphone- Phone numbers for contacts
POST /api/auth/validate- Validate employee ID
GET /api/customers/search- Search customers
POST /api/activities/create- Create activityPUT /api/activities/update/:id- Update activity
POST /api/contacts/create- Create contactPUT /api/contacts/update/:id- Update contact
POST /api/phone/manage- Manage phone numbers
See DEPLOYMENT.md for detailed deployment instructions for:
- Vercel (Frontend)
- Railway/Heroku (Backend)
- Supabase (Database)
- Fork the repositories
- Create feature branches
- Make your changes
- Submit pull requests
This project is licensed under the MIT License.
For support, please open an issue on the respective repository: