Skip to content

sn/rocking-with-sinatra

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rocking with Sinatra

A free book teaching advanced, production-oriented Sinatra development by building a Udemy-like course marketplace.

About This Book

This is not a beginner's book - it dives straight into advanced topics for building real-world production software with Sinatra. The first two chapters cover essential concepts, then we build a fully functional course marketplace.

I highly recommend reading the Sinatra documentation and having a solid understanding of Ruby before starting.

Recommended Ruby resources:

  1. Eloquent Ruby, Second Edition by Russ Olsen
  2. Practical Object-Oriented Design in Ruby by Sandi Metz
  3. The Odin Project (free, comprehensive full-stack curriculum)

What We're Building

A fully functional Udemy-type clone where users can buy and publish short video courses, featuring user management, authentication, REST & GraphQL APIs, real-time WebSockets, database-backed content, and production deployment.

Running the Example Code

Each example in the examples/ directory is self-contained with its own Gemfile:

cd examples/ch01-modular
bundle install
bundle exec rackup
# Open http://localhost:9292

For chapters that use PostgreSQL or Redis, use the included Docker environment:

docker compose up

See Running Examples for full details.

Contents

  1. Classic vs Modular Style Applications
  2. Useful Tools - Sinatra Contrib, Helpers, Logging, Code Analyzers
  3. A Brief Introduction to Rack
  4. Software Architecture Patterns
  1. Named Parameters
  2. Wildcard Routing
  3. Routing with Regular Expressions
  4. Using Query String Parameters
  5. Routing Conditions
  1. Configuration
  2. Types of Template Engines
  3. Namespacing Templates
  4. Layouts
  5. Embedding Partials
  6. Effectively Dealing with Mailers
  1. Rake-based Asset Bundling
  2. Sprockets
  3. Serving Directly with Rack::Static
  4. Effective Caching
  5. Serving Assets from Nginx
  1. Understanding WebSockets
  2. Basic WebSocket Setup with Sinatra
  3. Realtime Chat Application
  4. Embeddable JavaScript Applications with CORS
  5. Realtime Exception Tracking System
  1. MVC & Directory Structure
  2. Helpers
  3. Settings / Configuration
  4. Application Boot Process
  5. Creating Custom Helpers
  6. Creating Custom Extensions
  1. ActiveRecord with PostgreSQL
  2. Redis
  3. Workshop: Modeling Our Course Marketplace
  1. User Authentication
  2. Rack Protection Module
  3. API Authentication
  4. OAuth Authentication
  5. Input Validation
  6. SSL/HTTPS in Production
  1. Basic REST API Principles
  2. Creating a JSON API Service
  3. API Authentication
  4. Consuming External APIs
  5. GraphQL with Sinatra
  6. Testing & Documenting Your APIs
  1. Testing with Rack::Test
  2. Testing with RSpec
  3. Testing with Minitest
  4. Containerized Deployment with Docker
  5. Deploying with Puma behind Nginx
  6. Production Checklist

Contributing

If you want to help by contributing to the content of this book, please submit a pull request.

Author

Sean Nieuwoudt - sean@underwulf.com

License

MIT

About

A free book teaching advanced, production-oriented Sinatra development by building a Udemy-like course marketplace.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors