Skip to content

Reshigan/SalesSync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ SalesSync - Enterprise Field Force & Van Sales Platform

Production License Node.js React

Complete field operations management platform with real-time tracking, route optimization, inventory management, KYC, surveys, analytics & commission tracking.

🌐 Live Demo: https://ss.gonxt.tech


πŸ“‹ Table of Contents


✨ Features

πŸ“Š Analytics & Dashboards

  • Executive Dashboard with KPIs
  • Advanced Analytics with customizable date ranges
  • Real-time performance metrics
  • Revenue, conversion & growth tracking

🚚 Van Sales Management

  • Route planning & optimization
  • Inventory tracking in real-time
  • Order management
  • Mobile-friendly agent interface

🎯 Field Operations

  • Live GPS tracking & mapping
  • Visit management & scheduling
  • Photo capture for verification
  • Activity timeline tracking

πŸ’Ό Field Marketing

  • Board placement management
  • Brand activation campaigns
  • Product distribution tracking
  • Commission calculation & tracking

πŸ“ KYC & Surveys

  • Customer KYC collection
  • Custom survey builder
  • Response analytics
  • Approval workflows

πŸ’° Finance & Invoicing

  • Invoice generation & management
  • Payment collection tracking
  • Multi-currency support
  • Financial reports

πŸ‘₯ User Management

  • Role-based access control (RBAC)
  • Multi-tenant architecture
  • Audit logging
  • User activity tracking

🎨 UX Features

  • Toast notifications (success/error/warning/info)
  • Skeleton loaders for smooth loading
  • Error boundaries with fallback UI
  • Responsive mobile design
  • Dark mode support (coming soon)

πŸ”‘ Demo Credentials

Admin Access

Tenant:   demo
Email:    [email protected]
Password: admin123

Agent Access

Tenant:   demo
Email:    [email protected]
Password: agent123

πŸ› οΈ Tech Stack

Frontend

  • Framework: React 18.3.1 + TypeScript
  • Build Tool: Vite 5.4
  • Routing: React Router v6
  • State Management: Zustand
  • UI Components: Custom + Tailwind CSS
  • Charts: Recharts
  • Icons: Lucide React
  • HTTP Client: Axios
  • PWA: Vite PWA Plugin

Backend

  • Runtime: Node.js v18.20.8
  • Framework: Express.js
  • Database: SQLite (production) / PostgreSQL ready
  • Authentication: JWT
  • Process Manager: systemd
  • Reverse Proxy: Nginx

Infrastructure

  • Hosting: AWS EC2 (Ubuntu 24.04)
  • SSL: Let's Encrypt (Certbot)
  • Domain: ss.gonxt.tech
  • CI/CD: GitHub Actions ready

πŸš€ Quick Start

Prerequisites

  • Node.js >= 18.0.0
  • npm >= 9.0.0

Local Development

  1. Clone the repository

    git clone https://github.com/Reshigan/SalesSync.git
    cd SalesSync
  2. Backend Setup

    cd backend-api
    npm install
    
    # Create .env file
    cp .env.example .env
    
    # Start development server
    npm run dev
    # Server runs on http://localhost:3001
  3. Frontend Setup

    cd frontend-vite
    npm install
    
    # Start development server
    npm run dev
    # App runs on http://localhost:5173
  4. Access the application


πŸ—οΈ Architecture

Directory Structure

SalesSync/
β”œβ”€β”€ backend-api/           # Express.js API server
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ server.js      # Main entry point
β”‚   β”‚   β”œβ”€β”€ routes/        # API routes
β”‚   β”‚   β”œβ”€β”€ middleware/    # Auth, CORS, etc.
β”‚   β”‚   └── db/            # Database models & migrations
β”‚   β”œβ”€β”€ database/          # SQLite database files
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend-vite/         # React + Vite frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ pages/         # 63+ lazy-loaded pages
β”‚   β”‚   β”œβ”€β”€ components/    # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ store/         # Zustand stores
β”‚   β”‚   β”œβ”€β”€ services/      # API service layer
β”‚   β”‚   β”œβ”€β”€ utils/         # Helper functions
β”‚   β”‚   └── App.tsx        # Main app with routing
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   └── package.json
β”‚
└── README.md              # This file

Key Components

Frontend Architecture

  • Lazy Loading: All 63 pages are code-split for optimal performance
  • Suspense: Smooth loading transitions with skeleton loaders
  • Error Boundaries: Page-level error handling with fallback UI
  • Protected Routes: Role-based access control
  • Toast System: Global notification management with Zustand
  • API Client: Centralized Axios instance with interceptors

Backend Architecture

  • RESTful API: Standard HTTP methods (GET, POST, PUT, DELETE)
  • JWT Authentication: Secure token-based auth
  • Multi-tenant: Tenant isolation in database
  • SQLite: Embedded database for simplicity (PostgreSQL ready)
  • Systemd: Auto-restart on failure
  • CORS: Configured for cross-origin requests

🌐 Deployment

Production Server

  • Host: [email protected]
  • Domain: https://ss.gonxt.tech
  • SSL: Let's Encrypt (expires 2026-01-09)
  • Frontend: /var/www/salessync
  • Backend: /var/www/salessync-api
  • Database: /var/www/salessync-api/database/salessync.db

Deployment Process

1. Build Frontend

cd frontend-vite
npm run build
# Output: dist/ folder (~2MB gzipped)

2. Deploy Frontend

# Create tarball
tar -czf salessync-dist.tar.gz dist/

# Upload to server
scp salessync-dist.tar.gz [email protected]:/tmp/

# Extract on server
ssh [email protected]
cd /var/www/salessync
sudo tar -xzf /tmp/salessync-dist.tar.gz
sudo chown -R www-data:www-data dist

3. Deploy Backend

# Upload backend files
rsync -avz backend-api/ [email protected]:/var/www/salessync-api/

# SSH to server
ssh [email protected]
cd /var/www/salessync-api
npm install --production

# Restart service
sudo systemctl restart salessync-api.service
sudo systemctl status salessync-api.service

4. Verify Deployment

# Check frontend
curl -I https://ss.gonxt.tech

# Check backend
curl https://ss.gonxt.tech/api/health

Systemd Service Configuration

File: /etc/systemd/system/salessync-api.service

[Unit]
Description=SalesSync API Server
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/var/www/salessync-api
Environment=NODE_ENV=production
Environment=PORT=3001
ExecStart=/usr/bin/node /var/www/salessync-api/src/server.js
Restart=always
RestartSec=10s
StandardOutput=append:/var/www/salessync-api/logs/stdout.log
StandardError=append:/var/www/salessync-api/logs/stderr.log

[Install]
WantedBy=multi-user.target

Nginx Configuration

File: /etc/nginx/sites-available/salessync

server {
    listen 80;
    server_name ss.gonxt.tech;
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name ss.gonxt.tech;

    ssl_certificate /etc/letsencrypt/live/ss.gonxt.tech/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/ss.gonxt.tech/privkey.pem;

    # Frontend
    location / {
        root /var/www/salessync/dist;
        try_files $uri $uri/ /index.html;
    }

    # Backend API
    location /api {
        proxy_pass http://localhost:3001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

πŸ“‘ API Documentation

Base URL

Production: https://ss.gonxt.tech/api
Development: http://localhost:3001/api

Authentication

All protected endpoints require JWT token in Authorization header:

Authorization: Bearer <your-jwt-token>

Key Endpoints

Authentication

POST   /api/auth/login          # User login
POST   /api/auth/register       # User registration
POST   /api/auth/logout         # Logout
GET    /api/auth/me             # Get current user

Users

GET    /api/users               # List users (admin)
GET    /api/users/:id           # Get user details
PUT    /api/users/:id           # Update user
DELETE /api/users/:id           # Delete user

Customers

GET    /api/customers           # List customers
POST   /api/customers           # Create customer
GET    /api/customers/:id       # Get customer details
PUT    /api/customers/:id       # Update customer

Orders

GET    /api/orders              # List orders
POST   /api/orders              # Create order
GET    /api/orders/:id          # Get order details
PUT    /api/orders/:id          # Update order status

Products

GET    /api/products            # List products
POST   /api/products            # Create product
GET    /api/products/:id        # Get product details
PUT    /api/products/:id        # Update product

Analytics

GET    /api/analytics/dashboard # Dashboard KPIs
GET    /api/analytics/revenue   # Revenue analytics
GET    /api/analytics/sales     # Sales metrics

Health Check

GET    /api/health              # Server health status

Response Format

{
  "success": true,
  "data": { ... },
  "message": "Operation successful"
}

Error Response

{
  "success": false,
  "error": "Error message",
  "code": "ERROR_CODE"
}

πŸ’» Development

Available Scripts

Frontend

npm run dev          # Start dev server (port 5173)
npm run build        # Production build
npm run preview      # Preview production build
npm run lint         # Run ESLint
npm run type-check   # TypeScript type checking

Backend

npm run dev          # Start with nodemon
npm start            # Start production server
npm run test         # Run tests (coming soon)
npm run migrate      # Run database migrations

Environment Variables

Frontend (.env)

VITE_API_URL=http://localhost:3001/api
VITE_APP_ENV=development

Backend (.env)

NODE_ENV=production
PORT=3001
JWT_SECRET=your-secret-key
DATABASE_PATH=./database/salessync.db
CORS_ORIGIN=https://ss.gonxt.tech

πŸ“Š Performance Metrics

Frontend Bundle Size

  • Initial Chunk: ~142 KB (vendor)
  • Route Chunks: 3-94 KB each (63+ chunks)
  • Total Build: ~2 MB (uncompressed)
  • Gzipped: ~600 KB
  • Build Time: ~13 seconds

Lighthouse Score (Target)

  • Performance: 90+
  • Accessibility: 95+
  • Best Practices: 90+
  • SEO: 95+

Backend Performance

  • Response Time: <100ms average
  • Uptime: 99.9%
  • Database: SQLite (5ms avg query)
  • Memory: <100 MB usage

πŸ—ΊοΈ Roadmap

Phase 10: SEO & Meta Tags βœ…

  • Enhanced meta descriptions
  • Open Graph tags
  • Twitter Card tags
  • Canonical URLs

Phase 11: Final Testing ⏳

  • E2E test suite
  • API integration tests
  • Performance testing
  • Security audit

Phase 12: Documentation ⏳

  • README.md
  • API documentation (Swagger)
  • Deployment guide
  • Contributing guidelines

Future Enhancements

  • Dark mode UI
  • Real-time notifications (WebSocket)
  • Mobile app (React Native)
  • Advanced reporting
  • Multi-language support
  • Automated tests (Vitest + Playwright)
  • PostgreSQL migration
  • Docker containerization
  • Kubernetes deployment

🀝 Contributing

We welcome contributions! Please follow these steps:

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

πŸ“„ License

This project is licensed under the MIT License.


πŸ‘₯ Team

Lead Developer: Reshigan
GitHub: https://github.com/Reshigan


πŸŽ‰ Recent Updates

v1.3.0 (2025-10-23)

  • βœ… Fixed backend systemd service conflicts
  • ⚑ Added lazy loading & code splitting (63+ chunks)
  • πŸ›‘οΈ Added PageErrorBoundary component
  • πŸ“ Enhanced SEO meta tags
  • πŸ“š Comprehensive README documentation

v1.2.0 (2025-10-22)

  • βœ… Added Toast notification system
  • βœ… Added Skeleton loader components
  • βœ… Deployed Analytics & Finance modules
  • βœ… SSL certificate installed

v1.1.0 (2025-10-21)

  • βœ… Initial production deployment
  • βœ… 13 business modules completed
  • βœ… Multi-tenant architecture
  • βœ… JWT authentication

Built with ❀️ by the SalesSync Team
Visit Production β†’

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •