{"id":24532923,"url":"https://github.com/tejasbubane/book_my_ticket","last_synced_at":"2025-08-19T21:22:59.455Z","repository":{"id":271201374,"uuid":"912529692","full_name":"tejasbubane/book_my_ticket","owner":"tejasbubane","description":"Ticket booking service using Ruby on Rails","archived":false,"fork":false,"pushed_at":"2025-04-04T21:54:13.000Z","size":169,"stargazers_count":0,"open_issues_count":10,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T08:09:43.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tejasbubane.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-01-05T20:31:56.000Z","updated_at":"2025-01-08T07:21:36.000Z","dependencies_parsed_at":"2025-06-14T08:09:45.848Z","dependency_job_id":"2ee2dcec-b9b3-4c86-a2f0-19f5a1c05e40","html_url":"https://github.com/tejasbubane/book_my_ticket","commit_stats":null,"previous_names":["tejasbubane/book_my_ticket"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tejasbubane/book_my_ticket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tejasbubane%2Fbook_my_ticket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tejasbubane%2Fbook_my_ticket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tejasbubane%2Fbook_my_ticket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tejasbubane%2Fbook_my_ticket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tejasbubane","download_url":"https://codeload.github.com/tejasbubane/book_my_ticket/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tejasbubane%2Fbook_my_ticket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271224171,"owners_count":24721825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-19T02:00:09.176Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T10:18:58.233Z","updated_at":"2025-08-19T21:22:59.420Z","avatar_url":"https://github.com/tejasbubane.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# README\n\n![Tests](https://github.com/tejasbubane/book_my_ticket/actions/workflows/ci.yml/badge.svg)\n\nSimple event ticket booking system built with Ruby on Rails.\n\n* Ruby version: 3.4.1\n\n* Database creation: `bundle exec rails db:create`\n\n* System requirements: Postgresql database running\n\n* Database initialization: `bundle exec rails db:migrate`\n\n* How to run the test suite: `bundle exec rspec`\n\n# Core Functionality\n\n* Registration, login, logout\n* Create events, book tickets\n* View list of all events, my events, my bookings\n\n# System design and challenges\n\n### Concurrency Handling:\n\nHandles case when multiple users try to book more than available tickets. Multiple levels of checks added in increasing level of complexity:\n\n* **Code level checks:** Limit ticket quantity select dropdown numbers to only available tickets. Check in TicketBookingService to skip if booking not possible.\n\n* **Validation:** ActiveRecord validation to check if sold tickets does not exceed total available tickets. This comes in handy in cases where user has stale browser page open.\n\n* **[Postgres Level Constraint](https://www.postgresql.org/docs/current/ddl-constraints.html):** Add a [DB-level check constraint](https://api.rubyonrails.org/v8.0.1/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_check_constraint) when multiple users book in parallel.\n\n* **Row-level lock:** Use [Rails pessimistic locking](https://api.rubyonrails.org/classes/ActiveRecord/Locking/Pessimistic.html) when updating sold ticket count.\n\n### Caching:\n\n* **Fragment Caching:** Use Rails' inbuilt [fragment caching](https://guides.rubyonrails.org/caching_with_rails.html#fragment-caching) for caching event details partials.\n\n# Software design\n\n* **Error handling with monads:** [TicketBookingService](app/services/ticket_booking_service.rb) uses [dry-monads](https://dry-rb.org/gems/dry-monads/1.6/result/) to elegantly handle `Success` and `Failure` cases.\n\n* **Query Object:** [EventsQuery](app/queries/events_query.rb) encapsulates code for fetching created, booked and all events.\n\n* **Custom matcher:** Making tests more readable with [this RSpec custom matcher](spec/support/event_matcher.rb) for checking if data element with event ID exists on the page.\n\n* **Authentication:** Not using [new Rails 8 authentication generator](https://www.bigbinary.com/blog/rails-8-introduces-a-basic-authentication-generator). Hand-rolled authentication using Rails' inbuilt `has_secure_password`.\n\n* **Test Coverage:** Maintain test coverage more than `90%`. Checked using [Simplecov](https://github.com/simplecov-ruby/simplecov).\n\n# Out of scope\n\nFollowing limitations were assumed and some items were considered out of scope:\n\n* Tickets do not have names and are transferrable.\n* Simple one-click ticket booking flow. No payment step - hence no pending status field on tickets.\n* Instead of listing all tickets, show booked shows with number of tickets booked.\n* No multi-language (i18n).\n* No admin role to create events - all users can create events.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftejasbubane%2Fbook_my_ticket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftejasbubane%2Fbook_my_ticket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftejasbubane%2Fbook_my_ticket/lists"}