Skip to content
digidwebPublic

About

An app to create and manage your favorite restaurants list

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Prefê 🍽️

An app to create and manage your favourite restaurants list

Prefê allows users to save, organize, and revisit their favourite restaurants through a simple web application.

The project focuses on Rails application architecture, asynchronous background processing, pagination, automated testing, and code quality, using a realistic domain to practice full-stack development.

✨ Features

  • 🍽️ Save and manage favorite restaurants
  • 📋 Paginated restaurant listings with Kaminari
  • ⚙️ Asynchronous background processing with Sidekiq
  • 🔴 Redis-backed job processing
  • 🧪 Automated tests with RSpec
  • 🏭 Test data with FactoryBot
  • 📏 Code quality enforcement with RuboCop
  • 🐳 Docker support

🛠️ Tech Stack

Backend

  • Ruby
  • Ruby on Rails
  • Active Record

Database

  • PostgreSQL

Background Processing

  • Sidekiq
  • Redis

Frontend

  • Rails Views
  • ERB

Testing & Code Quality

  • RSpec
  • FactoryBot
  • RuboCop

Other

  • Kaminari
  • Docker

🏗️ Architecture

Prefê follows the conventional Ruby on Rails MVC Model–View–Controller architecture. Background processing is separated from the main request cycle and handled asynchronously through Sidekiq and Redis.

                         ┌───────────────────┐
                         │   User / Browser  │
                         └─────────┬─────────┘
                                   │
                                   ▼
                         ┌───────────────────┐
                         │ Rails Controllers │
                         └─────────┬─────────┘
                                   │
                         ┌─────────┴─────────┐
                         ▼                   ▼
                  ┌────────────┐      ┌────────────┐
                  │   Models   │      │    Views   │
                  └─────┬──────┘      └────────────┘
                        │
                        ▼
                  ┌────────────┐
                  │ PostgreSQL │
                  └────────────┘

Background processing:

       Rails Application
              │
              ▼
        ┌───────────┐
        │  Sidekiq  │
        └─────┬─────┘
              │
              ▼
        ┌───────────┐
        │   Redis   │
        └───────────┘

Background jobs allow operations that do not need to block the HTTP request to be processed asynchronously.

🧠 Technical Highlights

Asynchronous Processing

One of the main technical goals of Prefê is to demonstrate asynchronous processing with Sidekiq and Redis.

Instead of performing potentially expensive operations during the HTTP request, background jobs can be delegated to Sidekiq.

HTTP Request
     │
     ▼
Rails Application
     │
     ├──────────────► Immediate response
     │
     ▼
   Sidekiq
     │
     ▼
   Redis
     │
     ▼
Background Job

This approach keeps the request/response cycle independent from tasks that do not need to block the user.

Pagination

Restaurant listings use Kaminari to paginate records instead of loading the entire collection at once.

This provides a more scalable approach to displaying larger datasets.

Automated Testing

The application uses RSpec and FactoryBot to test application behavior and domain logic and covers the application's main layers, including models and controllers.

Run the test suite with:

bundle exec rspec

Code Quality

RuboCop is used to enforce Ruby style and maintain consistent code quality.

Run RuboCop with:

bundle exec rubocop

🧪 Testing

The project uses:

  • RSpec for automated testing
  • FactoryBot for test data
  • Shoulda Matchers where applicable
  • Database Cleaner for test database isolation

The test suite covers application behavior across models and controllers.

Run all tests:

bundle exec rspec

For more detailed output:

bundle exec rspec --format documentation

🚀 Getting Started

Prerequisites

Make sure you have installed:

  • Ruby 3.x
  • Rails 7.x
  • PostgreSQL
  • Redis
  • Bundler

Or run with Docker in a containerized environment.

1. Clone the repository

git clone https://github.com/digidweb/prefe.git
cd prefe

2. Install dependencies

bundle install

3. Set up the database

rails db:create
rails db:migrate
rails db:seed

4. Start Redis

Redis is required for Sidekiq.

In a separate terminal:

redis-server

5. Start Sidekiq

In another terminal:

bundle exec sidekiq

6. Start the Rails server

In another terminal:

rails server

The application will be available at:

http://localhost:3000

🐳 Running with Docker

The application can also be run using Docker.

1. Build the Docker image:

docker build -t prefe .

2. Run the container:

docker run -p 3000:3000 prefe

For background processing, Redis and Sidekiq must also be available to the application.

⚙️ Engineering Focus

Unlike a basic CRUD application, Prefê was designed to explore how a Rails application can handle operations that should not block the user's request.

The project therefore focuses on three complementary areas:

        Web Application
              │
       ┌──────┴──────┐
       ▼             ▼
   PostgreSQL     Background
   Persistence    Processing
                     │
                Sidekiq + Redis
                     
              +
                     
       Automated Quality
        RSpec + RuboCop

This combination provides practical experience with application architecture, asynchronous processing, automated testing, and maintainable Ruby code.

🔮 Potential Improvements

Possible next steps include:

  • Add authentication and authorization
  • Add request/integration test coverage
  • Add GitHub Actions for automated tests and RuboCop
  • Add restaurant search and filtering
  • Add production deployment
  • Add monitoring for background jobs

📌 Portfolio Context

Prefê is part of a portfolio focused on Ruby on Rails backend and full-stack development.

The project demonstrates practical experience with:

Ruby on Rails · PostgreSQL · Active Record · Sidekiq · Redis · RSpec · FactoryBot · Kaminari · RuboCop · Docker

Rather than being only a CRUD application, Prefê explores how a Rails application can combine domain logic, asynchronous processing, pagination, automated testing, and code quality practices in a single project.

About

An app to create and manage your favorite restaurants list

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages