Skip to content

Feat/front - Authentication/Authorization/Frontend in Ruby side - #1

Merged
wilbert merged 24 commits into
masterfrom
feat/front
Sep 9, 2026
Merged

wilbert merged 24 commits into
masterfrom
feat/front

Conversation

@wilbert

@wilbert wilbert commented Sep 9, 2026

Copy link
Copy Markdown
Owner

Summary

Delivers the Rails 8 / Ruby 4 user-management application: authentication,
authorization, the admin user backend, and self-service profiles, with a
full RSpec suite. master was an empty repo (README + CodeQL workflow only),
so this PR is the whole application.

Stack: Rails 8.1 · Ruby 4.0.6 · PostgreSQL · Vite + Inertia.js + React ·
Tailwind · RSpec + Playwright

What's included

Authentication & registration — Rails 8's built-in generator, no Devise.
Session cookies are signed, httponly, same_site: :lax; sign-in and password
reset are rate-limited. Visitors self-register as members; role is forced
server-side so the param can't escalate.

AuthorizationApplicationPolicy / UserPolicy behind an Authorization
concern. authorize! derives the predicate from action_name. Policy scopes
narrow queries at the source, so a member requesting another user's record gets
a 404 rather than a 403 — no existence leak.

Admin — dashboard, user CRUD, and a role toggle guarded so an admin cannot
demote themselves. UserSearch handles filtering, sorting, and pagination with
column/direction allowlists and sanitize_sql_like escaping.

Profiles — members view, edit, and delete only their own account.

Dataemail_address is deterministically encrypted (unique index intact);
avatars accept an ActiveStorage upload or a remote URL, with content-type and
size validation; a model-level guard prevents removing the last administrator.

Tests

296 examples, 0 failures — 98.61% line, 100% branch coverage. SimpleCov gates
the build at 90% line / 80% branch. Request, model, policy, serializer, query,
and mailer specs, plus a Playwright system spec covering real-browser sign-in.
RuboCop (rails-omakase) is clean.

