Git Product home page Git Product logo

tradies's Introduction

Tradies

Welcome to my Marketplace or CtoC ecommerce application! Tradies is where people go to buy and sell items! I originally built to help friends buy and sell items locally with simple user interface and to learn building a website from scratch. This was my first scalable, full-stack RoR application.

alt text

Tech Stack

Features

The app requires authentication to access. Authentication is executed with email verification (emails sent by SendGrid) and mailers.

Asynchronous/Background Processing All the mailing are handled by queue implemented in Redis Server(Sidekiq sits on top of it) and de-queued consecutively. There is definitely a bottleneck which will be discussed later.

Upon login, you can search using the search bar at the top:

def beautiful_search_url
  # check this function in the link above
end
  • in my Post.rb, I built this function to merge attributes into one for search query.
def search_data
  attributes.except(:state, :content).merge(
    category_titles: categories.map(&:title)
  )
end

Messaging

  • Users can message between each other.
  • Users will be notified via emails that they received messages. alt text

WePay payment

  • Used WePay API to handle transactions
# creates a checkout object using WePay API for this user
...
def create_checkout(redirect_uri)
  price = self.price
  app_fee = tradies_app_fee(price)
  params = {
    :account_id => self.user_wepay_account_id,
    :short_description => "item sold by #{self.user_name}",
    :type => :goods,
    # :auto_release => false,
    :currency => 'USD',
    :amount => price,
    :fee => {
        :app_fee => app_fee,
        :fee_payer => 'payee'
    },
    :hosted_checkout => {
        :mode  => 'iframe',
        :redirect_uri => redirect_uri
    }
  }
  ...
...

How my backend works

My database schema design alt text

Testing

  • Used assertion tests and fake users.
  • If I were to re-do this project, I would've used more unit tests and make them more reusable between pages.

Scalability

  1. Bottleneck:
  • With my current implementation, whenever the web and app servers exceeded their memory and RAM limits, Heroku automatically adds more resources to my servers or increasing Dyno size. However, this kind of approach or vertical scaling is not a good solution if this site is experiencing an exponential growth because it is 1) not cost-efficient and 2) will eventually run out of resources.

Solution:

  • Horizontal Scaling: Instead of adding more resources, add additional servers to handle traffic. Heroku has this feature like adding more dynos at the same or smaller sizes. If I were not to use Heroku, I would have to use load balancers and handle traffic by delivering request to the server that is not currently busy (called High Availability LB).
  1. Bottleneck:
  • My implementation for background processing w/ Redis server is that I am currently using queue to handle sending emails. There exists a single point of failure where it just stops working. In order to prevent this, you can add LB or just implement like the solution above.

Conclusion

If I do this project again, I will definitely build better automated tests to find any bugs that I would encounter. I think I did not use my time effectively during development. Also, I will definitely have the features that I want to implement written down and create a plan before dive into coding. Since this was my first time building an application in such scale, I did not have a good plan but had a determination and perseverance to complete. Definitely, I sometimes felt like I want to give up but I pushed myself to finish this project. I have learned a lot from this project which include but not limited to web architecture, scalability, and building something from the scratch. I forgot to mention this but don't try to do everything by yourself:)

Follow me on Twitter

MIT License

tradies's People

Contributors

mr-perfection avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.