A modern Point of Sale (POS) system built with React.js and JSON Server. This application provides a complete solution for managing products, processing orders, and generating receipts.
Production URL: https://main.d139itpg7gxdkm.amplifyapp.com/
- Product Management: Browse and manage product catalog
- Shopping Cart: Add/remove items with real-time calculations
- Receipt Generation: Print receipts with order details
- Order Queue: Track and manage pending orders
- Responsive Design: Works on desktop and mobile devices
- Real-time Updates: Live product and cart synchronization
- Frontend: React 18, React Router DOM
- Backend: JSON Server (Mock API)
- Styling: Bootstrap CSS
- Print: React-to-Print, jsPDF
- HTTP Client: Axios
- Notifications: React Toastify
- Deployment: AWS Amplify
- Containerization: Docker
myPOS-app/
├── public/ # Static assets
├── src/
│ ├── components/ # Reusable components
│ │ ├── print/ # Print-related components
│ │ ├── Cart.jsx # Shopping cart component
│ │ ├── ProductList.jsx # Product display component
│ │ └── ComponentToPrint.jsx # Receipt template
│ ├── hooks/ # Custom React hooks
│ │ ├── useCart.js # Cart management logic
│ │ └── useProducts.js # Product fetching logic
│ ├── layouts/ # Layout components
│ ├── pages/ # Page components
│ │ ├── Home.jsx # Landing page
│ │ ├── POS.jsx # Main POS interface
│ │ └── OrderQueue.jsx # Order management
│ ├── services/ # API services
│ └── App.js # Main application component
├── db.json # Mock database
├── Dockerfile # Docker configuration
├── docker-compose.yml # Docker Compose setup
└── package.json # Dependencies and scripts
- Node.js (v16 or higher)
- Yarn package manager
- Git
-
Clone the repository
git clone <repository-url> cd myPOS-app
-
Install dependencies
yarn install
-
Start the JSON Server (Backend)
yarn server
This starts the mock API server on
http://localhost:8000 -
Start the React App (Frontend)
yarn start
This starts the development server on
http://localhost:3000
yarn start- Start the React development serveryarn server- Start the JSON Server backendyarn build- Build the app for productionyarn test- Run the test suiteyarn eject- Eject from Create React App
# Build and start both services
docker-compose up --build
# Run in detached mode
docker-compose up -d --build# Build the image
docker build -t mypos-app .
# Run the container
docker run -p 3001:3000 -p 8001:8000 mypos-appThe JSON Server provides the following endpoints:
GET /products- Fetch all productsGET /products/:id- Fetch a specific productPOST /products- Create a new productPUT /products/:id- Update a productDELETE /products/:id- Delete a product
{
"id": 123,
"name": "Orange",
"price": "2",
"image": "https://example.com/orange.jpg"
}- Navigate to
/posto access the main POS system - Browse products in the left panel
- Click on products to add them to the cart
- Review items in the cart on the right panel
- Click "Print Receipt" to generate a receipt
- Navigate to
/order-queueto view pending orders - Track order status and manage queue
Create a .env file in the root directory:
REACT_APP_API_URL=http://localhost:8000
NODE_ENV=developmentThe json-server.json file contains server configuration:
{
"port": 8000,
"watch": true,
"static": "./public"
}The app is deployed on AWS Amplify with automatic builds from the main branch.