A simple referral system built on Rails
User can share there referral link or send a referral email and track count of total successful referals and there names.
- Ruby on Rails
- Ruby
- Postgres server
Clone this repo and enter the directory.
git clone git@github.com:eapenzacharias/rails-referrals.git && cd rails-referrals
Run the following command to install all the dependencies.
bundle install
Run the following command to start the server, then go to http://localhost:3000
rails db:create # create database
rails db:migrate # migrate tables
rails s # to start the server
URL without referral: http://domain.com/api/auth
URL with referral: http://website.com/api/auth/?referrer={User ID of the referrer}
Method: POST
Request example:
{
"email": "user@test.com",
"password": "password",
"password_confirmation": "password",
"name": "User"
}
URL: http://domain.com/api/auth/sign_in
Method: POST
Request example:
{
"email": "user@test.com",
"password": "password"
}
"access-token": "wwwww",
"token-type": "Bearer",
"client": "xxxxx",
"expiry": "yyyyy",
"uid": "zzzzz"
URL: http://domain.com/api/auth/sign_out
Method: DELETE
URL: http://domain.com/api/referrals
Method: GET
URL: http://domain.com/api/referred_by
Method: GET
URL: http://domain.com/api/send_invite
Method: POST
Request example:
{
"email": "name@domain.com"
}
👤 Eapen Zacharias
- GitHub: @eapenzacharias
- Twitter: @eapenzac
- LinkedIn: eapenzac
Give a ⭐️ if you like this project!