# Points of Interest

[![Backend Quality](https://github.com/bernard-ng/points-of-interest/actions/workflows/backend-quality.yml/badge.svg)](https://github.com/bernard-ng/points-of-interest/actions/workflows/backend-quality.yml)
[![Backend Tests](https://github.com/bernard-ng/points-of-interest/actions/workflows/backend-tests.yml/badge.svg)](https://github.com/bernard-ng/points-of-interest/actions/workflows/backend-tests.yml)
[![Frontend Quality](https://github.com/bernard-ng/points-of-interest/actions/workflows/frontend-quality.yml/badge.svg)](https://github.com/bernard-ng/points-of-interest/actions/workflows/frontend-quality.yml)

---

This repository hosts a proof-of-concept "points of interest" application composed of a Symfony API and a React client. Users can submit nearby signals and explore aggregated heatmaps that visualise recent activity.

![Screenshot](./screenshot.png)

## Project structure

- `server/` – Symfony 7 API that stores and broadcasts signal submissions.
- `client/` – React (Vite) front-end that renders the map interface and live statistics.

## Prerequisites

- Node.js 20+
- PHP 8.4+
- Docker

## Running the API server

```bash
cd server
composer install

docker compose up

# Prepare the database schema
php bin/console doctrine:database:create --if-not-exists
php bin/console doctrine:migrations:migrate --no-interaction
php bin/console doctrine:fixtures:load

# Start the Symfony development server
symfony serve --no-tls
```

The API listens on `http://127.0.0.1:8000` by default. Adjust the Mercure hub and other environment variables in `.env` as needed.

## Running the client

```bash
cd client
npm install
npm run dev
```

The client starts on `http://localhost:5173`. Set the `VITE_API_BASE`, `VITE_MERCURE_HUB`, and `VITE_MERCURE_TOPIC` environment variables (see `client/.env.example` if available) to point to the API and Mercure hub instances.

## Testing

- API: `cd server && ./vendor/bin/phpunit`
- Client: `cd client && npm run build` (ensures the TypeScript build succeeds)

## Additional notes

- The API uses Mercure for real-time updates. Ensure a Mercure hub is running and reachable by the client when testing streaming features.
- The default `DATABASE_URL` now targets the bundled PostgreSQL/PostGIS container. Update it if you run the database elsewhere, and rerun migrations after switching databases.
- Review the individual `README.md` files inside `client/` and `server/` for more detailed configuration guidance.
