Skip to content

atorscho/titans-symfony-mini-project

Repository files navigation

Library Manager

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

Requirements

  • PHP 8.4+
  • Composer
  • Node.js 20+
  • npm
  • Symfony CLI

Backend Setup

# 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 serve

The API will be available at https://localhost:8000/api (Symfony CLI) or http://127.0.0.1:8000/api (built-in server).

API Endpoints

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).

Frontend Setup

cd frontend

npm install

npm run dev

The frontend will be available at http://localhost:5173. API requests are proxied to the Symfony backend automatically.

Project Structure

├── 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

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors