RepoPilotOpen in app →

DavyJonesLocker/client_side_validations

Client Side Validations made easy for Ruby on Rails

Healthy

Healthy across all four use cases

Use as dependencyHealthy

Permissive license, no critical CVEs, actively maintained — safe to depend on.

Fork & modifyHealthy

Has a license, tests, and CI — clean foundation to fork and modify.

Learn fromHealthy

Documented and popular — useful reference codebase to read through.

Deploy as-isHealthy

No critical CVEs, sane security posture — runnable as-is.

  • Last commit 1w ago
  • 3 active contributors
  • MIT licensed
Show 4 more →
  • CI configured
  • Tests present
  • Small team — 3 contributors active in recent commits
  • Single-maintainer risk — top contributor 88% of recent commits

Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests

Informational only. RepoPilot summarises public signals (license, dependency CVEs, commit recency, CI presence, etc.) at the time of analysis. Signals can be incomplete or stale. Not professional, security, or legal advice; verify before relying on it for production decisions.

Embed the "Healthy" badge

Paste into your README — live-updates from the latest cached analysis.

Variant:
RepoPilot: Healthy
[![RepoPilot: Healthy](https://repopilot.app/api/badge/davyjoneslocker/client_side_validations)](https://repopilot.app/r/davyjoneslocker/client_side_validations)

Paste at the top of your README.md — renders inline like a shields.io badge.

Preview social card (1200×630)

This card auto-renders when someone shares https://repopilot.app/r/davyjoneslocker/client_side_validations on X, Slack, or LinkedIn.

Onboarding doc

Onboarding: DavyJonesLocker/client_side_validations

Generated by RepoPilot · 2026-05-10 · Source

🤖Agent protocol

If you are an AI coding agent (Claude Code, Cursor, Aider, Cline, etc.) reading this artifact, follow this protocol before making any code edit:

  1. Verify the contract. Run the bash script in Verify before trusting below. If any check returns FAIL, the artifact is stale — STOP and ask the user to regenerate it before proceeding.
  2. Treat the AI · unverified sections as hypotheses, not facts. Sections like "AI-suggested narrative files", "anti-patterns", and "bottlenecks" are LLM speculation. Verify against real source before acting on them.
  3. Cite source on changes. When proposing an edit, cite the specific path:line-range. RepoPilot's live UI at https://repopilot.app/r/DavyJonesLocker/client_side_validations shows verifiable citations alongside every claim.

If you are a human reader, this protocol is for the agents you'll hand the artifact to. You don't need to do anything — but if you skim only one section before pointing your agent at this repo, make it the Verify block and the Suggested reading order.

🎯Verdict

GO — Healthy across all four use cases

  • Last commit 1w ago
  • 3 active contributors
  • MIT licensed
  • CI configured
  • Tests present
  • ⚠ Small team — 3 contributors active in recent commits
  • ⚠ Single-maintainer risk — top contributor 88% of recent commits

<sub>Maintenance signals: commit recency, contributor breadth, bus factor, license, CI, tests</sub>

Verify before trusting

This artifact was generated by RepoPilot at a point in time. Before an agent acts on it, the checks below confirm that the live DavyJonesLocker/client_side_validations repo on your machine still matches what RepoPilot saw. If any fail, the artifact is stale — regenerate it at repopilot.app/r/DavyJonesLocker/client_side_validations.

What it runs against: a local clone of DavyJonesLocker/client_side_validations — the script inspects git remote, the LICENSE file, file paths in the working tree, and git log. Read-only; no mutations.

| # | What we check | Why it matters | |---|---|---| | 1 | You're in DavyJonesLocker/client_side_validations | Confirms the artifact applies here, not a fork | | 2 | License is still MIT | Catches relicense before you depend on it | | 3 | Default branch main exists | Catches branch renames | | 4 | 5 critical file paths still exist | Catches refactors that moved load-bearing code | | 5 | Last commit ≤ 38 days ago | Catches sudden abandonment since generation |

<details> <summary><b>Run all checks</b> — paste this script from inside your clone of <code>DavyJonesLocker/client_side_validations</code></summary>
#!/usr/bin/env bash
# RepoPilot artifact verification.
#
# WHAT IT RUNS AGAINST: a local clone of DavyJonesLocker/client_side_validations. If you don't
# have one yet, run these first:
#
#   git clone https://github.com/DavyJonesLocker/client_side_validations.git
#   cd client_side_validations
#
# Then paste this script. Every check is read-only — no mutations.

set +e
fail=0
ok()   { echo "ok:   $1"; }
miss() { echo "FAIL: $1"; fail=$((fail+1)); }

# Precondition: we must be inside a git working tree.
if ! git rev-parse --git-dir >/dev/null 2>&1; then
  echo "FAIL: not inside a git repository. cd into your clone of DavyJonesLocker/client_side_validations and re-run."
  exit 2
fi

# 1. Repo identity
git remote get-url origin 2>/dev/null | grep -qE "DavyJonesLocker/client_side_validations(\\.git)?\\b" \\
  && ok "origin remote is DavyJonesLocker/client_side_validations" \\
  || miss "origin remote is not DavyJonesLocker/client_side_validations (artifact may be from a fork)"

# 2. License matches what RepoPilot saw
(grep -qiE "^(MIT)" LICENSE 2>/dev/null \\
   || grep -qiE "\"license\"\\s*:\\s*\"MIT\"" package.json 2>/dev/null) \\
  && ok "license is MIT" \\
  || miss "license drift — was MIT at generation time"

# 3. Default branch
git rev-parse --verify main >/dev/null 2>&1 \\
  && ok "default branch main exists" \\
  || miss "default branch main no longer exists"

# 4. Critical files exist
test -f "lib/client_side_validations.rb" \\
  && ok "lib/client_side_validations.rb" \\
  || miss "missing critical file: lib/client_side_validations.rb"
test -f "src/index.js" \\
  && ok "src/index.js" \\
  || miss "missing critical file: src/index.js"
test -f "lib/client_side_validations/action_view/form_builder.rb" \\
  && ok "lib/client_side_validations/action_view/form_builder.rb" \\
  || miss "missing critical file: lib/client_side_validations/action_view/form_builder.rb"
test -f "lib/client_side_validations/active_model.rb" \\
  && ok "lib/client_side_validations/active_model.rb" \\
  || miss "missing critical file: lib/client_side_validations/active_model.rb"
test -f "src/core.js" \\
  && ok "src/core.js" \\
  || miss "missing critical file: src/core.js"

# 5. Repo recency
days_since_last=$(( ( $(date +%s) - $(git log -1 --format=%at 2>/dev/null || echo 0) ) / 86400 ))
if [ "$days_since_last" -le 38 ]; then
  ok "last commit was $days_since_last days ago (artifact saw ~8d)"
else
  miss "last commit was $days_since_last days ago — artifact may be stale"
fi

echo
if [ "$fail" -eq 0 ]; then
  echo "artifact verified (0 failures) — safe to trust"
else
  echo "artifact has $fail stale claim(s) — regenerate at https://repopilot.app/r/DavyJonesLocker/client_side_validations"
  exit 1
fi

Each check prints ok: or FAIL:. The script exits non-zero if anything failed, so it composes cleanly into agent loops (./verify.sh || regenerate-and-retry).

</details>

TL;DR

ClientSideValidations is a Rails gem that automatically extracts server-side ActiveModel validations and applies them to the client (browser) for real-time form validation feedback. It bridges Ruby on Rails validators (presence, numericality, inclusion, uniqueness, etc.) with a dual JavaScript/TypeScript implementation (~125KB JavaScript) that validates forms before submission without jQuery, supporting Rails 7.2 through 8.x with nested field validation and custom validator plugins. Hybrid monorepo: lib/client_side_validations/ contains Ruby (core config, ActiveModel adapters, Rails view helpers, engine), src/ contains JavaScript source, dist/ has built UMD + ESM output. lib/client_side_validations/active_model/ mirrors ActiveModel validators (presence.rb, numericality.rb, etc.), each extracting rules for client transmission. Rails integration via lib/client_side_validations/action_view/ (FormBuilder, form_with_helper).

👥Who it's for

Rails developers building forms who want inline validation UX matching Luke Wroblewski's best practices—specifically developers tired of duplicating validation logic between Rails models and client JavaScript. Gem maintainers and form-builder library authors who need a plugin system to extend validation behavior.

🌱Maturity & risk

Production-ready and actively maintained. The project has GitHub Actions CI (ruby.yml, javascript.yml, eslint.yml, rubocop.yml), published npm package v24.0.0, multi-version Appraisals testing (Rails 7.2–8.1 + edge), and 164KB Ruby + 125KB JavaScript codebase. Last visible commit activity shows recent linting/CI setup and gemfile matrix maintenance, indicating active stewardship.

Low-to-moderate risk: single maintainer (Geremia Taglialatela visible in package.json), but with strong test/CI coverage across Rails and JavaScript. The dual codebase (Ruby + JavaScript) increases surface area for bugs. No visible high-dependency bloat (Babel, Rollup, Puppeteer are all dev-only), but coordinating Ruby and JS updates requires discipline. Breaking changes between major versions (24.0.0 dropped jQuery) suggest they're willing to modernize.

Active areas of work

Recent work focuses on Rails 8.x compatibility (gemfiles/rails_8.0.gemfile, rails_8.1.gemfile exist), ESLint/RuboCop linting enforcement (eslint.yml, rubocop.yml workflows), and Babel/Rollup build modernization (.babelrc, rollup config). The removal of jQuery (24.0.0 changelog note) and shift to native DOM APIs suggests active refactoring for modern browser standards.

🚀Get running

git clone https://github.com/DavyJonesLocker/client_side_validations.git
cd client_side_validations
bundle install
pnpm install
rake test
pnpm run test

Daily commands: Dev: bundle exec rake (runs Ruby tests), pnpm run test (runs QUnit via Puppeteer). Build: pnpm run build (Rollup → dist/). Install in Rails app: rails g client_side_validations:install + add import '@client-side-validations/client-side-validations' in app/javascript/packs/application.js.

🗺️Map of the codebase

  • lib/client_side_validations.rb — Main entry point that loads the entire gem; all contributors must understand the initialization flow
  • src/index.js — JavaScript entry point that bootstraps client-side validation; essential for frontend validation behavior
  • lib/client_side_validations/action_view/form_builder.rb — Core Rails form integration that injects validation metadata into HTML; every form helper route depends on this
  • lib/client_side_validations/active_model.rb — ActiveModel validator extraction and mapping; bridges Rails validators to client-side rules
  • src/core.js — Client validation engine that processes validation rules and executes validators
  • lib/client_side_validations/generators/rails_validations.rb — Generates validation rules from Rails models for client consumption; enables model-form synchronization

🧩Components & responsibilities

  • ActiveModel Validator Extractors (Ruby, ActiveModel) — Convert Rails validator definitions into JSON rules consumable by JavaScript

🛠️How to make changes

Add a new ActiveModel validator

  1. Create a validator extractor in lib/client_side_validations/active_model/ (e.g., uniqueness.rb) that defines how the validator should be converted to client rules (lib/client_side_validations/active_model/[validator_name].rb)
  2. Register the validator in lib/client_side_validations/config.rb by adding it to the VALIDATORS mapping (lib/client_side_validations/config.rb)
  3. Create a JavaScript validator implementation in src/validators/local/ that performs the actual validation (src/validators/local/[validator_name].js)
  4. Import and export the new validator in src/validators/index.js (src/validators/index.js)
  5. Add unit tests for the Rails extractor in test/active_model/cases/test_[validator_name]_validator.rb (test/active_model/cases/test_[validator_name]_validator.rb)

Add a new client-side validator option

  1. Modify the Rails validator extractor (e.g., lib/client_side_validations/active_model/length.rb) to extract the new option parameter (lib/client_side_validations/active_model/[validator_name].rb)
  2. Update the JavaScript validator (e.g., src/validators/local/length.js) to handle the new option in its validation logic (src/validators/local/[validator_name].js)
  3. Add test cases in both test/active_model and test/javascript directories (test/active_model/cases/test_[validator_name]_validator.rb)

Customize validation error rendering

  1. Override validation behavior in src/core.js by modifying the handleValidation or buildConstraints functions (src/core.js)
  2. Implement custom error display logic in event handlers within src/events.js (src/events.js)
  3. Update form builder in lib/client_side_validations/action_view/form_builder.rb to pass custom options to client validator (lib/client_side_validations/action_view/form_builder.rb)

🔧Why these technologies

  • Ruby on Rails (ActionView, ActiveModel, ActiveRecord) — Core framework for server-side model validation extraction and form generation; enables automatic rule synchronization between server and client
  • JavaScript (ES6+ Rollup bundled) — Executes validation rules in browser without page reload; supports both UMD and ESM module formats for flexibility
  • Rollup (JavaScript bundler) — Produces both CommonJS and ESM builds for maximum framework compatibility; minimal bundle size with tree-shaking
  • Babel (JavaScript transpiler) — Transpiles modern JavaScript to ES5 for broad browser support while maintaining clean source code
  • Rails engines — Packages gem as pluggable Rails component; auto-loads validators, form helpers, and assets without manual configuration

⚖️Trade-offs already made

  • Extract validators from server-side Rails models rather than duplicating validation logic

    • Why: Single source of truth reduces maintenance burden and prevents rule divergence between client and server
    • Consequence: Requires explicit extractor for each Rails validator type; new validator types require new extractor code
  • Client-side validation is supplementary; all server-side validations still execute on form submission

    • Why: Prevents security bypass; some validators (uniqueness) inherently require server checks anyway
    • Consequence: Developers must understand that client validation is UX improvement only, not a security mechanism
  • Validation metadata embedded as HTML data attributes rather than separate JSON file

    • Why: Keeps form self-contained; no separate AJAX call needed to fetch rules
    • Consequence: Larger HTML payloads; rules coupled to view rendering
  • Support both legacy form_for and modern form_with helpers

    • Why: Maintains backward compatibility across Rails 7.2-8.x versions
    • Consequence: Code duplication; increased test matrix; ongoing maintenance for deprecating form_for

🚫Non-goals (don't propose these)

  • Server-side validation execution (this is Rails' responsibility)
  • Custom validator syntax beyond Rails validation API
  • Real-time form collaboration or conflict resolution
  • Internationalization of error messages (delegated to Rails i18n)
  • Form state persistence across page reloads

🪤Traps & gotchas

  1. Spring must be stopped after bundle install: spring stop (mentioned in README). 2) jQuery is no longer a dependency (v24.0+)—old codebases using jquery_ujs will break; must migrate to Webpacker/importmap. 3) Rails version compatibility is strict (7.2+); older Rails apps need different gem version. 4) Nested field validation and custom validators require specific module loading order—see lib/client_side_validations/extender.rb. 5) The generator (rails g client_side_validations:install) must be run; without it, config/initializers/client_side_validations.rb won't exist and form helpers won't inject validation metadata.

🏗️Architecture

💡Concepts to learn

  • Server-Driven Client Validation — ClientSideValidations' core philosophy: validation rules are defined once in Rails models and automatically synced to the browser, eliminating duplication and sync bugs
  • ActiveModel::Validations Adapter Pattern — The gem mirrors each Rails validator (presence, numericality, etc.) with a .rb extractor module; understanding this pattern is key to adding custom validators or debugging validation mismatch
  • Monkey-Patching / Refinements (Ruby) — ClientSideValidations extends Rails form builders and ActiveModel without subclassing; understanding how lib/client_side_validations/action_view.rb and active_model.rb patch Rails internals is critical for debugging integration issues
  • Rails Engine Pattern — The gem is a Rails engine (lib/client_side_validations/engine.rb), not a standalone library; understanding how engines mount views, migrations, and assets into host Rails apps is essential for installation and customization
  • JSON Schema / Metadata Serialization — Rails validation rules are converted to JSON metadata embedded in HTML data attributes; the client-side JavaScript parses this to validate forms. Understanding this bridge is key to debugging why client validation differs from server
  • ES Module (ESM) vs UMD Bundling — The JavaScript is built into both ESM (dist/client-side-validations.esm.js) and UMD (dist/client-side-validations.js); Rollup config determines which module system to use based on bundler (Webpacker vs. importmap vs. npm). Mismatches here cause 'module not found' errors
  • Conditional Validation (Rails :if, :unless) — ClientSideValidations avoids client-side validation for conditional validators (those with :if/:unless procs); understanding lib/client_side_validations/active_model/conditionals.rb is crucial for knowing when to fall back to server-side validation
  • rspec/rspec-rails — Testing framework often used in conjunction with ClientSideValidations to validate both server and client behavior
  • rails/rails — Core Rails framework that this gem extends; validations, form helpers, and ActionView are all monkey-patched from Rails proper
  • thoughtbot/administrate — Rails admin UI gem that could benefit from ClientSideValidations integration for form validation in admin dashboards
  • jqueryvalidation/jquery-validation — Client-side form validation library that ClientSideValidations replaced/modernized by removing jQuery dependency and using vanilla JS
  • rails/importmap-rails — Modern Rails asset bundling alternative to Webpacker; ClientSideValidations supports both and may integrate guidance for importmap setups

🪄PR ideas

To work on one of these in Claude Code or Cursor, paste: Implement the "<title>" PR idea from CLAUDE.md, working through the checklist as the task list.

Add comprehensive JavaScript unit tests for src/validators/local directory

The repo has a test directory structure but the src/validators/local validators lack explicit unit test coverage. Given that this is a validation library and validators are critical components, adding QUnit tests for each validator (presence, numericality, format, length, inclusion, exclusion, etc.) would improve reliability and make it easier for contributors to modify validators safely. The test/javascript/run-qunit.mjs infrastructure already exists.

  • [ ] Examine src/validators/local/ to identify all validator modules
  • [ ] Create test/javascript/validators/ directory structure mirroring src/validators/local/
  • [ ] Add QUnit test files for each validator testing valid/invalid inputs, edge cases, and conditional logic
  • [ ] Update test/javascript/run-qunit.mjs to include new validator tests
  • [ ] Ensure tests cover both successful validations and error states

Add integration test workflow for Rails version compatibility (Appraisals testing)

The repo maintains multiple Rails gemfiles (rails_7.2.gemfile, rails_8.0.gemfile, rails_8.1.gemfile, rails_edge.gemfile) via Appraisals but there's no CI workflow explicitly running appraisal tests. The ruby.yml workflow exists but doesn't appear to test against all gemfile variants. Adding a dedicated GitHub Actions workflow would catch version-specific regressions early.

  • [ ] Review .github/workflows/ruby.yml to confirm appraisal tests aren't already running
  • [ ] Create .github/workflows/appraisals.yml that runs 'appraisal install && appraisal rake' against each gemfile
  • [ ] Configure matrix strategy to test Rails 7.2, 8.0, 8.1, and edge versions in parallel
  • [ ] Ensure workflow fails if any Rails version has test failures
  • [ ] Add badge to README.md for Appraisals workflow status

