Skip to content

Modernize Rails stack and refactor authentication system - #100

Open
dvd90 wants to merge 1 commit into
masterfrom
claude/repo-refresh-brainstorm-8cl90k
Open

Modernize Rails stack and refactor authentication system#100
dvd90 wants to merge 1 commit into
masterfrom
claude/repo-refresh-brainstorm-8cl90k

Conversation

@dvd90

@dvd90 dvd90 commented Jul 27, 2026

Copy link
Copy Markdown
Owner

This is a major refactor that modernizes the ReadCoin application from Rails 5.2 with Devise to Rails 8.1 with a custom authentication system, while also updating the frontend stack and database.

Summary

The application has been upgraded from an older Rails version to Rails 8.1, replacing Devise-based authentication with a custom session-based system. The frontend has been migrated from Webpacker/Bootstrap to Tailwind CSS with Importmap. The database has been switched from PostgreSQL to SQLite, and the codebase has been significantly reorganized with new modular controller structures.

Key Changes

Authentication & User Management:

  • Removed Devise gem and all related configuration/views
  • Implemented custom SessionsController, RegistrationsController, and PasswordsController for authentication
  • Added Authentication concern for authorization logic
  • Created Current class for managing current user/session context
  • Added PasswordsMailer for password reset functionality
  • Simplified User model to remove Devise dependencies

Architecture & Controllers:

  • Reorganized controllers into namespaced modules: Family:: (parent dashboard) and Play:: (kid reading interface)
  • Created base controllers (Family::BaseController, Play::BaseController) for shared logic
  • New controllers: Family::BooksController, Family::KidsController, Family::RewardsController, Family::QuizzesController, Family::RedemptionsController, Play::BooksController, Play::SessionsController, Play::ShopController, Play::DashboardsController
  • Removed old controllers: KidsController, BooksController, PaymentsController, PrizesController, ReadingsController, Admin::BooksController, Admin::PrizesController

Models:

  • Updated Kid model with avatar support and new associations
  • Created Quiz model for storing comprehension questions
  • Created Reward model (replacing Prize)
  • Created Redemption model for tracking reward redemptions
  • Created Session model for session management
  • Updated Reading model with PASS_SCORE constant and quiz associations
  • Removed Order, Purchase, and Prize models

Frontend & Styling:

  • Migrated from Webpacker to Importmap for JavaScript bundling
  • Replaced Bootstrap/SCSS with Tailwind CSS
  • Removed all old SCSS files and component styles
  • Added Tailwind CSS configuration and build process
  • Created new layout files: layouts/family.html.erb, layouts/play.html.erb
  • Removed old Devise views and form-based views
  • Added new views for family dashboard, kid management, book management, quizzes, and shop

Database:

  • Switched from PostgreSQL to SQLite
  • Updated database.yml configuration
  • Created new migrations for Rails 8.1 schema
  • Added support for Solid Queue, Solid Cache, and Solid Cable
  • Removed old Devise migration

Configuration:

  • Updated Ruby version from 2.4.4 to 3.3.6
  • Updated Gemfile with modern dependencies (removed Devise, Webpacker, Carrierwave, etc.)
  • Added new gems: Tailwind CSS, Importmap, Solid Queue, Solid Cache, Solid Cable
  • Updated Rails environment configurations
  • Added CI/CD workflow (GitHub Actions)
  • Added new initializers and removed old ones (Devise, SimpleForm, Webpacker, etc.)

Services & Jobs:

  • Added QuizGenerator service for AI-powered quiz generation via Claude API
  • Updated ApplicationJob with retry configuration

Other:

  • Updated error pages (400, 406 HTML pages)
  • Added PWA support (manifest.json, service-worker.js)
  • Updated README with new project description
  • Added security scanning tools (Brakeman, Bundler Audit)
  • Added development tooling (bin/dev, bin/ci, bin/jobs, etc.)
  • Updated seed data for demo family and public-domain books

Notable Implementation Details

  • The custom authentication system uses session-based approach with password reset via email
  • Family and Play modules provide separate interfaces for parents and children
  • Quiz generation integrates with Claude

https://claude.ai/code/session_01EuR6A3W2am5iiojTfUJNYr

Rebuild ReadCoin from scratch on a modern stack, replacing the 2018
Rails 5.2 / Bootstrap 3 / jQuery app:

- Rails 8.1, Ruby 3.3, SQLite + Solid Queue/Cache/Cable, Propshaft,
  import maps, Hotwire, Tailwind CSS 4
- Parent auth via Rails 8 built-in authentication + sign-up
- Kids log in with a 4-digit PIN (bcrypt-hashed — no more plaintext
  passwords) on a kid-friendly /play area with coins, streaks and badges
- Quizzes stored as JSON and graded server-side, so answers never reach
  the browser; coins credited exactly once inside a row lock
- AI quiz generation from any book via the Claude API (anthropic gem),
  gracefully disabled without an API key
- Rewards are parent-defined real-world prizes with an approval flow —
  Stripe/money handling removed entirely
- Seeds with public-domain books from Project Gutenberg
- Integration tests for the kid play flow and parent admin flow

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EuR6A3W2am5iiojTfUJNYr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant