# Simple Template

## Quick Start

This project contains:

- `backend`: Spring Boot admin API.
- `frontend/web`: Vite + Vue 3 admin frontend.
- `frontend/app`: Taro + Vue 3 app frontend.

The local development flow starts MySQL and Redis with Docker, then runs the
backend and web frontend locally.

### Requirements

- JDK 8+
- Docker Desktop or Docker Engine with Compose
- Node.js
- pnpm

### Start Infrastructure

The development backend is configured to use the same defaults as
`backend/docker-compose.yml`:

- MySQL: `localhost:3306`, user `root`, password `root123`
- Redis: `localhost:6379`, password `redis123`
- Database name: `agileboot_pure`

You can start MySQL and Redis manually:

```bash
cd backend
docker compose up -d
```

The compose configuration mounts `backend/sql/agileboot.sql` into the MySQL
container as `/docker-entrypoint-initdb.d/01-agileboot.sql`.
The official MySQL image only runs files in `/docker-entrypoint-initdb.d` when
the database directory is empty, during the first initialization of the
`mysql_data` volume.

If MySQL has already been started before, the `mysql_data` volume already
contains data and `docker compose up -d` will not import the SQL again. To
reinitialize the local database, remove the volumes first:

```bash
cd backend
docker compose down -v
docker compose up -d
```

Warning: `docker compose down -v` deletes the local MySQL and Redis volumes,
including existing database data and Redis data.

If you do not want to delete the volumes, import the SQL manually:

```bash
cd backend
docker exec -i mysql-server mysql -uroot -proot123 agileboot_pure < sql/agileboot.sql
```

### Install Frontend Dependencies

```bash
cd frontend
pnpm install
```

### Start Backend and Web Frontend

Start the backend:

```bash
cd backend
./mvnw -pl agileboot-admin spring-boot:run
```

Start the web frontend:

```bash
cd frontend
pnpm dev:web
```

- Backend: `http://localhost:8080`
- Frontend: Vite output, usually `http://localhost:80/`

The frontend development proxy maps `/dev-api` to `http://localhost:8080`.

Optional app commands:

```bash
cd frontend
pnpm dev:app:weapp
pnpm dev:app:h5
```

## Git Hooks

This repository uses `.githooks` as the single Git hooks entrypoint.

```bash
git config core.hooksPath .githooks
```

The frontend workspace uses pnpm:

```bash
cd frontend
pnpm install
pnpm dev:web
pnpm build:web
pnpm dev:app:weapp
pnpm build:app:weapp
pnpm lint
pnpm typecheck
```

## Frontend

`frontend` is a pnpm workspace:

- `web`: Vite + Vue 3 admin frontend.
- `app`: Taro + Vue 3 app frontend.

Shared engineering configuration lives in `frontend` root. Subprojects should extend the shared TypeScript, ESLint, Stylelint, Prettier, commitlint, and lint-staged configuration instead of duplicating it.