Add ESLint configuration documentation and fix lingering style issues in src/

The repo has eslint.config.mjs and a JavaScript workflow, but there's no documented style guide or CONTRIBUTING guidance for JavaScript code. Additionally, examining src/ files for any ESLint warnings would improve code quality. A PR documenting JavaScript conventions and running a comprehensive lint pass would help new contributors write compliant code immediately.

  • [ ] Run eslint across src/ directory and document any warnings/errors found
  • [ ] Create or update CONTRIBUTING.md with JavaScript style guide section referencing neostandard/eslint-plugin-compat rules
  • [ ] Fix any identified ESLint violations in src/ files (naming conventions, compatibility issues, etc.)
  • [ ] Document browser compatibility expectations based on browserslist config in CONTRIBUTING.md
  • [ ] Add pre-commit linting guidance for JavaScript contributors

🌿Good first issues

  • Add test coverage for lib/client_side_validations/core_ext/regexp.rb and lib/client_side_validations/core_ext/range.rb—these files lack dedicated tests and are critical for format and inclusion validators. Start by examining how they're used in lib/client_side_validations/active_model/format.rb and inclusion.rb.
  • Document the custom validator plugin pattern: create a guide in CONTRIBUTING.md or docs/ showing how to extend lib/client_side_validations/active_model.rb with a custom validator module (with a real example like a phone number validator).
  • Add integration tests for Rails 8.1+ with the new form builder changes in lib/client_side_validations/action_view/form_with_helper.rb—currently only Appraisals exist but no visible test suite per version.

Top contributors

Click to expand

📝Recent commits

Click to expand
  • 91797b3 — Update to appraisal2 (#1011) (tagliala)
  • 57ab9f7 — Fix import instructions (#1009) (tagliala)
  • 1e22209 — Remove jQuery from the JavaScript runtime (#1006) (tagliala)
  • b80c4ee — Bump pnpm/action-setup from 5 to 6 (#1008) (dependabot[bot])
  • 7b0e10a — Update minitest requirement from ~> 5.27 to ~> 6.0 (#1002) (dependabot[bot])
  • 43d2cb3 — Bump pnpm/action-setup from 4 to 5 (#1005) (dependabot[bot])
  • 071980a — Bump version to 23.1.0 (#1004) (tagliala)
  • 68a054d — Test against jQuery 4 (#1003) (tagliala)
  • c8b88f4 — Bump up version (#1001) (tagliala)
  • 54743b5 — Drop EOL dependencies (#1000) (tagliala)

🔒Security observations

The codebase demonstrates good security hygiene with automated testing (GitHub Actions for ESLint, Rubocop) and Dependabot enabled for dependency monitoring. However, there are opportunities for improvement: several npm dependencies could be updated to newer versions, a security policy should be established, and clearer security documentation is needed regarding the limitations of client-side validation. The project would benefit from regular dependency audits and explicit server-side validation warnings for Rails developers using this library.

  • Medium · Outdated Babel Dependencies — package.json - devDependencies. The project uses @babel/core@^7.29.0 and @babel/preset-env@^7.29.2, which are from early 2024. These versions may contain known vulnerabilities. Babel has a history of security issues in its core transpilation logic. Fix: Update to the latest stable versions of @babel/core and @babel/preset-env. Run 'npm audit' or 'pnpm audit' to identify specific CVEs and update accordingly.
  • Medium · Puppeteer-core Dependency for Testing — package.json - devDependencies. The project uses puppeteer-core@^24.42.0 for JavaScript testing. While necessary for QUnit testing, Puppeteer handles chromium automation and may introduce supply chain risks if the dependency is compromised. Fix: Regularly audit puppeteer-core for vulnerabilities using 'pnpm audit'. Consider pinning to exact versions in production. Lock files should be committed to version control.
  • Medium · Chrome Launcher Dependency Security — package.json - devDependencies. chrome-launcher@^1.2.1 is used for browser automation testing. This is an older version (1.2.1) and may have known security issues related to process spawning and browser control. Fix: Update chrome-launcher to the latest version. Verify the launcher properly handles process isolation and doesn't expose browser instances to untrusted input.
  • Low · Missing Security.md or SECURITY.md — Repository root. The repository does not appear to have a SECURITY.md file for reporting vulnerabilities responsibly. This makes it harder for security researchers to report issues privately. Fix: Create a SECURITY.md file following GitHub's security policy guidelines. Include contact information and responsible disclosure procedures.
  • Low · Loose Dependency Versioning with Caret (^) — package.json - devDependencies. All npm dependencies use caret (^) versioning, which allows minor and patch updates automatically. This could introduce unexpected breaking changes or vulnerabilities if a transitive dependency is compromised. Fix: Consider using tilde (~) for more conservative updates, or pin exact versions for critical dependencies. Implement automated security scanning with Dependabot (already configured) and review alerts regularly.
  • Low · No Content Security Policy Mentioned — src/validators, src/events.js, src/core.js. As a client-side validation library that may manipulate DOM, there's no evidence of CSP-aware development practices in the codebase documentation or configuration. Fix: Ensure that the library respects Content Security Policy restrictions and avoids inline scripts or eval-like operations. Document CSP compatibility in README.
  • Low · Minimal Input Validation Documentation — README.md. While the library provides client-side validation, there is no explicit security notice about the importance of server-side validation. Client-side validation can be bypassed. Fix: Add a prominent security notice in the README stating that client-side validation should never replace server-side validation, and that server-side checks are mandatory for security.

LLM-derived; treat as a starting point, not a security audit.


Generated by RepoPilot. Verdict based on maintenance signals — see the live page for receipts. Re-run on a new commit to refresh.

Healthy signals · DavyJonesLocker/client_side_validations — RepoPilot