# VTuber Star Awards

Monorepo for the VTuber Star Awards MVP.

## Stack

- Frontend: Vue 3, Vite, Pinia, Tailwind CSS, PrimeVue, shadcn-style Vue UI primitives
- Backend: ASP.NET Core 8, EF Core 8, PostgreSQL

## Structure

- `frontend/` Vue application
- `Backend/` ASP.NET Core API
- `prototype/` earlier visual prototype work
- `docker-compose.dev.yml` optional local PostgreSQL container

## Frontend

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

The frontend uses a lightweight local session flow for development:

- Sign in from the header
- `Viewer Login` unlocks nomination and voting
- `Admin Login` unlocks the admin routes and management views
- Voting and nominations can be resubmitted; the backend updates the existing user state instead of blindly duplicating submissions

## Backend

Update `Backend/appsettings.json` or set `VTSA_POSTGRES`, then:

```bash
cd Backend
dotnet restore
dotnet build
dotnet run
```

## Local Database

If Docker is available locally:

```bash
docker compose -f docker-compose.dev.yml up -d
cd Backend
dotnet ef database update
```

Default dev database:

```text
Host=localhost;Port=5433;Database=vtuber_star_awards_dev;Username=postgres;Password=postgres
```

If `dotnet ef database update` is unavailable in the current environment, the repository also contains a bootstrap SQL script:

```bash
cd Backend
psql "Host=localhost Port=5433 Database=vtuber_star_awards_dev Username=postgres Password=postgres" -f Migrations/InitialCreate.manual.sql
```

Verify the runtime wiring:

```bash
curl http://localhost:5084/api/health
curl http://localhost:5084/api/health/database
```

Development auth/session endpoints:

```bash
curl -X POST http://localhost:5084/api/auth/dev-login \
  -H "Content-Type: application/json" \
  -d '{"twitchUserId":"jayuhime_demo","displayName":"Jayuhime","role":"admin"}'
```

## Notes

- Public endpoints live under `/api/public/*`
- Admin summary endpoint lives under `/api/admin/dashboard`
- Session endpoints live under `/api/auth/*`
- Database connectivity and pending migrations are exposed at `/api/health/database`
- Current frontend store falls back to static seed-like data if the API is unavailable
- The admin dashboard now includes a lightweight risk center and audit log for suspicious submit patterns and reviewed admin actions
