A comprehensive web application for analyzing Amazon FBA product profitability with advanced fee calculations, batch processing, and detailed analytics.
- Excel Batch Upload: Import product data via Excel files with ASIN, prices, and dimensions
- Single Product Entry: Manually add individual products with Amazon data auto-fetch
- Amazon Data Integration: Automatically fetch product information from Amazon
- Comprehensive Fee Calculation: 14 different fee types including referral, closing, shipping, storage, and more
- Real-time Dashboard: Overview of total revenue, profit, and profit margins
- Advanced Filtering: Filter products by category, fulfillment method, and profit margins
- Data Export: Export filtered results to Excel/CSV format
- Admin Panel: Manage category-specific referral fees
- Referral Fee: Category-based percentage of selling price
- Closing Fee: Fixed fee based on price range
- Shipping Fee: Weight and region-based shipping costs
- Pick & Pack Fee: FBA fulfillment costs
- Storage Fee: Monthly storage costs based on volume
- Removal Fee: Cost for removing inventory
- Total Other Costs: Additional miscellaneous costs
- Tax Calculations: GST tax credit and payable amounts
- Net Earnings: Final profit after all fees and taxes
- Profit Margins: Percentage-based profitability analysis
- Frontend: Next.js 15, React 19, TypeScript 5
- UI Components: shadcn/ui, Tailwind CSS
- Backend: Next.js API Routes, Prisma ORM
- Database: SQLite
- File Processing: XLSX library for Excel handling
- Data Scraping: Cheerio + Axios for Amazon data extraction
- Error Handling: Custom error boundaries with graceful fallbacks
-
Clone the repository
git clone <repository-url> cd amazon-fba-calculator
-
Install dependencies
npm install
-
Set up the database
npm run db:push
-
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:3000
- View overall profitability metrics
- Monitor total revenue, fees, and profit margins
- Track product count and average profit percentages
- Click "Add Product" tab to access the single product form
- Enter ASIN (Amazon Standard Identification Number)
- Optionally click "Fetch Data" to auto-fill product information from Amazon
- Manually enter required details:
- Selling Price (required)
- Weight (required)
- Dimensions (optional)
- Category selection
- Fulfillment method (FBA/FBM)
- STEP level
- Click "Add Product" to save and calculate fees automatically
- Prepare an Excel file with the following columns:
- ASIN (required)
- Product Name (optional)
- Selling Price (required)
- Weight (kg) (required)
- Length (cm) (optional)
- Width (cm) (optional)
- Height (cm) (optional)
- Click "Upload Products" and select your Excel file
- The system will automatically fetch missing product data from Amazon
- Browse all uploaded products in the Products tab
- Use filters to analyze specific segments:
- Search by ASIN or product name
- Filter by category
- Filter by fulfillment method (FBA/FBM)
- Filter by profit margin range
- Click the eye icon to view detailed fee breakdowns
- Export filtered results using the "Export Filtered" button
- Access at
/adminto manage category referral fees - Add, edit, or delete category-specific fee structures
- Set price ranges and corresponding referral percentages
- Import default Amazon fee categories
Create a .env.local file in the root directory:
# Database
DATABASE_URL="file:./dev.db"
# Next.js
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key"
# Amazon (optional for enhanced scraping)
AMAZON_USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"The application uses Prisma ORM with SQLite. Key tables:
- ProductCalculations: Stores product data and calculated fees
- CategoryFees: Manages category-specific referral fee structures
GET /api/products- Retrieve all products with paginationPOST /api/products- Create new product entriesPOST /api/products/single- Add single product with fee calculationGET /api/products/export- Export products as Excel file
POST /api/fetch-amazon-data- Fetch product data from Amazon using ASIN
GET /api/dashboard- Get summary statistics
GET /api/admin/category-fees- Retrieve category fee structuresPOST /api/admin/category-fees- Create new category feePUT /api/admin/category-fees/:id- Update category feeDELETE /api/admin/category-fees/:id- Delete category fee
Category-based percentage calculated on selling price:
referralFee = sellingPrice * (referralFeePercent / 100)Fixed fees based on price ranges:
- βΉ0-250: βΉ26
- βΉ251-500: βΉ12
- βΉ501-1000: βΉ20
- βΉ1001+: βΉ35
Weight and region-based:
- Local: βΉ40-120 based on weight
- Regional: βΉ50-150 based on weight
- National: βΉ60-180 based on weight
Calculated monthly based on product volume:
storageFee = (length * width * height / 28316.84) * monthlyRateThe application includes comprehensive error handling:
- Error Boundaries: Graceful fallbacks for component errors
- API Error Handling: Proper error responses and user notifications
- File Upload Validation: Checks for required fields and data types
- Data Validation: Validates Amazon data before processing
npm run build
npm startFROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
EXPOSE 3000
CMD ["npm", "start"]npm run lint # Run ESLint
npm run type-check # Run TypeScript checksnpm run db:push # Push schema changes
npm run db:studio # Open Prisma Studio- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the GitHub repository
- Check the troubleshooting section below
Q: Upload fails with "Invalid file format" A: Ensure your Excel file has the correct column headers and data types
Q: Amazon data not fetching A: Check your internet connection and verify ASINs are correct
Q: Calculations seem incorrect A: Verify category assignments and check admin panel for fee structures
Q: Application crashes A: Check browser console for errors and try refreshing the page