RapiTapir - APIs so clean and fast, they practically run wild! ⚡

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

by Riccardo Merolla

? Introducing RapiTapir: Type-Safe HTTP APIs for Ruby

TL;DR: RapiTapir brings Scala Tapir’s elegance to Ruby with type-safe API development, automatic OpenAPI docs, and a clean DSL that makes building production APIs a joy.

The Problem: Ruby API Development Pain Points

Ruby developers love the language’s expressiveness, but API development often involves:

  • Manual documentation that gets out of sync with code
  • Runtime errors from type mismatches that could be caught earlier
  • Boilerplate code for validation, serialization, and error handling
  • Inconsistent patterns across different teams and projects

What if we could have the type safety of languages like Scala while keeping Ruby’s elegance?

Enter RapiTapir ?

RapiTapir is inspired by Scala’s Tapir library, bringing declarative, type-safe API development to Ruby. Define your endpoints once with strong typing, and get automatic validation, documentation, and client generation.

Start the server and visit http://localhost:4567/docs for interactive Swagger documentation that’s always in sync with your code.

Why RapiTapir Feels Like Ruby Magic ✨ 1. Zero Boilerplate Setup 2. Type Safety Without Ceremony 3. RESTful Resources Made Simple Production-Ready Features ?️ Built-in Security & Auth Observability Out of the Box Real-World Benefits

? Development Speed: Define endpoints declaratively, get validation + docs for free

? Fewer Bugs: Type checking catches issues at definition time, not runtime

? Always-Current Docs: Swagger UI generated from your actual code

? Better DX: Enhanced error messages, auto-completion, consistent patterns

⚡ Easy Testing: Validate schemas independently, generate test fixtures

Framework Integration The Ruby Community Connection

RapiTapir builds on Ruby’s strengths:

  • Sinatra’s simplicity with enhanced capabilities
  • Rack’s composability for middleware and deployment
  • Ruby’s expressiveness with added type safety
  • Community gems for auth, testing, deployment

It’s not about replacing your stack - it’s about making it better.

Check out the comprehensive examples and documentation.

What’s Next?

  • ? Rails integration for seamless adoption in existing apps
  • ? Multi-language client generation (TypeScript, Python, Go)
  • ? Enhanced observability with distributed tracing
  • ? Plugin ecosystem for community extensions

Try It Today

RapiTapir is production-ready with comprehensive tests, clear documentation, and real-world examples. Whether you’re building a new API or enhancing an existing one, RapiTapir helps you write better Ruby code.

Links: - ? Gem: rubygems.org/gems/rapitapir
- ? Source: github.com/riccardomerolla/rapitapir - ? Docs: Examples and guides

Built with ❤️ for the Ruby community. Questions? Feedback? Open an issue or discussion on GitHub!

RapiTapir - APIs so clean and fast, they practically run wild! ?⚡

Stay Informed

Get the best articles every day for FREE. Cancel anytime.