Not in this PR

  • React pages. Controllers render Admin/Users/*, Profile/*, and
    Auth/Register; only home and inertia_example exist so far. The server
    side is complete and specced, but these screens will not render yet.
  • Spreadsheet import. roo is vendored; the importer and Solid Queue job
    are not written.
  • Real-time dashboard counters via Solid Cable.

- Created 422.html for handling "Unprocessable Entity" errors with a user-friendly message and SVG icon.
- Created 500.html for handling "Internal Server Error" with a corresponding message and SVG icon.
- Added icon.png and icon.svg for branding and visual representation on error pages.
- Included a robots.txt file to manage web crawler access.
- Added placeholder .keep files in various directories to ensure they are tracked by version control.
- Added package.json with dependencies for React, Inertia.js, Tailwind CSS, and Vite.
- Created rails_helper.rb and spec_helper.rb for RSpec configuration.
- Added TypeScript configuration files: tsconfig.app.json, tsconfig.node.json, and tsconfig.json.
- Set up Vite configuration for React, Inertia.js, and Tailwind CSS integration.
This commit renames config/database.yml to config/database.yml.sample to keep environment-specific database settings out of version control. The sample file can still be copied and customized locally without committing sensitive or machine-specific values.
…reate database.yml for development and production
@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 175 files, which is 75 over the limit of 100.

To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch.

Upgrade to a paid plan to raise the limit.

This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a92e7ed0-5acd-4b7c-85f5-9cf27ca04b9d

📥 Commits

Reviewing files that changed from the base of the PR and between 7b5af58 and 3113693.

⛔ Files ignored due to path filters (9)
  • Gemfile.lock is excluded by !**/*.lock
  • app/javascript/assets/inertia.svg is excluded by !**/*.svg
  • app/javascript/assets/rails.svg is excluded by !**/*.svg
  • app/javascript/assets/react.svg is excluded by !**/*.svg
  • app/javascript/assets/vite_ruby.svg is excluded by !**/*.svg
  • package-lock.json is excluded by !**/package-lock.json
  • public/icon.png is excluded by !**/*.png
  • public/icon.svg is excluded by !**/*.svg
  • spec/fixtures/files/avatar.png is excluded by !**/*.png
📒 Files selected for processing (175)
  • .dockerignore
  • .gitattributes
  • .github/dependabot.yml
  • .github/workflows/ci.yml
  • .gitignore
  • .kamal/hooks/docker-setup.sample
  • .kamal/hooks/post-app-boot.sample
  • .kamal/hooks/post-deploy.sample
  • .kamal/hooks/post-proxy-reboot.sample
  • .kamal/hooks/pre-app-boot.sample
  • .kamal/hooks/pre-build.sample
  • .kamal/hooks/pre-connect.sample
  • .kamal/hooks/pre-deploy.sample
  • .kamal/hooks/pre-proxy-reboot.sample
  • .kamal/secrets
  • .rspec
  • .rubocop.yml
  • .ruby-version
  • Dockerfile
  • Gemfile
  • Procfile.dev
  • Rakefile
  • app/assets/builds/.keep
  • app/assets/images/.keep
  • app/assets/stylesheets/application.css
  • app/assets/tailwind/application.css
  • app/channels/application_cable/connection.rb
  • app/controllers/admin/dashboards_controller.rb
  • app/controllers/admin/user_roles_controller.rb
  • app/controllers/admin/users_controller.rb
  • app/controllers/application_controller.rb
  • app/controllers/concerns/.keep
  • app/controllers/concerns/authentication.rb
  • app/controllers/concerns/authorization.rb
  • app/controllers/home_controller.rb
  • app/controllers/inertia_controller.rb
  • app/controllers/inertia_example_controller.rb
  • app/controllers/passwords_controller.rb
  • app/controllers/profiles_controller.rb
  • app/controllers/registrations_controller.rb
  • app/controllers/sessions_controller.rb
  • app/helpers/application_helper.rb
  • app/javascript/application.js
  • app/javascript/controllers/application.js
  • app/javascript/controllers/hello_controller.js
  • app/javascript/controllers/index.js
  • app/javascript/entrypoints/application.css
  • app/javascript/entrypoints/application.ts
  • app/javascript/entrypoints/inertia.tsx
  • app/javascript/pages/home/index.tsx
  • app/javascript/pages/inertia_example/index.module.css
  • app/javascript/pages/inertia_example/index.tsx
  • app/javascript/types/globals.d.ts
  • app/javascript/types/index.ts
  • app/javascript/types/vite-env.d.ts
  • app/jobs/application_job.rb
  • app/mailers/application_mailer.rb
  • app/mailers/passwords_mailer.rb
  • app/models/application_record.rb
  • app/models/concerns/.keep
  • app/models/current.rb
  • app/models/session.rb
  • app/models/user.rb
  • app/policies/application_policy.rb
  • app/policies/user_policy.rb
  • app/queries/user_search.rb
  • app/serializers/user_serializer.rb
  • app/views/admin/dashboards/show.html.erb
  • app/views/layouts/application.html.erb
  • app/views/layouts/mailer.html.erb
  • app/views/layouts/mailer.text.erb
  • app/views/passwords/edit.html.erb
  • app/views/passwords/new.html.erb
  • app/views/passwords_mailer/reset.html.erb
  • app/views/passwords_mailer/reset.text.erb
  • app/views/profiles/show.html.erb
  • app/views/pwa/manifest.json.erb
  • app/views/pwa/service-worker.js
  • app/views/sessions/new.html.erb
  • bin/brakeman
  • bin/bundler-audit
  • bin/ci
  • bin/dev
  • bin/docker-entrypoint
  • bin/importmap
  • bin/jobs
  • bin/kamal
  • bin/rails
  • bin/rake
  • bin/rubocop
  • bin/setup
  • bin/thrust
  • bin/vite
  • config.ru
  • config/application.rb
  • config/boot.rb
  • config/bundler-audit.yml
  • config/cable.yml
  • config/cache.yml
  • config/ci.rb
  • config/credentials.yml.enc
  • config/database.yml
  • config/database.yml.sample
  • config/deploy.yml
  • config/environment.rb
  • config/environments/development.rb
  • config/environments/production.rb
  • config/environments/test.rb
  • config/importmap.rb
  • config/initializers/assets.rb
  • config/initializers/content_security_policy.rb
  • config/initializers/filter_parameter_logging.rb
  • config/initializers/inertia_rails.rb
  • config/initializers/inflections.rb
  • config/locales/en.yml
  • config/puma.rb
  • config/queue.yml
  • config/recurring.yml
  • config/routes.rb
  • config/storage.yml
  • config/vite.json
  • db/cable_schema.rb
  • db/cache_schema.rb
  • db/migrate/20260909114545_create_users.rb
  • db/migrate/20260909114546_create_sessions.rb
  • db/migrate/20260909120500_add_profile_fields_to_users.rb
  • db/migrate/20260909120845_create_active_storage_tables.active_storage.rb
  • db/queue_schema.rb
  • db/schema.rb
  • db/seeds.rb
  • lib/tasks/.keep
  • log/.keep
  • package.json
  • public/400.html
  • public/404.html
  • public/406-unsupported-browser.html
  • public/422.html
  • public/500.html
  • public/robots.txt
  • script/.keep
  • spec/controllers/authorization_spec.rb
  • spec/controllers/shared_data_spec.rb
  • spec/factories/sessions.rb
  • spec/factories/users.rb
  • spec/fixtures/files/document.txt
  • spec/mailers/passwords_mailer_spec.rb
  • spec/models/session_spec.rb
  • spec/models/user_spec.rb
  • spec/policies/application_policy_spec.rb
  • spec/policies/user_policy_spec.rb
  • spec/queries/user_search_spec.rb
  • spec/rails_helper.rb
  • spec/requests/admin/dashboards_spec.rb
  • spec/requests/admin/user_roles_spec.rb
  • spec/requests/admin/users_spec.rb
  • spec/requests/passwords_spec.rb
  • spec/requests/profiles_spec.rb
  • spec/requests/registrations_spec.rb
  • spec/requests/sessions_spec.rb
  • spec/requests/shared_data_spec.rb
  • spec/serializers/user_serializer_spec.rb
  • spec/spec_helper.rb
  • spec/support/authentication_helpers.rb
  • spec/support/capybara.rb
  • spec/system/authentication_spec.rb
  • storage/.keep
  • tmp/.keep
  • tmp/pids/.keep
  • tmp/storage/.keep
  • tsconfig.app.json
  • tsconfig.json
  • tsconfig.node.json
  • vendor/.keep
  • vendor/javascript/.keep
  • vite.config.ts

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wilbert
wilbert merged commit 7fdda30 into master Sep 9, 2026
2 of 6 checks passed
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