90 lines
2.9 KiB
Markdown
90 lines
2.9 KiB
Markdown
# CA-Lose
|
|
|
|
Ticket intake and validation app with a React frontend and an Express + MySQL backend.
|
|
|
|
## Tech Stack
|
|
|
|

|
|

|
|

|
|

|
|

|
|

|
|

|
|

|
|

|
|

|
|

|
|

|
|
|
|
## Project Structure
|
|
|
|
- Frontend (Vite + React + Tailwind + MUI): [frontend](frontend)
|
|
- Backend (Express): [backend](backend)
|
|
- Database schema: [backend/scheme.sql](backend/scheme.sql)
|
|
- Docker compose stack: [docker-compose.yml](docker-compose.yml)
|
|
|
|
## Quick Start (Docker)
|
|
|
|
1. Set the database password env var used by Docker Compose:
|
|
|
|
```bash
|
|
export DB_PASSWORD=your_password
|
|
```
|
|
|
|
2. Start MySQL and the backend:
|
|
|
|
```bash
|
|
docker compose up -d
|
|
```
|
|
|
|
Notes:
|
|
|
|
- The frontend service is commented out in [docker-compose.yml](docker-compose.yml). If you want the frontend container, uncomment that block and rebuild.
|
|
- The frontend container uses Nginx and proxies /backend to the backend service (see [frontend/nginx.conf](frontend/nginx.conf)).
|
|
|
|
## Local Development
|
|
|
|
### Backend
|
|
|
|
1. Create a .env file in the backend folder with:
|
|
|
|
```env
|
|
PORT=8004
|
|
DB_HOST=127.0.0.1
|
|
DB_USER=root
|
|
DB_PASSWORD=your_password
|
|
DB_NAME=ca_lose
|
|
```
|
|
|
|
2. Install deps and run:
|
|
|
|
```bash
|
|
cd backend
|
|
npm install
|
|
node server.js
|
|
```
|
|
|
|
Backend listens on http://localhost:8004 and exposes routes under /default.
|
|
|
|
### Frontend
|
|
|
|
```bash
|
|
cd frontend
|
|
npm install
|
|
npm run dev
|
|
```
|
|
|
|
Vite runs the app on the default dev port and talks to the backend using the API helpers in [frontend/src/utils/api](frontend/src/utils/api).
|
|
|
|
## API Endpoints
|
|
|
|
- GET /default/users
|
|
- GET /default/confirm-user?username={name}
|
|
- POST /default/new-entry?username={name}
|
|
|
|
## Database Notes
|
|
|
|
- The base users table is defined in [backend/scheme.sql](backend/scheme.sql).
|
|
- Per-user ticket tables are created on demand by the backend (see [backend/routes/default/frontend.data.js](backend/routes/default/frontend.data.js)).
|