Campfire (37signals)
The DHH style textbook โ real-time chat built with only Rails built-ins
GitHub: basecamp/once-campfire
Campfire is a self-hosted chat app released under 37signals' ONCE brand. It implements real-time chat using only Rails built-in features, making it the most complete practical example of the DHH coding style.
Please refer to the Korean version for the detailed directory structure and pattern analysis, including: CRUD controllers with zero custom actions, state management via records instead of booleans, authentication without Devise using has_secure_password, Concern separation to prevent model bloat, the Current pattern, and 6 dedicated Action Cable channels.
The ONCE philosophy is directly reflected in the code: SQLite by default, Solid Queue/Cache/Cable, email/password without OAuth, single-server deployment with Kamal.
Architecture Diagram
CRUD Mapping Pattern
State = Record (ERD)
Naturally records who changed what and when
Concern Separation Structure
Action Cable Channel Structure
Key Points
Open basecamp/once-campfire repository on GitHub
config/routes.rb โ check resource nesting and CRUD mapping patterns
app/controllers/rooms/ โ analyze closeds, opens, directs controllers
app/models/user.rb โ verify has_secure_password auth (no Devise)
app/models/user/*.rb โ learn Concern separation patterns
app/models/ban.rb, boost.rb โ check state-as-record management pattern
app/channels/ โ analyze 6 Action Cable channel structures
app/javascript/controllers/ โ check Stimulus controller patterns
Apply patterns one by one to your own project
Pros
- ✓ The most complete real-world example of DHH style
- ✓ CRUD mapping patterns verifiable in actual code
- ✓ Understand the right scale of Concern separation
- ✓ Reference 6 production Action Cable channel implementations
- ✓ Experience the simple architecture of the ONCE philosophy
- ✓ ~30 production Stimulus controller patterns
Cons
- ✗ Single-tenant, difficult to directly apply to multi-tenant apps
- ✗ Small-scale chat app, differs from large-scale services
- ✗ Minitest + Fixtures โ may be unfamiliar to RSpec users
- ✗ Native CSS โ differs from Tailwind trend
- ✗ ONCE license limits forking/modification