A modern analytics dashboard built with React, Node.js, and PostgreSQL, featuring real-time data visualization, order management, and comprehensive analytics.
- π Real-time analytics visualization
- π¦ Order management system
- π Revenue tracking by state
- π Multi-currency support (Default: INR)
- π Secure authentication system
- π± Responsive design
- π¨ Modern UI with Tailwind CSS
- π³ Docker support for easy deployment
- Clone the repository:
git clone <repository-url>
cd analytics-dashboard- Make the Docker script executable:
chmod +x docker.sh- Start the application:
./docker.sh startThe application will be available at:
- Frontend: http://localhost
- Backend API: http://localhost:5001
- Make the startup script executable:
chmod +x start.sh- Run the startup script:
./start.sh- Node.js (v14 or higher)
- npm (v6 or higher)
- PostgreSQL (v12 or higher)
- Docker and Docker Compose (for Docker setup)
Copy the example environment file:
cp server/.env.example server/.envUpdate the following variables in server/.env:
PORT=5001
JWT_SECRET=your_jwt_secret_key
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=localhost
DB_PORT=5432
DB_NAME=analytics_dashboard./docker.sh start # Start all services
./docker.sh stop # Stop all services
./docker.sh restart # Restart all services
./docker.sh build # Rebuild all services
./docker.sh logs # Show logs
./docker.sh ps # Show running services
./docker.sh clean # Remove all containers and volumes
./docker.sh db-reset # Reset the database./start.sh # Start both client and server
npm run dev # Start development server
npm run build # Build for production
npm run test # Run testsanalytics-dashboard/
βββ client/ # React frontend
β βββ src/
β β βββ components/ # Reusable components
β β βββ pages/ # Page components
β β βββ store/ # State management
β β βββ utils/ # Utility functions
β βββ public/ # Static files
β βββ Dockerfile # Client Docker configuration
βββ server/ # Node.js backend
β βββ config/ # Configuration files
β βββ database/ # Database schemas and migrations
β βββ middleware/ # Express middleware
β βββ routes/ # API routes
β βββ Dockerfile # Server Docker configuration
βββ docker-compose.yml # Docker composition
βββ start.sh # Local startup script
βββ docker.sh # Docker management script
Create a new migration:
cd server
node database/migrate.js create add-new-tableRun migrations:
node database/migrate.js upRun server tests:
cd server
npm testRun client tests:
cd client
npm test- Build the images:
./docker.sh build- Start the services:
./docker.sh start- Build the client:
cd client
npm run build- Start the server:
cd server
NODE_ENV=production npm start- JWT authentication
- Rate limiting
- CORS protection
- SQL injection prevention
- XSS protection
- Security headers
- Input validation
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- If containers fail to start:
./docker.sh logs- Reset the environment:
./docker.sh clean
./docker.sh start- Reset the database:
./docker.sh db-reset- Check database logs:
docker-compose logs db-
Port conflicts:
- Ensure ports 80, 5001, and 5432 are available
- Change ports in docker-compose.yml if needed
-
Permission issues:
- Ensure scripts are executable:
chmod +x *.sh - Run with sudo if needed (Docker commands)
- Ensure scripts are executable:
-
Database connection fails:
- Check PostgreSQL credentials in .env
- Ensure database service is running