Skip to content

E-commerce app using Rails 7, PostgreSQL, Hotwire (Turbo + Stimulus), Tailwind CSS, Supabase, Cloudinary, Stripe, and Render

License

Notifications You must be signed in to change notification settings

binos30/shopline

Folders and files

NameName
Last commit message
Last commit date
Mar 9, 2025
Jul 20, 2024
Mar 1, 2025
Sep 21, 2024
Mar 10, 2025
Aug 13, 2024
Mar 10, 2025
Jan 26, 2025
Jul 9, 2024
Jul 21, 2024
Jan 6, 2024
Aug 13, 2024
Jan 26, 2025
Jan 6, 2024
Jan 6, 2024
Jan 6, 2024
Aug 13, 2024
Jul 11, 2024
Jan 6, 2024
Dec 21, 2024
Sep 21, 2024
Jul 25, 2024
Jul 28, 2024
May 25, 2024
Jul 28, 2024
Sep 21, 2024
Jul 30, 2024
Jul 28, 2024
Sep 21, 2024
Sep 21, 2024
Dec 21, 2024
Jan 5, 2025
Jul 28, 2024
Jun 25, 2024
Mar 9, 2025
Jan 6, 2024
Jan 6, 2024
Jul 28, 2024
Sep 26, 2024
Sep 26, 2024

Repository files navigation

Shopline

Created Badge Updated Badge CI/CD Dependabot Status

E-commerce app. Shop online with Shopline. You shop, we ship!

Homepage Dashboard Dashboard-Dark Orders Orders-Dark

Setup

Prerequisites

Create .env file at the root of the project directory. Copy the content of .env.template.erb to .env then update the username and password based on your database credentials. Get STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET from your Stripe account

Install dependencies and setup database

bin/setup

Start local web server

bin/dev

Go to http://localhost:3000

Use Stripe CLI to simulate Stripe events in your local environment or learn more about Webhooks

stripe listen --forward-to localhost:3000/stripe_webhooks

Testing Payments

To test Stripe payments, use the following test card details:

  • Card Number: 4242 4242 4242 4242
  • Expiration: Any future date
  • CVC: Any 3-digit number

Set up a production Stripe webhook

  1. Go to the Stripe Dashboard and create a new webhook for your production environment.
  2. Set the endpoint URL to your production route (e.g., https://yourdomain.com/stripe_webhooks).
  3. Select the events you want to listen for (e.g., checkout.session.completed, customer.created, customer.deleted).

GitHub Actions, Linting and Security Auditing

GitHub actions are setup to lint, test, and deploy the application.

You can also run these actions locally before pushing to see if your run is likely to fail. See the following gems / commands for more info.

Testing

Setup test database

bin/rails db:test:prepare

Default: Run all spec files (i.e., those matching spec/**/*_spec.rb)

bin/rspec

or with --fail-fast option to stop running the test suite on the first failed test. You may add a parameter to tell RSpec to stop running the test suite after N failed tests, for example: --fail-fast=3

bin/rspec --fail-fast

Run all spec files in a single directory (recursively)

bin/rspec spec/models

Run a single spec file

bin/rspec spec/models/product_spec.rb

Run a single example from a spec file (by line number)

bin/rspec spec/models/product_spec.rb:6

Use the plain-English descriptions to generate a report of where the application conforms to (or fails to meet) the spec

bin/rspec --format documentation
bin/rspec --format documentation spec/models/product_spec.rb

See all options for running specs

bin/rspec --help

Code Coverage

SimpleCov is a code coverage analysis tool for Ruby. It uses Ruby's built-in Coverage library to gather code coverage data, but makes processing its results much easier by providing a clean API to filter, group, merge, format, and display those results, giving you a complete code coverage suite that can be set up with just a couple lines of code. SimpleCov/Coverage track covered ruby code, gathering coverage for common templating solutions like erb, slim and haml is not supported.

After running your tests, open coverage/index.html in the browser of your choice. For example, in a Mac Terminal, run the following command from your application's root directory:

open coverage/index.html

in a Debian/Ubuntu Terminal,

xdg-open coverage/index.html

Note: This guide can help if you're unsure which command your particular operating system requires.