PitchHut logo
High-performance web framework compatible with Rails.
Pitch

Rage is a fast web framework designed for API development, offering compatibility with Rails and advanced features like WebSocket support, background tasks, and automatic OpenAPI documentation generation.

Description

Rage is a robust, high-performance web framework designed to be fully compatible with Rails. It enhances the development experience by incorporating essential features such as WebSocket support and automatic OpenAPI documentation generation.

Key Features

  • Rails Compatibility: Rage maintains a familiar API for Rails developers, ensuring that transitioning to this framework is seamless and intuitive.
  • Performance Optimized: Built with high performance in mind, Rage minimizes latency and maximizes throughput, making it suitable for modern applications where speed is critical.
  • API-First Architecture: Emphasizing a clear separation of backend and frontend, Rage allows developers to build API-only applications effectively, promoting a sustainable and scalable application structure.
  • Modern Ruby Support: Utilizing a fiber scheduler, Rage enables non-blocking I/O operations, leading to improved concurrency and resource management.

Getting Started

Customized for flexibility, Rage can function in either Rails Mode, integrating into existing Rails applications, or Standalone Mode, allowing developers to create high-performance services effortlessly. Key documentation includes:

Example Usage

Here is a sample controller showcasing how to utilize Rage effectively:

require "net/http"

class PagesController < RageController::API
  rescue_from SocketError do |_|
    render json: { message: "error" }, status: 500
  end

  before_action :set_metadata

  def show
    page = Net::HTTP.get(URI("https://httpbin.org/json"))
    render json: { page: page, metadata: @metadata }
  end

  private

  def set_metadata
    @metadata = { format: "json", time: Time.now.to_i }
  end
end

Rage effectively utilizes fibers to handle requests concurrently, greatly enhancing the application's responsiveness. An advanced feature allows multiple asynchronous HTTP calls using Fiber.await, further optimizing performance.

Benchmarking

Rage has demonstrated impressive benchmarks, highlighting its capacity to handle significant traffic and perform efficiently under load:

class BenchmarksController < ApplicationController
  def index
    render json: { hello: "world" }
  end
end

Requests per second

Overall, Rage is positioned as a powerful alternative to traditional frameworks, with a strong emphasis on modern development practices and high-performance architecture.

0 comments

No comments yet.

Sign in to be the first to comment.