# SmartBucket

SmartBucket is a full-stack personal finance application for tracking income, expenses, balances, debts, lending, savings targets, and shared expenses.

## Project structure

```text
smartbucket/
├── smartbucket-backend/   # Laravel REST API
└── smartbucket-frontend/  # React and Vite web application
```

## Technology stack

- Backend: PHP 8.2+, Laravel 12, Laravel Sanctum, MySQL
- Frontend: React 19, Vite, Zustand, Axios, Chart.js
- Exports and documentation: DomPDF, PhpSpreadsheet, L5-Swagger

## Prerequisites

Install the following before starting:

- PHP 8.2 or newer
- Composer
- MySQL
- Node.js and npm

## Backend setup

```bash
cd smartbucket-backend
composer install
cp .env.example .env
php artisan key:generate
```

Create a MySQL database, then update the database values in `smartbucket-backend/.env`:

```env
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=expense_tracker
DB_USERNAME=root
DB_PASSWORD=
```

Run the migrations and start the API:

```bash
php artisan migrate
php artisan serve
```

The API is available at `http://localhost:8000`.

## Frontend setup

Open another terminal from the repository root:

```bash
cd smartbucket-frontend
npm install
cp .env.example .env
npm run dev
```

The default frontend environment points to:

```env
VITE_API_URL=http://localhost:8000/api
VITE_APP_NAME=SmartBucket
```

Vite prints the local frontend URL when the development server starts.

## Useful commands

### Backend

```bash
php artisan test
php artisan l5-swagger:generate
php artisan optimize:clear
```

### Frontend

```bash
npm run lint
npm run build
npm run preview
```

## Environment files

Real `.env` files are ignored by Git. Copy the supplied `.env.example` files and keep credentials and other secrets only in your local environment.

## Additional documentation

- Backend overview: [`smartbucket-backend/README.md`](smartbucket-backend/README.md)
- Backend setup notes: [`smartbucket-backend/SETUP.md`](smartbucket-backend/SETUP.md)