114 lines
2.4 KiB
Markdown
114 lines
2.4 KiB
Markdown
# PetShop
|
|
|
|
A pet store management application with a Spring Boot API serving three clients: a Next.js web app, a JavaFX desktop app, and an Android app.
|
|
|
|
Handles product sales, pet adoption, appointment booking, real-time chat, AI assistance, payments (Stripe), email notifications (Resend), and file storage (Azure Blob).
|
|
|
|
## Tech Stack
|
|
|
|
| Layer | Technology |
|
|
|-------|------------|
|
|
| API | Java 25, Spring Boot 4, Spring Security (JWT), Hibernate |
|
|
| Database | MySQL 8.0, Flyway migrations |
|
|
| Web | Next.js 16, React 19, Tailwind CSS 4 |
|
|
| Desktop | JavaFX, Maven |
|
|
| Android | Kotlin, Hilt, Retrofit, CameraX |
|
|
| Infra | Docker, Azure Container Apps |
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
main/
|
|
backend/ Spring Boot REST API
|
|
web/ Next.js frontend
|
|
desktop/ JavaFX desktop client
|
|
android/ Android mobile app
|
|
```
|
|
|
|
## Prerequisites
|
|
|
|
- Java 25
|
|
- Node.js 18+
|
|
- Docker
|
|
- Maven
|
|
- Android Studio (for mobile)
|
|
|
|
## Getting Started
|
|
|
|
### 1. Start the database
|
|
|
|
```sh
|
|
cd backend
|
|
docker compose -f docker-compose.dev.yml up -d
|
|
```
|
|
|
|
### 2. Configure the backend
|
|
|
|
```sh
|
|
cd backend
|
|
cp .env.example .env
|
|
```
|
|
|
|
Fill in `.env` with your keys:
|
|
|
|
```
|
|
JWT_SECRET=<openssl rand -base64 32>
|
|
STRIPE_SECRET_KEY=sk_test_...
|
|
OPENROUTER_API_KEY=sk-or-v1-...
|
|
RESEND_API_KEY=re_...
|
|
RESEND_FROM=PetShop <no-reply@yourdomain.com>
|
|
```
|
|
|
|
### 3. Run the backend
|
|
|
|
```sh
|
|
cd backend
|
|
mvn spring-boot:run
|
|
```
|
|
|
|
The API starts at `http://localhost:8080`. Flyway runs migrations and seeds data automatically on first boot.
|
|
|
|
### 4. Run the web frontend
|
|
|
|
```sh
|
|
cd web
|
|
cp .env.example .env.local
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
The web app starts at `http://localhost:3000`.
|
|
|
|
### 5. Run the desktop client (optional)
|
|
|
|
```sh
|
|
cd desktop
|
|
cp connectionpetstore.properties.example connectionpetstore.properties
|
|
mvn javafx:run
|
|
```
|
|
|
|
### 6. Run the Android app (optional)
|
|
|
|
Open `android/` in Android Studio and run on an emulator or device.
|
|
|
|
## API
|
|
|
|
A Postman collection is available at `backend/postman/`. Key endpoint groups:
|
|
|
|
- `/api/auth` -- registration, login, password reset
|
|
- `/api/products` -- catalog and inventory
|
|
- `/api/pets` -- listings and adoption
|
|
- `/api/appointments` -- booking
|
|
- `/api/cart`, `/api/sales`, `/api/refunds` -- transactions
|
|
- `/api/chat` -- messaging and AI assistant
|
|
- `/ws` -- WebSocket (STOMP) for real-time updates
|
|
|
|
## Docker (full stack)
|
|
|
|
```sh
|
|
cd backend
|
|
docker compose up --build -d
|
|
```
|
|
|
|
Starts the API and MySQL together. The web frontend has its own Dockerfile for independent deployment.
|