Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions LOCAL_DEV.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Local Development (No Docker)

## Quick Start with Makefile

You can use the provided Makefile for common local development tasks:

```
# Start the backend PHP service (http://localhost:9000)
make local-backend

# Start the frontend Vite dev server (http://localhost:5173)
make local-frontend

# Run PHP database migrations
make local-migrate
```

See below for manual steps if you prefer not to use Makefile.

You can run the backend and frontend directly on your machine, assuming you have MySQL running locally.

## Prerequisites
- Node.js and yarn (or npm)
- PHP 8+
- Composer
- MySQL running on 127.0.0.1 (default user: root, no password, database: app)

## 1. Backend Setup

```
cd backend
composer install
./yii migrate
php -S localhost:9000 -t web
```
- The backend API will be available at http://localhost:9000/api

## 2. Frontend Setup

```
cd frontend
yarn install
yarn dev
```
- The frontend will be available at http://localhost:5173 (default Vite port)
- API requests to /api/* will be proxied to the backend at http://localhost:9000

## 3. Accessing the Site
- Open http://localhost:5173 or http://ebal.lan:5173 in your browser.
- If you want to use http://ebal.lan, add this to your /etc/hosts:
```
127.0.0.1 ebal.lan
```

## 4. Configuration
- The backend uses environment variables `DB_DSN`, `DB_USER`, and `DB_PASS` if you want to override the default MySQL connection.
- By default, it connects to `mysql:host=127.0.0.1;dbname=app` as `root` with no password.

## 5. Running Tests
See the main README for backend and frontend test instructions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@ migrate:
docker exec -it $$(docker compose ps -q app) php yii migrate --interactive=0

rebuild: down build up logs

# Run backend PHP service locally
local-backend:
php -S 127.0.0.1:9000 -t backend/web backend/web/index.php

# Run frontend Vite web locally
local-frontend:
cd frontend && npm run dev

# Run PHP database migrations locally
local-migrate:
DB_DSN="mysql:host=127.0.0.1;port=3306;dbname=app" DB_USER="root" DB_PASS="example" php backend/yii migrate --interactive=0
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,15 @@ This will create the required tables such as the `user`, `member`, and `group`
tables as well as the join table for member assignments.
It also seeds a default **admin** user with password **admin123**.

## Frontend

A lightweight React frontend lives in the `frontend` directory. It is a small
Node project managed with **yarn** and built with **Vite**. Install the
dependencies and start the dev server with live reload using:
## Local Development (No Docker)

```bash
cd frontend
yarn install
yarn dev
```
You can run the backend and frontend directly on your machine. See `LOCAL_DEV.md` for step-by-step instructions.

## Frontend

Run `yarn build` to create a production bundle under `dist/`.
A lightweight React frontend lives in the `frontend` directory. It is a small
Node project managed with **yarn** and built with **Vite**. See above or `LOCAL_DEV.md` for local dev instructions. Run `yarn build` to create a production bundle under `dist/`.

## Docker Development

Expand Down
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ services:
restart: unless-stopped

db:
ports:
- "3306:3306"
image: mariadb:10.6
environment:
MYSQL_ROOT_PASSWORD: example
Expand Down
9 changes: 9 additions & 0 deletions frontend/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@ import react from '@vitejs/plugin-react';

export default defineConfig({
plugins: [react()],
server: {
proxy: {
'/api/': {
target: 'http://localhost:9000/',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, '/'),
},
},
},
});