A full-stack web application for visualizing customer order data with interactive charts and comprehensive data management.
- Dashboard Overview: Key metrics including total orders, revenue, and customer count
- Interactive Charts:
- Orders over time (line chart)
- Revenue by customer (bar chart)
- Order status distribution (pie chart)
- Data Tables: Paginated customer and order listings
- Filtering & Sorting: Filter by date range, customer, and order status
- Responsive Design: Works seamlessly on desktop and mobile devices
- Frontend: React 18 + TypeScript + Tailwind CSS
- Backend: Node.js + Express
- Database: PostgreSQL
- Charts: Chart.js with react-chartjs-2
- Icons: Lucide React
- Node.js (v16 or higher)
- PostgreSQL database
- npm or yarn package manager
For the fastest setup, run the quick start script:
./quick-start.shThis script will:
- Check prerequisites (Node.js, PostgreSQL)
- Install dependencies
- Create environment file
- Test database connection
- Provide setup instructions
First, create a PostgreSQL database and run the provided SQL schema:
# Create database
psql -U postgres
CREATE DATABASE customer_orders;
\q
# Run the schema
psql -U postgres -d customer_orders -f customer-order.sql
# (Optional) Add sample data
psql -U postgres -d customer_orders -f sample-data.sql-
Copy the example environment file:
cp .env.example .env
-
Update the
.envfile with your database credentials:DB_HOST=localhost DB_PORT=5432 DB_NAME=customer_orders DB_USER=postgres DB_PASSWORD=your_password_here PORT=3001
npm installThe application will start both frontend and backend servers:
npm run dev- Frontend: http://localhost:5173
- Backend API: http://localhost:3001
GET /api/dashboard- Dashboard metricsGET /api/customers- Customer list with paginationGET /api/orders- Order list with filtering and paginationGET /api/charts/orders-over-time- Orders timeline dataGET /api/charts/revenue-by-customer- Revenue by customer dataGET /api/charts/order-status- Order status distribution
├── src/
│ ├── components/ # React components
│ ├── services/ # API service functions
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Utility functions
├── backend/
│ ├── db/ # Database schema and connection
│ ├── routes/ # Express route handlers
│ └── server.js # Express server setup
├── .env # Environment variables
└── README.md
Sample data is provided in sample-data.sql. To populate your database:
psql -U postgres -d customer_orders -f sample-data.sqlThis will add 10 customers and 30 orders with realistic data for testing the application features.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License