Skip to content

An e-commerce Rails app built for learning Rails through example

Notifications You must be signed in to change notification settings

GraceWXT/jungle-rails

Repository files navigation

Jungle

Project Description

A mini e-commerce application built with Rails 6.1 for the purpose of learning Rails by example.

Many features of this project were already in place. The new features and bug fixes I implemented are listed in the What's New section.

Product Screenshots

  • home page "home page"
  • order detail "order detail"
  • admin dashboard "admin dashboard"
  • admin >> categories "admin categories"

What's New

New Features

  • About Us
    • A page that contains static content that describes the store
    • Update the link in the app footer
  • Admin Dashboard Page
    • Display the general stats (product and category count) about the store
    • Link to the product admin list/index pages when displaying the counts
  • Order Details Page
    • The order page contains items, their image, name, description, quantities and line item totals
    • The final amount for the order is displayed
    • The email that was used to place the order is displayed
    • A visitor can place an order (i.e. without logging in and therefore without an e-mail address)
  • Sold out badge:
    • To be displayed when the product is not in stock when a product has 0 quantity.
  • Admin Categories:
    • Admins can list and create new categories
    • Admins can add new products using the new category
    • Restful routes (resources) should be used, and there should be no extra, unused routes exposed
  • User Authentication
    • User authentication is implemented with bcrypt and has_secure_password in the User model
    • A vistor can go to the registration page from any page in order to create an account
    • A visitor can sign up for an account with e-mail, password, first name and last name
    • A visitor cannot sign up with an existing e-mail address (uniqueness validation)
    • A visitor can sign in using the correct e-mail and password
    • A visitor can log out from any page

Bug Fixes

  • Admin Security
    • Users must enter HTTP auth login/password to access admin functionality
  • Checking Out with Empty Cart
    • When the cart is empty and the user goes to the carts#show page, display a friendly message about how it is empty and link to the home page
  • Money formatting
    • Fix any inconsistent money formatting in the app

Tests

  • Rspec
    • Product model validation
    • User model validation
  • Cypress
    • Users can visit the home page which renders a list of all products
    • Users can navigate from the home page to the product detail page by clicking on a product
    • Users can click the 'Add to Cart' button for a product on the home page and in doing so their cart increases by one

Setup

  1. Run bundle install to install dependencies
  2. Create config/database.yml by copying config/database.example.yml
  3. Create config/secrets.yml by copying config/secrets.example.yml
  4. Run bin/rails db:reset to create, load and seed db
  5. Create .env file based on .env.example
  6. Sign up for a Stripe account
  7. Put Stripe (test) keys into appropriate .env vars
  8. Run bin/rails s -b 0.0.0.0 on vagrant / bin/rails server on host machine to start the server
  9. Navigate to http://localhost:3000/

Stripe Testing

Use Credit Card # 4111 1111 1111 1111 for testing success scenarios.

More information in their docs: https://stripe.com/docs/testing#cards

Dependencies

  • Rails 6.1 Rails Guide
  • Bootstrap 5
  • PostgreSQL 9.x
  • Stripe

About

An e-commerce Rails app built for learning Rails through example

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published