Modernize Rails stack and refactor authentication system - #100
Open
dvd90 wants to merge 1 commit into
Open
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
SessionsController,RegistrationsController, andPasswordsControllerfor authenticationAuthenticationconcern for authorization logicCurrentclass for managing current user/session contextPasswordsMailerfor password reset functionalityUsermodel to remove Devise dependenciesArchitecture & Controllers:
Family::(parent dashboard) andPlay::(kid reading interface)Family::BaseController,Play::BaseController) for shared logicFamily::BooksController,Family::KidsController,Family::RewardsController,Family::QuizzesController,Family::RedemptionsController,Play::BooksController,Play::SessionsController,Play::ShopController,Play::DashboardsControllerKidsController,BooksController,PaymentsController,PrizesController,ReadingsController,Admin::BooksController,Admin::PrizesControllerModels:
Kidmodel with avatar support and new associationsQuizmodel for storing comprehension questionsRewardmodel (replacingPrize)Redemptionmodel for tracking reward redemptionsSessionmodel for session managementReadingmodel withPASS_SCOREconstant and quiz associationsOrder,Purchase, andPrizemodelsFrontend & Styling:
layouts/family.html.erb,layouts/play.html.erbDatabase:
database.ymlconfigurationConfiguration:
Services & Jobs:
QuizGeneratorservice for AI-powered quiz generation via Claude APIApplicationJobwith retry configurationOther:
Notable Implementation Details
https://claude.ai/code/session_01EuR6A3W2am5iiojTfUJNYr