A Rails 7 API backend for a vehicle fleet service booking system. Built for a tech assessment demo with Devise JWT authentication and endpoints for driver bookings, car/service management, and admin review. Includes pagination, serializers, seed data, and full RSpec test coverage.
- Ruby on Rails 7 (API-only mode)
- PostgreSQL
- Devise + JWT (
devise-jwt
) - JSON:API-compliant (
jsonapi-serializer
) - Kaminari (pagination)
- ActionMailer (confirmation emails)
- CORS-enabled (frontend-ready)
- RSpec (tests)
- Driver booking API with:
- Car selection
- Service/department selection
- Date and status
- Admin-ready endpoints for viewing/updating bookings
- Confirmation email sent on booking submission
- JSON:API response formatting
- Pagination for all index endpoints
- CORS enabled for frontend integration
- Seed file with example cars and services
- Full test coverage for models, controllers, mailer, and pagination
GET /api/v1/cars
GET /api/v1/services
GET /api/v1/bookings
POST /api/v1/bookings
git clone https://github.com/yourusername/booking_management_api.git
cd booking_management_api
bundle install
rails db:create db:migrate db:seed
rails s
bundle exec rspec
Authentication is scaffolded but not fully configured. Bookings table integration depends on final auth wiring.
Seeds are available in db/seeds.rb. It creates:
- 2 Cars (e.g., Toyota Corolla, Ford Ranger)
- 3 Services (e.g., Maintenance, WOF, Detailing)
BookingMailer sends a confirmation email to the user when a booking is created.
All index endpoints (e.g., /cars, /services, /bookings) support pagination via query params:
GET /cars?page=1&per_page=10
The response includes standard JSON:API meta and links pagination data.
- Models
- Mailer (BookingMailer)
- Request specs (Cars, Bookings, Services)
- Pagination specs
- Auth helpers