$ tail -f ./blog · rails · sinatra · jekyll
Posts
-
latest
How to Force HTTPS in Rails: force_ssl, assume_ssl, HSTS and Proxy Redirect Loops
To force HTTPS in Rails, set config.force_ssl = true in config/environments/production.rb. Rails then redirects plain HTTP to HTTPS, sends a Strict-Transport-Security (HSTS) header, and marks cookies as Secure. Behind a TLS-terminating proxy, which is how almost every Rails app runs today, you also have to decide who does the redirect:... -
PostgreSQL Concurrent Index in Rails: Add Indexes Without Locking Writes
A PostgreSQL concurrent index lets you add an index to a busy table without blocking inserts, updates and deletes. In Rails, that’s add_index :orders, :account_id, algorithm: :concurrently inside a migration with disable_ddl_transaction!. It’s the right default for any table with real traffic. The plain add_index holds a lock that blocks... -
Puma Workers and Threads: How to Size Them for Your Rails App and Server
Puma workers and threads decide how many requests a Rails server handles at once. Workers are separate Ruby processes that run Ruby code in parallel on different CPU cores. Threads inside each worker let it keep serving while other requests wait on the database or an API. The starting point... -
Secure Rails Deployment: A Production Checklist from Gems to Server Hardening
A secure Rails deployment means closing the gaps at every layer between the internet and your data: no known-vulnerable gems, no secrets in the repository or the image, strict hosts and security headers, rate limits on login and password reset, a hardened server or container, and a database nobody can... -
Rails Credentials Guide: Per-Environment Secrets, Master Keys, Rotation and Deploys
Rails credentials are encrypted YAML files committed to your repository, decrypted at boot with a key that lives outside it: config/master.key locally, or the RAILS_MASTER_KEY environment variable on a server. Used well, they give you versioned, reviewable secrets with one key per environment. Used carelessly, a single master.key gets shared... -
Rails PostgreSQL Setup: From Local Install to Production with Rails 8
A Rails PostgreSQL setup has three parts: a PostgreSQL server you can reach locally (installed natively or in Docker), a config/database.yml that reads DATABASE_URL in production, and bin/rails db:prepare to create databases and load schemas. Rails 8 adds a twist many guides skip: in production, one app uses four databases... -
Rails Caching Strategies: HTTP, Fragment, Low-Level and Which Cache Store to Use
The best Rails caching strategy is a layered one: let browsers and CDNs answer repeat requests with HTTP caching, cache rendered HTML with fragment and Russian doll caching, cache expensive data with Rails.cache.fetch, and let Rails’ per-request query cache handle the rest. Each layer avoids a different kind of work... -
Rails Maintenance Mode: A 503 Page, Read-Only Mode and Platform Switches Done Right
Rails maintenance mode is a switch that makes every public request return a maintenance page with HTTP 503 and a Retry-After header, while health checks, admins and your own team can still get through. You need it far less often than you’d think, because zero-downtime deploys and expand-and-contract migrations cover... -
Managed PostgreSQL vs Self-Hosted: Costs, Risks and When Each One Makes Sense
Managed PostgreSQL vs self-hosted comes down to who owns backups, restores, failover, upgrades and the 3 AM pages. A managed database from Heroku, Render or Fly.io costs more per gigabyte of RAM, but the provider runs all of that for you. A self-hosted PostgreSQL on a VM costs a few... -
How to Manage Environment Variables in Rails: dotenv, ENV.fetch, Validation and Platform Secrets
To manage environment variables in Rails well, keep deploy-specific settings (database URLs, API hosts, thread counts, feature flags) in ENV, read them through one typed configuration object with ENV.fetch, validate the required ones when the app boots, and set them through your platform’s secret store, never in git. Use dotenv... -
Rails Performance Optimization: What to Fix First, With Measured Impact
Rails performance optimization works best in a fixed order: measure where the time goes, fix database queries (N+1s and missing indexes cause most slow Rails pages), cache what’s expensive and rarely changes, enable YJIT and jemalloc for a free runtime boost, and move slow work out of the request. Changing... -
Rails Request Timeout: Configure Every Layer from the Router to the Database
A Rails request timeout isn’t one setting. It’s a stack of them: the platform router (30 seconds on Heroku, 30 on kamal-proxy, 5 minutes on Upsun, 100 minutes on Render), the HTTP proxy in front of Puma, an optional Rack::Timeout inside the app, and the timeouts on every database query... -
Rails Log Management in Production: Structured Logs, Request IDs and Retention
Rails log management in production comes down to four things: write one structured line per request to STDOUT, tag every line with a request ID, keep secrets and personal data out, and ship the logs somewhere that keeps them for longer than your platform’s buffer. Rails’ default multi-line logs are... -
Rails Memory Leak in Production: How to Find It, Fix It and Stop the OOM Kills
A Rails memory leak in production shows up as Puma or Sidekiq processes whose memory grows until the platform kills them: Heroku logs R14 (Memory quota exceeded), Render restarts the instance with “Ran out of memory”, and the Linux OOM killer ends the process on Fly.io or your own server.... -
Rails Staging Environment: How to Set It Up So It Actually Matches Production
A Rails staging environment is a copy of production where you test a release with production settings, production-like data and real integrations in sandbox mode before customers see it. The most reliable way to build one is to run staging with RAILS_ENV=production and change only environment variables and credentials. Then... -
Startup Hosting Costs: What a Rails App Really Costs per Month, Line by Line
Startup hosting costs for a typical Rails app run from about $12–45 a month at MVP stage to $125–200 a month once the product has launched and needs redundancy, background workers, a production-grade database, Redis and a staging environment. Those are list prices on Heroku, Render and Fly.io in October... -
Rails Redis Caching: Production Setup for redis_cache_store, Fragments and Low-Level Caching
Rails Redis caching means using :redis_cache_store as Rails.cache, so fragment caches, Rails.cache.fetch results and optionally sessions are kept in Redis and shared by every web and worker process. Pointing REDIS_URL at an instance is a one-line change. The production details are where it goes wrong: the eviction policy, timeouts that... -
How to Scale a Rails App: Vertical, Horizontal and Database Scaling in the Right Order
To scale a Rails app, first find the bottleneck (web capacity, database, memory or background jobs), then fix it in the cheapest order: tune and enlarge one instance, make the app stateless, add more web and worker instances behind a load balancer, and only then scale the database with connection... -
Rails Connection Pool: How to Size It for Puma, Solid Queue and PgBouncer
The Rails connection pool is the set of database connections each Ruby process keeps open and lends to its threads. Size it too small and requests fail with ActiveRecord::ConnectionTimeoutError. Size it too large, or forget how many processes you run, and PostgreSQL refuses new clients with too many clients already.... -
Zero-Downtime Rails Migrations on PostgreSQL: A Practical Playbook
Zero-downtime Rails migrations come down to two rules: never take a lock that blocks traffic for more than a moment, and never ship a schema change that the currently running code can’t handle. Zero-downtime deploys make the second rule unavoidable, because for a few seconds or minutes the old and... -
Rails Assets Precompile: How to Run It in Production and Fix Every Common Error
Rails assets precompile is the build step that turns your stylesheets, JavaScript and images into fingerprinted files in public/assets, so production can serve them fast and cache them forever. It’s also one of the most common reasons a Rails deploy fails: the task boots your whole app in production mode,... -
How to Dockerize a Rails App: A Production Dockerfile, Step by Step
To dockerize a Rails app you need three files: a multi-stage Dockerfile that installs gems and precompiles assets in a throwaway build stage, a .dockerignore that keeps secrets and junk out of the build context, and an entrypoint that prepares the database on boot. Rails 7.1 and later generate all... -
Rails Health Check: Build /up and Readiness Endpoints That Don't Lie
A Rails health check is the endpoint your proxy or platform polls to decide whether a container may receive traffic. Rails 7.1+ ships one at /up, but it only proves the app booted. It does not check the database, the cache or the job queue. This guide shows how to... -
Rails Background Jobs in Production: Solid Queue, Sidekiq and Where to Run Your Workers
Rails background jobs move anything slow out of the request cycle: emails, PDF exports, image processing, webhooks, third-party API syncs. In Rails 8 the default answer is Active Job on top of Solid Queue, which stores jobs in your existing database and needs no Redis. Sidekiq is still the right... -
Rails Monitoring for Developers: Snippets and Hosting Choices
Monitor four signals in every Rails app: database queries and N+1 patterns, request latency at p95 and p99, background job health, and unhandled exceptions. Instrument with ActiveSupport::Notifications for Rails-native events, add OpenTelemetry for portable tracing, and correlate errors with traces so a spike points to a cause, not just a... -
Skip the PaaS: Minimal Rails Deployments with Kamal 2 and Thruster
For most Rails apps today, the fastest production path is Rails 8’s Kamal 2 to a Linux VM, or a Rails-focused managed host that handles zero-downtime deploys for you. Either route needs the same checklist: secrets handled properly, database provisioning sorted, assets built, and a rollback plan you’ve actually tested.... -
Managed PaaS vs Dedicated Debian Server: A Pragmatic Analysis
The infrastructure world is fundamentally divided into two camps: developers who want to git push and forget about it, and sysadmins who want complete control over their systemd services. -
The True Cost of Ruby Hosting: 9€/Month vs 50€/Month for Zero-Downtime Architecture
For years, the Ruby community has accepted a false premise: if you want a reliable, zero-downtime deployment for your Ruby on Rails, Sinatra, or Jekyll applications, you have to pay a premium. -
How I Configured Postfix and OpenDKIM on Debian to Send Emails Without Falling into Spam (9.9/10 Score)
Every developer who has ever run a SaaS or side project knows the dread of email deliverability. For years, the conventional wisdom was simple: “Never run your own mail server. Just pay SendGrid, Mailgun, or Postmark.” -
How We Built a Cloud Hosting Platform on Top of Coolify and Docker: The Enkihost Architecture
Developers love the simplicity of modern PaaS platforms like Heroku, Render, and Fly.io: you push your git repository, configure a custom domain, add environment variables, and your application goes live with automated SSL certificates in seconds. -
Building an In-Browser Interactive TTY Terminal with Sinatra and Next.js
One of the standout features of modern cloud hosting platforms like Railway, Render, or Fly.io is the in-browser interactive terminal. Being able to jump directly into a running production container to inspect logs, troubleshoot an unexpected crash, or run database commands (rake db:migrate, rails c, or python manage.py) without leaving... -
Why I Swapped Rails for Sinatra (And the Mystery of My 98.59% Uptime)
When building web applications in the Ruby world, Ruby on Rails is almost universally treated as the default choice. And for good reason: its convention-over-configuration philosophy, battle-tested tooling, and unmatched ecosystem have powered everything from weekend MVPs to multi-billion-dollar tech giants. -
The Harsh Reality of Marketing Web Projects (And the Dilemma of Dubious Directories)
If you ask any software engineer what their favorite phase of a project is, nine out of ten will say: building it. Architecting the backend, tuning database queries, polishing the UI with neat animations, and setting up automated deployments with Docker or Coolify. It’s familiar, controllable, and deeply rewarding. -
Introducing Enkihost: Managed Hosting for Ruby, Sinatra, and Jekyll
Today marks an exciting milestone: I can finally share one of my favorite projects, Enkihost.com. This is something I’ve wanted to build for years, and this weekend, thanks to the power of AI, I’ve made significant progress that would have normally taken much longer. -
Google Auth: Full Implementation with Rails API and Next.js
Implementing social authentication is one of the best ways to improve user experience (UX) by removing the friction of manual account creation. In a decoupled architecture with Ruby on Rails as an API and Next.js on the frontend, the Google authentication flow requires precise coordination to maintain security. -
Identity Verification with Veriff: Integration Guide with Rails API and Next.js
In the fintech and SaaS application ecosystem, identity verification (KYC) has become a mandatory step. Veriff is one of the leading platforms for automating this process using AI. -
Integrating Stripe: Complete Guide with Rails API and Next.js
In modern web application development, it is common to separate the backend from the frontend. A powerful combination for this is using Ruby on Rails as a robust API and Next.js for a dynamic and reactive frontend. In this guide, I will show you how to integrate Stripe to process... -
enkimail: Email Platform Under Construction 🚀
Today I bring you news about an exciting project that is in development: enkimail, a modern email sending platform with a futuristic design and robust features. -
How to Set Up a Notification System in Ruby on Rails
Notifications are a critical component in any modern application. Whether it’s email alerts, real-time messages, or push notifications, a well-designed system keeps your users engaged and informed. In this guide, I will show you how to build a robust and scalable notification system in Ruby on Rails. -
Why Ruby on Rails remains ideal for small projects in 2026
In a technological world moving at light speed, with new JavaScript frameworks and emerging languages competing for attention, it’s easy to wonder if a 20-year-old technology like Ruby on Rails is still relevant. The short answer is a resounding yes, especially if you’re working on a small project, an MVP... -
Rails vs Next.js: When to use each in a real project
Choosing between Rails and Next.js is one of the most important decisions when starting a web project. Both frameworks are excellent, but they shine in different contexts. Here I tell you when to use each one based on real experience. -
How to Deploy Rails for Free Using Coolify
Deploying Rails applications can be expensive if you use traditional platforms. In this article, I will show you how you can deploy your Rails application completely for free using Coolify, an open-source alternative to Heroku and Netlify. -
Developing Jombo: Applying Vibe Coding to Software Development
I am currently working on Jombo, an exciting project that I am developing by applying the principles of vibe coding. This development methodology focuses on keeping flow, creativity, and intuition as the main drivers of the software construction process. -
How to Create a Multi-language Page with Next.js
🌍 How to Create a Multi-language Website with Next.js: Complete Guide Next.js is the best framework for creating modern web applications in React, and one of its greatest advantages is the ease of implementing internationalization (i18n). Whether for a personal website, a SaaS, or an online store, offering multiple languages...