How moriw0/tyakudon works
1. Overall shape
- This is a single Rails 7.1 monolith on Ruby 3.3, backed by PostgreSQL.
- The app is server-rendered first, with Hotwire (Turbo + Stimulus) for progressive interactivity rather than a separate frontend service.
2. Core product domain
- The main business flow is “ramen queue measurement”: users start a wait-time session, record the line/queue state, and finish when the ramen is served.
- The central models for this are User, RamenShop, Record, and LineStatus, with Record representing the measured wait time and LineStatus representing the live queue state.
3. Measurement flow
- NewRecordsController and RecordsController appear to orchestrate the measurement lifecycle: create/start, capture intermediate form input, show result, and present record detail pages.
- Turbo Stream templates in records/ and line_statuses/ indicate that parts of this flow update in-place without full page reloads.
4. Live queue/status layer
- LineStatusesController is a separate live-facing subsystem for posting current waiting conditions, likely used by people currently at a shop.
- This layer is also interactive via Turbo Stream, and the related views suggest a queue table/edit form experience centered on the current state of a shop.
5. Ramen shop directory and discovery
- RamenShopsController powers shop pages, search, nearby-shop lookup, maps, and favorites.
- db/migrate plus geocoder config and JS map/geolocation controllers show that location is an important data dimension, not just a text attribute.
6. Social/engagement features
- Favorites and Likes are separate relational features around shops and records.
- These are updated through dedicated controllers with Turbo Stream responses, so user reactions immediately update the UI.
- CheerMessage and its job suggest a lightweight “encouragement” layer around the waiting experience.
7. User/account subsystem
- Authentication is handled in-app with sessions, password resets, account activations, and OmniAuth-based social login.
- users includes admin/test-mode flags and provider/uid columns, so the user model is the hub for both identity and role-based behavior.
- The Authenticatable controller concern centralizes access control across controllers.
8. Content and admin boundaries
- Static/editorial content is split into announcements, FAQs, landing pages, terms, and privacy policy.
- admin/announcements is a distinct namespace, so admin content management is separated from public browsing.
- ActionText is used for rich text content where needed.
9. Backend services and integrations
- The app/services layer handles external-data and utility concerns: document fetching, Google spreadsheet access, shop info extraction/insertion, URL handling, and GCP session management.
- This suggests an import/sync pipeline for shop master data and possibly content enrichment, separate from normal request handling.
10. Background processing and notifications
- The app has background jobs for auto-retiring records and sending cheer messages.
- Mailers cover account activation, password resets, shop registration, and retirement notifications.
- The presence of good_jobs migration indicates jobs run through a database-backed worker setup rather than an external queue service.
11. Media and persistence
- Active Storage is used for uploaded assets, and ActionText is present for richer content blocks.
- Most persistent state lives in PostgreSQL through ActiveRecord models; there is no separate domain database or microservice boundary.
12. UI evolution boundary
- Many views and partials exist in both normal and +v2 variants, and there is a docs/v2_ui_migration.md.
- That means the codebase currently supports two presentation modes over the same backend domain, which is an important diagram boundary: shared models/controllers, parallel view layer.
13. Operational setup
- Development is containerized with Docker/Compose and Dev Container support.
- CI runs RSpec and RuboCop on pull requests, and main-branch merges deploy automatically to Fly.io via GitHub Actions.
- Sentry is configured for runtime error monitoring.
14. How the main data flows connect
- Users authenticate → browse shops/records → start or submit a measurement → Record/LineStatus are persisted → Turbo updates the page → related counts/favorites/likes refresh.
- Admins and sync tasks import or manage master data/content in the background, while public users consume the same models through the rendered pages and interactive widgets.
Main entry points: user.rb User · record.rb Record · authenticatable.rb Auth concern · application_mailer.rb Mailers
Components 34
Auth & accounts
Login, account recovery, and identity providers.
- Auth concern · Reusable authorization and login guards.
app/controllers/concerns/authenticatable.rb - Users · Profiles, settings, and test-mode behavior.
app/controllers/users_controller.rb - Sessions · Sign-in and sign-out flow.
app/controllers/sessions_controller.rb - Password resets · Password reset request and update flow.
app/controllers/password_resets_controller.rb - Activations · Account activation lifecycle.
app/controllers/account_activations_controller.rb - Social login · OmniAuth callback and provider identity handling.
app/controllers/omniauth_users_controller.rb - User · Identity hub for roles, providers, activation, and test mode.
app/models/user.rb
Ramen measurement
Main wait-time and live queue workflow.
- Records · Record detail, results, and measurement lifecycle.
app/controllers/records_controller.rb - New records · Starts a new measurement and manages intermediate form updates.
app/controllers/new_records_controller.rb - Line status · Live queue posting, editing, and Turbo Stream updates.
app/controllers/line_statuses_controller.rb - Cheer messages · Lightweight encouragement around the waiting experience.
app/controllers/cheer_messages_controller.rb - Record · Wait-time measurement and retirement state.
app/models/record.rb - Line status · Current live queue state for a shop.
app/models/line_status.rb - Cheer message · Short supportive message tied to the measurement flow.
app/models/cheer_message.rb
Shops & discovery
Shop directory, location, favorites, and engagement.
- Shops · Shop pages, search, nearby lookup, maps, and favorites entrypoints.
app/controllers/ramen_shops_controller.rb - Favorites · User-to-shop favorite toggles.
app/controllers/favorites_controller.rb - Likes · User-to-record like toggles.
app/controllers/likes_controller.rb - Favorite records · Browse and filter saved or favored records.
app/controllers/favorite_records_controller.rb - Home · Signed-in home and search surfaces.
app/controllers/home_controller.rb - Ramen shop · Shop master data and location-based attributes.
app/models/ramen_shop.rb - Favorite · User-to-shop relationship for saved shops.
app/models/favorite.rb - Like · User-to-record engagement relationship.
app/models/like.rb
Content & admin
Editorial pages, announcements, FAQs, and admin management.
- Announcements · Public announcement pages.
app/controllers/announcements_controller.rb - Admin announcements · Back-office announcement management.
app/controllers/admin/announcements_controller.rb - FAQs · Frequently asked questions pages and editing.
app/controllers/faqs_controller.rb - Static pages · Terms and privacy policy pages.
app/controllers/statics_controller.rb - Landing page · Top-of-funnel landing experience.
app/controllers/landing_page_controller.rb - Shop request · Incoming shop registration request.
app/models/shop_register_request.rb - Announcement · Published announcements with rich text.
app/models/announcement.rb - FAQ · Editable FAQ entries.
app/models/faq.rb
Platform
Jobs, services, frontend behavior, and infrastructure.
- Application controller · Shared controller layer and cross-cutting access control.
app/controllers/application_controller.rb - Services · External data fetch, spreadsheet sync, URL handling, and GCP sessions.
app/services/document_fetcher.rb - Background jobs · Auto-retirement and cheer-message delivery.
app/jobs/application_job.rb - Mailers · Account, shop registration, and retirement emails.
app/mailers/application_mailer.rb
Connections 31
- Application controller → Auth concern: uses · Base controllers share login and permission guards.
- Auth concern → Users: guards · User-related actions depend on shared access control.
- Auth concern → Shops: guards · Directory actions are wrapped by the common auth layer.
- Auth concern → Records: guards · Measurement actions rely on the common auth layer.
- Users → User: manages · Profiles and account flags.
- Sessions → User: authenticates · Credentials resolve to the user hub.
- Password resets → User: updates · Reset tokens and password changes.
- Activations → User: activates · Activation state lives on users.
- Social login → User: links · Provider/uid identities attach to users.
- Shops → Ramen shop: reads/writes · Shop directory and location data.
- Home → Ramen shop: browses · Home/search surfaces surface shops.
- Favorites → Favorite: toggles · Creates and removes shop favorites.
- Likes → Like: toggles · Creates and removes record likes.
- Favorite records → Record: lists · Filtered record feed centers on record data.
- New records → Record: starts · Initiates measurement records.
- Records → Record: shows · Detail and result pages come from records.
- Records → Line status: uses · Recorded measurement is tied to live queue state.
- Line status → Line status: manages · Live queue state is created and updated here.
- Cheer messages → Cheer message: renders · Support messages are surfaced through the controller.
- Announcements → Announcement: publishes · Public announcement pages.
- Admin announcements → Announcement: administers · Admin CRUD over announcements.
- FAQs → FAQ: edits · FAQ content management.
- Static pages → Announcement: pairs with · Editorial content sits alongside static pages and rich text.
- Static pages → Mailers: shares content layer · Policy and legal pages are part of the same public content boundary.
- Services → Ramen shop: syncs · Shop master data import and enrichment.
- Services → FAQ: imports · Content can be fed from external sources or spreadsheets.
- Background jobs → Record: retires · Background job auto-closes stale measurements.
- Background jobs → Cheer message: sends · Background delivery of cheer messages.
- Mailers → User: notifies · Activation and password reset emails.
- Mailers → Shop request: notifies · Registration workflows send shop-request mail.
- Mailers → Record: notifies · Retirement notifications refer back to records.