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.
- 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
- 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
- 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
- Run
bundle install
to install dependencies - Create
config/database.yml
by copyingconfig/database.example.yml
- Create
config/secrets.yml
by copyingconfig/secrets.example.yml
- Run
bin/rails db:reset
to create, load and seed db - Create .env file based on .env.example
- Sign up for a Stripe account
- Put Stripe (test) keys into appropriate .env vars
- Run
bin/rails s -b 0.0.0.0
on vagrant /bin/rails server
on host machine to start the server - Navigate to
http://localhost:3000/
Use Credit Card # 4111 1111 1111 1111 for testing success scenarios.
More information in their docs: https://stripe.com/docs/testing#cards
- Rails 6.1 Rails Guide
- Bootstrap 5
- PostgreSQL 9.x
- Stripe