Skip to content

Add Ruby + PostgreSQL quickstart guide - #773

Open
Nsanjayboruds wants to merge 53 commits into
keploy:mainfrom
Nsanjayboruds:add-ruby-postgresql-quickstart
Open

Nsanjayboruds wants to merge 53 commits into
keploy:mainfrom
Nsanjayboruds:add-ruby-postgresql-quickstart

Conversation

@Nsanjayboruds

Copy link
Copy Markdown

Add Ruby + PostgreSQL Quickstart Guide

📝 Description

This PR adds a comprehensive quickstart guide for Ruby (Sinatra) with PostgreSQL integration, demonstrating how to use Keploy for automated API testing with Ruby applications.

🎯 Changes Made

  • ✅ Created new quickstart documentation: ruby-sinatra-postgres.md

    • Includes both Docker Compose and Local setup instructions
    • Complete CRUD API examples (GET, POST, PUT, DELETE)
    • Clear step-by-step Keploy record and test commands
    • Follows existing documentation style and structure
  • ✅ Added Ruby language support to QuickStartFilter.js

    • Added Ruby gem icon with official Ruby red color (#CC342D)
    • Enables filtering quickstarts by Ruby language
  • ✅ Registered quickstart in QuickStartList.js

    • Added entries for both Docker and Local environments
    • Properly linked to documentation sections
  • ✅ Updated sidebar navigation in version-4.0.0-sidebars.json

    • Added Ruby category under QuickStarts section
    • Maintains consistent structure with other languages

🔗 Related Repository

Sample application repository: https://github.com/Nsanjayboruds/keploy-ruby-postgresql-quickstart

✅ Pre-submission Checklist

  • Build passes locally (npm run build successful)
  • Design matches existing quickstarts
  • Both Docker and Local setup instructions included
  • Follows existing code patterns
  • Documentation is clear and beginner-friendly

📸 Preview

The quickstart covers:

  • Health check endpoint
  • Books CRUD operations
  • PostgreSQL database integration
  • Keploy record/replay workflows

🙏 Additional Notes

This is my first contribution to Keploy docs. Looking forward to feedback and happy to make any requested changes!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Ruby (Sinatra) + PostgreSQL quickstart and wires it into the Quickstarts UI and sidebar so users can discover and follow the guide.

Changes:

  • Added a new Ruby (Sinatra) + PostgreSQL Books CRUD quickstart doc (Docker + Local flows).
  • Added “Ruby” to the Quickstart language filter UI and registered Ruby quickstart entries in the list.
  • Added a Ruby category under QuickStarts in the v4.0.0 sidebar.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
versioned_sidebars/version-4.0.0-sidebars.json Adds Ruby category + doc entry under QuickStarts for v4.0.0 navigation.
versioned_docs/version-4.0.0/quickstart/ruby-sinatra-postgres.md New Ruby+Postgres quickstart guide content (Docker + Local).
src/components/QuickStartList.js Registers Ruby quickstarts (Docker + Local) in the Quickstarts catalog.
src/components/QuickStartFilter.js Adds Ruby as a selectable language with icon/color in the filter UI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/QuickStartList.js Resolved
@Nsanjayboruds
Nsanjayboruds force-pushed the add-ruby-postgresql-quickstart branch 2 times, most recently from d1b6200 to 4f2b408 Compare January 30, 2026 02:45
@Nsanjayboruds

Copy link
Copy Markdown
Author

@copilot open a new pull request to apply changes based on the comments in this thread

1 similar comment
@Nsanjayboruds

Copy link
Copy Markdown
Author

@copilot open a new pull request to apply changes based on the comments in this thread

@Achanandhi-M Achanandhi-M left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Nsanjayboruds , thanks a lot for adding the changes—really appreciate the effort. There are a few small things that still need to be added; you can use this guide as a reference: https://github.com/keploy/docs/blob/main/ADDING_A_QUICKSTART.md

Also, if possible, could you please include a short video showcasing your changes? That would be very helpful

@Nsanjayboruds

Copy link
Copy Markdown
Author

@Nsanjayboruds
Nsanjayboruds force-pushed the add-ruby-postgresql-quickstart branch 2 times, most recently from 8d671ce to eadbf29 Compare February 2, 2026 12:17
@Nsanjayboruds

Nsanjayboruds commented Feb 2, 2026 •

Copy link
Copy Markdown
Author

Hey @Nsanjayboruds , thanks a lot for adding the changes—really appreciate the effort. There are a few small things that still need to be added; you can use this guide as a reference: https://github.com/keploy/docs/blob/main/ADDING_A_QUICKSTART.md

Also, if possible, could you please include a short video showcasing your changes? That would be very helpful

hey @Achanandhi-M i added a video showcasing my change

@Nsanjayboruds

Copy link
Copy Markdown
Author

RUBY_QUICKSTART_DEMO

@Nsanjayboruds
Nsanjayboruds force-pushed the add-ruby-postgresql-quickstart branch from 7219218 to ba4b880 Compare February 3, 2026 11:17
Signed-off-by: Nsanjayboruds <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 8 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/QuickStartList.js Resolved

@amaan-bhati amaan-bhati left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for adding the Ruby Sinatra and PostgreSQL quickstart and for providing the demo video. The guide structure and content are a good start.

A few things need to be addressed before this is ready to merge:

Issues Found

1. Image filenames with spaces

The committed image files have problematic names:

  • ruby quickstartdocker_Compose.png - contains a space
  • ruby_keploy .png - has a trailing space before the extension

These cause URL encoding issues and are inconsistent with the repo's image naming conventions. Please rename them using only underscores or hyphens with no spaces or trailing characters.

2. QuickStartFilter.js over-reformatted

The diff shows 149 additions and 30 deletions in QuickStartFilter.js, which is far more than what adding a single Ruby entry requires. The extra formatting-only changes create unnecessary merge conflicts for other open PRs. Please revert those and keep the diff scoped to only the Ruby entry addition.

3. Outstanding items from contributing guide

Please confirm all items from ADDING_A_QUICKSTART.md have been addressed and request a re-review from the maintainer.

Please also rebase against main before resubmitting as there are merge conflicts with other open PRs touching the same files.

@Nsanjayboruds
Nsanjayboruds force-pushed the add-ruby-postgresql-quickstart branch from 96145ca to e68ccf8 Compare April 10, 2026 10:52
@Nsanjayboruds

Copy link
Copy Markdown
Author

Sidebar duplicate comment
Thanks for checking. I re-verified this on the latest branch state and could not reproduce a duplicate sidebar entry for this page, so no removal was needed. Resolving this thread as not reproducible on current commit.

Frontmatter keyword vs keywords
Good catch, fixed. I changed frontmatter from keyword to keywords so metadata is correctly picked up. Included in the latest push.

Local flow running keploy record twice
Agreed, this was ambiguous. I updated the local flow so recording stays in a single session and clarified that health verification should be run in a separate terminal. Included in the latest push.

QuickStartFilter over-formatted / large diff
Agreed. I reverted formatting-only edits and restored QuickStartFilter formatting to match the existing file style, keeping this PR scoped to functional quickstart additions only.

Image filenames with spaces / trailing characters
Fixed. I renamed the problematic image files to clean names (no spaces or trailing characters), updated references, and removed the old filenames from the branch.

Outstanding ADDING_A_QUICKSTART checklist + rebase request
Confirmed. I addressed the checklist items for latest version quickstart integration, completed a rebase onto main, resolved conflicts, ran a successful local docs build, and pushed the updated branch. Please re-review when convenient.

@amaan-bhati
amaan-bhati self-requested a review April 18, 2026 23:38
@amaan-bhati

Copy link
Copy Markdown
Member

Hey @Nsanjayboruds Thank you for the updates - the image filename fixes, frontmatter correction, revert of the formatting-only changes in QuickStartFilter.js, and the rebased branch are all appreciated. The demo videos are a good addition as well.

There are still a couple of things worth considering before this moves forward:

Issues to be Considered

  1. QuickStartList.js version awareness

This has been flagged twice and has not been structurally resolved. QuickStartList.js is a shared component used across all documentation versions. The two new Ruby entries link to /docs/quickstart/samples-ruby/ which only exists in version-4.0.0. On older versioned docs these cards will appear in the UI but the links will lead to a 404. Please either make the list version-aware or add the Ruby quickstart docs to all supported versions.

  1. Duplicate sidebar entry

The diff for version-4.0.0-sidebars.json shows a standalone keploy-cloud/cloud-installation entry being added outside the Installation category where it already exists. This will create a duplicate entry in the sidebar navigation. Please remove the extra standalone entry.

  1. Sample app on a personal repository

The guide currently references a personal GitHub repository for the sample app. For long-term maintainability it would be better to have this hosted under the official Keploy org so the link remains stable regardless of what happens to the your personal account. Once the review is done and we are good to go, we can push these changes to a repo in the Keploy org once we have discussed this internally with the team.

@dhananjay6561

Copy link
Copy Markdown
Member

Hi @Nsanjayboruds, please raise a PR for your quickstart here and update the docs accordingly.

Repository: https://github.com/keploy/samples-ruby

@Nsanjayboruds

Copy link
Copy Markdown
Author

Hi @Nsanjayboruds, please raise a PR for your quickstart here and update the docs accordingly.

Repository: https://github.com/keploy/samples-ruby

Hi @dhananjay6561,

Done! I have created the new Pull Request in the official samples-ruby repository for the expanded quickstart application (you can see it linked above).

I've also updated the markdown files in this current PR to point users to the new official repository location instead of my personal one.

Let me know if there's anything else you need me to adjust!

@Nsanjayboruds
Nsanjayboruds force-pushed the add-ruby-postgresql-quickstart branch from ca28d4e to 2f2c8a1 Compare August 31, 2026 12:17
chilkotiKartik

This comment was marked as spam.

@dhananjay6561 dhananjay6561 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the Ruby + PostgreSQL quickstart. The wizard rewrite (version-gated Ruby entries), the doc's slug/anchors, the QuickStartList links, and the sidebar id all line up correctly, and the local-run commands/ports match the sample app. Two things to address: a Docker replay command that drops --cmd-type docker-compose, and two committed-but-unreferenced screenshots. Details inline.

@Nsanjayboruds

Copy link
Copy Markdown
Author

Hey @dhananjay6561 , thanks for the detailed review! Here's what I've fixed:

Docker replay command — Added the missing --cid-type docker-compose flag to the keploy test command in the Docker section. Delay flags (--buildDelay 50 --delay 10) are already consistent and unchanged.
Unreferenced images — Removed static/img/ruby_keploy.png (~98KB) and static/img/ruby_quickstart_docker_compose.png (~132KB) from the repo. The two images that are actually referenced in the doc (ruby_testcase.png and ruby_postgres_docker_setup.png) have been kept.

@keploy keploy deleted a comment from Nsanjayboruds Sep 23, 2026

@dhananjay6561 dhananjay6561 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of notes on the local setup steps, inline.

@dhananjay6561 dhananjay6561 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more on the language picker, inline.

Comment thread src/components/QuickStartFilter.js Resolved


- Replace broken cp .env.example .env step with explicit export
  instructions; app has no dotenv gem so .env would never be loaded
- Fix createdb to use postgres role and add step to create the role
  if missing, preventing 503 on fresh local PostgreSQL installs
- Add type="button" to wizard option buttons to prevent accidental
  form submission in QuickStartFilter.js
- Add role="radio" and aria-checked to language and environment
  picker buttons for screen-reader accessibility
@Nsanjayboruds

Copy link
Copy Markdown
Author

Hey @dhananjay6561, addressed the two new rounds of feedback:
Local setup steps:

  • Replaced cp .env.example .env with explicit export DB_... instructions, since the app reads configuration directly from environment variables and doesn't use the dotenv gem.
  • Updated createdb booksdb to createdb -U postgres booksdb, with a preceding step to create the postgres role if it doesn't exist. This ensures /health doesn't return 503 on a fresh local PostgreSQL installation where that role isn't provisioned.

Language picker accessibility:

  • Added type="button" to all wizard option <button> elements in both the language (step 1) and environment (step 2) pickers to prevent accidental form submission.
  • Added role="radio" and aria-checked={...} to properly communicate the single-select state to screen readers.

@dhananjay6561 dhananjay6561 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Went through this again end to end, together with keploy/samples-ruby#1, which it depends on. Earlier rounds fixed a lot, but the guide still has blockers:

  1. The Docker replay command is broken. --cid-type isn't a Keploy flag (should be --cmd-type), so the main Docker path fails at the last step.
  2. The recorded-testcase screenshot isn't a real Keploy recording. It shows a hand-made keploy/tests dir with 4 files and a flat mocks.yml. The "setup" screenshot is a docker compose down -v one-liner from a personal path.
  3. The Linux/WSL local setup doesn't work on Linux/WSL. The Postgres role steps assume a macOS/Homebrew install and fail on Ubuntu with || true hiding the error.
  4. The Docker section never shows keploy record; it's all inside a script that prompts for sudo and wipes the DB volume without warning.
  5. The QuickStartFilter.js diff is mostly unrelated reformatting, and the version gate is a Ruby-specific special case.

Also, the expected error bodies in this guide will never show up as written until the error-handler bug in the sample app is fixed (see the sample PR).

Please run every command in this doc exactly as written, on a fresh Ubuntu/WSL machine, before the next push. The --cid-type typo is the kind of thing a single run catches.

Comment thread src/components/QuickStartFilter.js Resolved
Comment thread src/components/QuickStartFilter.js Resolved
- Fix PostgreSQL setup for Ubuntu/WSL: use sudo -u postgres and
  -h localhost flags; remove broken CREATE ROLE and || true
- Fix /health expected response to include database:connected field
- Fix negative test: add author field so published_year type check
  is actually reached; add expected error response
- Remove redundant copy-paste intro in local record section
- Fix aria: replace role=radio+aria-checked with aria-pressed on
  wizard option buttons (no radiogroup/tabIndex scaffolding needed)
- Fix mocks.yml/test-x.yml to mocks.yaml/test-N.yaml in local section
@Nsanjayboruds

Copy link
Copy Markdown
Author

Went through this again end to end, together with keploy/samples-ruby#1, which it depends on. Earlier rounds fixed a lot, but the guide still has blockers:

1. **The Docker replay command is broken.** `--cid-type` isn't a Keploy flag (should be `--cmd-type`), so the main Docker path fails at the last step.

2. **The recorded-testcase screenshot isn't a real Keploy recording.** It shows a hand-made `keploy/tests` dir with 4 files and a flat `mocks.yml`. The "setup" screenshot is a `docker compose down -v` one-liner from a personal path.

3. **The Linux/WSL local setup doesn't work on Linux/WSL.** The Postgres role steps assume a macOS/Homebrew install and fail on Ubuntu with `|| true` hiding the error.

4. The Docker section never shows `keploy record`; it's all inside a script that prompts for sudo and wipes the DB volume without warning.

5. The `QuickStartFilter.js` diff is mostly unrelated reformatting, and the version gate is a Ruby-specific special case.

Also, the expected error bodies in this guide will never show up as written until the error-handler bug in the sample app is fixed (see the sample PR).

Please run every command in this doc exactly as written, on a fresh Ubuntu/WSL machine, before the next push. The --cid-type typo is the kind of thing a single run catches.

Hey @dhananjay6561, addressed all the new feedback:

PostgreSQL setup on Ubuntu/WSL — Replaced the broken psql -U $(whoami) CREATE ROLE ... || true approach with the correct Ubuntu/WSL flow: sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD 'postgres';" followed by createdb -h localhost and psql -h localhost (peer auth workaround). Dropped the || true that was hiding the error.

/health expected response — Updated to include the actual "database":"connected" field that app.rb returns

Negative test — Added "author": "Test Author" so validation actually reaches the published_year type check. Added the expected response {"error":"Published year must be an integer"}

Redundant copy-paste intro — Collapsed the "Lights, Camera, Record!" + "Make some API calls" double paragraph into a single line before "Generate Testcases"

role="radio" / aria-checked — Replaced with aria-pressed on the wizard option buttons. role="radio" needs a role="radiogroup" parent and roving tabIndex keyboard handling; aria-pressed on a plain type="button" works standalone with no extra scaffolding

This branch has not been deployed

No deployments
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.

6 participants