A Symfony REST API with a React frontend for managing books and authors.
- Backend: Symfony 8.1, SQLite, Doctrine ORM, Symfony Messenger
- Frontend: React 19, Vite, TypeScript, HeroUI v3, Tailwind CSS v4
- PHP 8.4+
- Composer
- Node.js 20+
- npm
- Symfony CLI
# Install PHP dependencies
composer install
# Create the SQLite database and run migrations
php bin/console doctrine:migrations:migrate --no-interaction
# Start the Symfony dev server
symfony serveThe API will be available at https://localhost:8000/api (Symfony CLI) or http://127.0.0.1:8000/api (built-in server).
| Method | Path | Description | Status |
|---|---|---|---|
| GET | /api/books |
List all books | 200 |
| GET | /api/books/{id} |
Get a book | 200 |
| POST | /api/books |
Create a book | 202 |
| PUT | /api/books/{id} |
Update a book | 202 |
| DELETE | /api/books/{id} |
Delete a book | 202 |
| GET | /api/authors |
List all authors | 200 |
| GET | /api/authors/{id} |
Get an author | 200 |
| POST | /api/authors |
Create an author | 202 |
| PUT | /api/authors/{id} |
Update an author | 202 |
| DELETE | /api/authors/{id} |
Delete an author | 202 |
Write operations return HTTP 202 and are processed asynchronously via Symfony Messenger (sync transport).
cd frontend
npm install
npm run devThe frontend will be available at http://localhost:5173. API requests are proxied to the Symfony backend automatically.
├── src/
│ ├── Controller/ # REST API controllers (BookController, AuthorController)
│ ├── Dto/ # Request DTOs with validation (BookDto, AuthorDto)
│ ├── Entity/ # Doctrine entities (Book, Author - ManyToMany)
│ ├── EventListener/ # API exception listener for JSON error responses
│ ├── Message/ # Messenger messages (BookMessage, AuthorMessage)
│ └── MessageHandler/ # Async handlers for CRUD operations
├── frontend/
│ └── src/
│ ├── api/ # API client and endpoint functions
│ ├── components/ # React components (lists, forms, modals)
│ └── hooks/ # Data fetching hooks
├── config/ # Symfony configuration
└── migrations/ # Doctrine migrations