106 lines
2.9 KiB
Markdown
106 lines
2.9 KiB
Markdown
# Cashback Tracker
|
|
|
|
A comprehensive web application for tracking debit card cashback rewards. Built with React + TypeScript frontend, Node.js + Express + SQLite backend, and deployed with Docker Compose.
|
|
|
|
## Features
|
|
|
|
- **Card Management**: Add, edit, and delete debit cards with details
|
|
- **Category Management**: Manage cashback categories (groceries, gas, etc.)
|
|
- **Monthly Category Assignment**: Assign categories to cards with specific cashback percentages each month
|
|
- **Transaction Tracking**: Record purchases and automatically calculate cashback
|
|
- **Dashboard**: View current month's cashback summary with filtering options
|
|
- **Responsive Design**: Works seamlessly on desktop and mobile devices
|
|
|
|
## Tech Stack
|
|
|
|
- **Frontend**: React 18, TypeScript, TailwindCSS, Shadcn/UI, React Router
|
|
- **Backend**: Node.js, Express.js, SQLite3
|
|
- **Deployment**: Docker & Docker Compose
|
|
|
|
## Quick Start
|
|
|
|
### Using Docker Compose (Recommended)
|
|
|
|
1. Clone the repository
|
|
2. Run the application:
|
|
|
|
```bash
|
|
docker-compose up --build
|
|
```
|
|
|
|
3. Access the application:
|
|
- Frontend: http://localhost:3000
|
|
- Backend API: http://localhost:3001
|
|
|
|
### Development Setup
|
|
|
|
#### Frontend
|
|
```bash
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
#### Backend
|
|
```bash
|
|
cd server
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
## Database Schema
|
|
|
|
- **cards**: Store debit card information
|
|
- **categories**: Cashback categories (groceries, gas, etc.)
|
|
- **monthly_categories**: Monthly assignment of categories to cards with percentages
|
|
- **transactions**: Purchase records with automatic cashback calculation
|
|
|
|
## API Endpoints
|
|
|
|
- `GET /api/cards` - Get all cards
|
|
- `POST /api/cards` - Create new card
|
|
- `GET /api/categories` - Get all categories
|
|
- `POST /api/categories` - Create new category
|
|
- `GET /api/monthly-categories/:year/:month` - Get monthly assignments
|
|
- `POST /api/monthly-categories` - Create monthly assignment
|
|
- `GET /api/transactions/:year/:month` - Get transactions by month
|
|
- `POST /api/transactions` - Create transaction (auto-calculates cashback)
|
|
- `GET /api/cashback/:year/:month` - Get cashback summary with filtering
|
|
|
|
## Usage
|
|
|
|
1. **Setup Cards**: Add your debit cards with bank information
|
|
2. **Create Categories**: Define cashback categories (groceries, gas, dining, etc.)
|
|
3. **Monthly Assignment**: Each month, assign categories to cards with their cashback percentages
|
|
4. **Track Transactions**: Add purchases to automatically calculate and track cashback
|
|
5. **Monitor Dashboard**: View monthly summaries and filter by card or category
|
|
|
|
## Docker Commands
|
|
|
|
```bash
|
|
# Build and run
|
|
docker-compose up --build
|
|
|
|
# Run in background
|
|
docker-compose up -d
|
|
|
|
# View logs
|
|
docker-compose logs -f
|
|
|
|
# Stop services
|
|
docker-compose down
|
|
|
|
# Remove volumes (reset database)
|
|
docker-compose down -v
|
|
```
|
|
|
|
## Contributing
|
|
|
|
1. Fork the repository
|
|
2. Create a feature branch
|
|
3. Commit your changes
|
|
4. Push to the branch
|
|
5. Create a Pull Request
|
|
|
|
## License
|
|
|
|
MIT License - see LICENSE file for details |