A modern, interactive web application for calculating delivery fees based on cart value, distance, number of items, and time of delivery. Built with React, TypeScript, and Framer Motion for smooth animations.
- Real-time Fee Calculation: Instantly calculate delivery fees based on multiple factors
- Rush Hour Pricing: Automatic 20% surcharge for Friday deliveries between 3-7 PM
- Responsive Design: Works seamlessly on desktop and mobile devices
- Smooth Animations: Beautiful UI transitions powered by Framer Motion
- Type-Safe: Built with TypeScript for better code quality and developer experience
- Comprehensive Testing: Full test coverage with Jest and React Testing Library
- €2 base fee for all deliveries
- If cart value < €10, add €2 surcharge
- If cart value < €10 and exactly 4 items, €2 surcharge only
- Free delivery for cart value ≥ €100
- €0.50 per item for orders with more than 4 items
- Additional €1.20 bulk fee for orders with more than 12 items
- €1 per 500m beyond the first 1000m
- Maximum delivery fee capped at €15
- 20% surcharge on Fridays between 15:00-19:00 (3 PM - 7 PM)
- Frontend: React 18.3.1
- Language: TypeScript 5.9.3
- Styling: CSS with animations
- Animations: Framer Motion 12.25.0
- Icons: React Icons 5.3.0
- Build Tool: Create React App
- Testing: Jest, React Testing Library
- Package Manager: npm
- Clone the repository:
git clone https://github.com/gq23401/delivery-fee-app.git
cd delivery-fee-app- Install dependencies:
npm install- Start the development server:
npm start- Open http://localhost:3000 in your browser.
- Enter the cart value in euros
- Input the delivery distance in meters
- Specify the number of items in the cart
- Select the day of the week (0=Sunday, 6=Saturday)
- Enter the delivery hour (0-23)
- Click "Calculate Delivery price" to see the result
Run the test suite:
npm testRun tests in watch mode:
npm test -- --watchAll=falsenpm run buildThis creates an optimized production build in the build folder.
src/
├── App.css # Main styles
├── App.tsx # Main application component
├── App.test.tsx # App component tests
├── index.tsx # Application entry point
├── reportWebVitals.ts # Performance monitoring
├── types/
│ └── index.ts # TypeScript type definitions
└── utilityFunctions.ts # Business logic functions
└── utilityFunctions.test.ts # Utility function tests
Calculates the base surcharge based on cart value and item count.
Calculates additional fees for items beyond the threshold.
Main function that calculates the total delivery fee including all factors.
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make your changes and add tests
- Run tests:
npm test - Commit your changes:
git commit -am 'Add feature' - Push to the branch:
git push origin feature-name - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built as a demonstration of modern React development practices
- Inspired by real-world delivery fee calculation systems
- Uses open-source libraries and tools
Last updated: March 15, 2026
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify