/audiophile-api

Simple API for basic E-Commerce functionalities

Primary LanguageRuby

Audiophile e-commerce API

This is the API for Audiophile, an e-commerce site. Even though it can be used independently, you can find the UI that consumes this API here

Main features

This API contains the core functionality that a common e-commerce system would need:

  • Products system with categories, toppings and stocks
  • Super basic headless CMS to modify the content and details of each product
  • An Admin namespace to create or edit all of the above
  • OTP authentication via email
  • Checkout flow with purchase carts, sign up/login, shipping address with geolocation and credit/debit card payment with Stripe
  • Basic comms such as payment confirmation or failure emails
  • Orders system to track purchase status after payment

API Docs

You can find the API documentation here

Technologies

  • Ruby
  • Rails
  • PostgreSQL
  • Redis
  • Sidekiq
  • RSpec
  • Docker

Vendors

  • AWS S3 for assets storage
  • AWS Location service for address geocoding
  • SendGrid for Email Comms
  • Stripe for payments
  • Fly.io for hosting of demo app

Installation Instructions

Setup with Docker (recommended)

  1. Install Docker Engine and docker-compose
  2. Create a tmp/ folder 1 level above the root directory of the project
  mkdir ../tmp
  1. Create a .env file based on the existing .env.example file_
  cp .env.example .env
  1. Follow the instructions on the .env file regarding the vendors variables that need to be configured
  2. Run docker-compose in development mode
cd docker/development
docker-compose up --build
  1. Open a new terminal and setup the database
docker-compose run web rails db:setup

Quickstart

Once everything is installed, this is the every day process to start up the environment:

  1. Run docker-compose in development mode
cd docker/development
docker-compose up --build
  1. Open a new terminal and run any possible migrations
docker-compose run web rails db:migrate

Traditional Setup

  1. Install homebrew https://brew.sh/index_es
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Install rbenv (Ruby versions manager) https://github.com/rbenv/rbenv
brew install rbenv ruby-build
  1. Set up rbenv
rbenv init

Follow the printed instructions

  1. Restart your terminal, and install ruby
rbenv install 3.2.2
  1. Install postgresql
brew install postgres
  1. Start postgresql as a service
brew services start postgresql
  1. Install ruby dependencies
bundle install
  1. Create a .env file based on the existing .env.example file_
  cp .env.example .env
  1. Follow the instructions on the .env file regarding the vendor variables that need to be configured

  2. Set up the database

rails db:setup
  1. Install redis
brew install redis
  1. Start redis as a service
brew services start redis
  1. Start the rails server
rails server

Optional: Background Jobs

  1. Run sidekiq on a separate terminal
bundle exec sidekiq
  1. Go to http://localhost:3001/eng/sidekiq to monitor the jobs. Use the values defined in the ADMIN_HTTP_USERNAME and ADMIN_HTTP_PASSWORD env variables to login.

Quickstart

Once everything is installed, this is the every day process to start up the environment:

  1. Start the postgres and redis services (this is probably that is done automatically when turning on the computer)
brew services start postgresql
brew services start redis
  1. cd to the project folder.

  2. Run any new db migration

rails db:migrate
  1. Run the rails server
rails server