Skip to content

Rufferal's backend (Ruby on Rails) which provisions REST APIs, Authentication including Google and Apple sign on, and other integrations such as 1:1 messaging, payment, and image support

License

Notifications You must be signed in to change notification settings

Ruffrl/rufferal-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rufferal Backend

The Rails (ruby) backend which provisions REST APIs, Authentication including email, Google, and Apple, and other integrations such as 1:1 messaging

project.com

Install

Setup assumes you have a MacOS

Prereqs

  • Homebrew
    • /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  • rbenv
    brew install rbenv
    rbenv init
    # Restart terminal or source your profile
  • Postgresql
    brew install postgresql
    # port: 5432
    brew services start postgresql
    # brew services stop postgresql
    # brew services restart postgresql
  • nginx
    brew install nginx
    # Mine installed here `/opt/homebrew/etc/nginx/nginx.conf`
    # port: 8080
    # You can visit http://localhost:8080/ to confirm installation
    # It should automatically strt
    # brew services start nginx
    # brew services restart nginx

Clone the repository

git clone [email protected]:Ruffrl/rufferal-backend.git
cd rufferal-backend

Check your Ruby version

ruby -v

The ouput should start with something like ruby 3.2.2

If not, install the right ruby version using rbenv (it could take a while):

rbenv install 3.2.2
rbenv local 3.2.2
ruby -v
=> 3.2.2

Install dependencies

Using Bundler

gem install bundler
bundle

Set environment variables

blarg

Add credentials

# This will output a random 32-bytes/256-bit jumble of letters and characters. Hold onto this key.
openssl rand -base64 32

EDITOR='code --wait' rails credentials:edit
# If this errors due to "Adding config/master.key"
# Delete `config/credentials.yml.enc` and rerun command above
# PRIYA - how to overcome this for shared development?

This should open an encypted yml file

Add the following

# Other secrets...

# JWT Secret
jwt_key: (copy and paste random secret from openssl generation above)
# jwt_key: (copy and paste from <secure location for shared development>)

# Google Omniauth
google_client_id: (copy and paste secret here)
# google_client_id: (copy and paste from <secure location for shared development>)
google_client_secret: (copy and paste the generated secret here)
# google_client_secret: (copy and paste from <secure location for shared development>)

Initialize the database

rails db:create db:migrate db:seed

Serve

rails s
# port: 5000

Visit http://localhost:3000/admin/users to see test API

Notes

Annotate

### Add schema information (as comments) to model and fixture files
# rake annotate_models

### Adds the route map to routes.rb
# rake annotate_routes

### Remove schema information from model and fixture files
# rake remove_annotation

Auth routes

rails routes | grep -e sessions -e registrations -e authentications -e passwords -e identity OR rails routes | grep -v /rails

***********************************************************************************************************************************
PREFIX                          VERB            URI PATTERN                                     CONTROLLER#ACTION
***********************************************************************************************************************************
login                           POST            /login(.:format)                                sessions#create
-----------------------------------------------------------------------------------------------------------------------------------
sign_up                         POST            /sign_up(.:format)                              registrations#create
-----------------------------------------------------------------------------------------------------------------------------------
sessions                        GET             /sessions(.:format)                             sessions#index
-----------------------------------------------------------------------------------------------------------------------------------
session                         GET             /sessions/:id(.:format)                         sessions#show
-----------------------------------------------------------------------------------------------------------------------------------
                                DELETE          /sessions/:id(.:format)                         sessions#destroy
-----------------------------------------------------------------------------------------------------------------------------------
edit_password                   GET             /password/edit(.:format)                        passwords#edit
-----------------------------------------------------------------------------------------------------------------------------------
password                        PATCH           /password(.:format)                             passwords#update
-----------------------------------------------------------------------------------------------------------------------------------
                                PUT             /password(.:format)                             passwords#update
-----------------------------------------------------------------------------------------------------------------------------------
authentications_events          GET             /authentications/events(.:format)               authentications/events#index
-----------------------------------------------------------------------------------------------------------------------------------
edit_identity_email             GET             /identity/email/edit(.:format)                  identity/emails#edit
-----------------------------------------------------------------------------------------------------------------------------------
identity_email                  PATCH           /identity/email(.:format)                       identity/emails#update
-----------------------------------------------------------------------------------------------------------------------------------
                                PUT             /identity/email(.:format)                       identity/emails#update
-----------------------------------------------------------------------------------------------------------------------------------
identity_email_verification     GET             /identity/email_verification(.:format)          identity/email_verifications#show
-----------------------------------------------------------------------------------------------------------------------------------
                                POST            /identity/email_verification(.:format)          identity/email_verifications#create
-----------------------------------------------------------------------------------------------------------------------------------
new_identity_password_reset     GET             /identity/password_reset/new(.:format)          identity/password_resets#new
-----------------------------------------------------------------------------------------------------------------------------------
edit_identity_password_reset    GET             /identity/password_reset/edit(.:format)         identity/password_resets#edit
-----------------------------------------------------------------------------------------------------------------------------------
identity_password_reset         PATCH           /identity/password_reset(.:format)              identity/password_resets#update
-----------------------------------------------------------------------------------------------------------------------------------
                                PUT             /identity/password_reset(.:format)              identity/password_resets#update
-----------------------------------------------------------------------------------------------------------------------------------
                                POST            /identity/password_reset(.:format)              identity/password_resets#create
***********************************************************************************************************************************

Other User/Account routes

rails routes | grep profiles OR rails routes | grep -v /rails

***********************************************************************************************************************************
PREFIX                          VERB            URI PATTERN                                     CONTROLLER#ACTION
***********************************************************************************************************************************
profiles                        GET             /profiles(.:format)                             profiles#index
-----------------------------------------------------------------------------------------------------------------------------------
                                POST            /profiles(.:format)                             profiles#create
-----------------------------------------------------------------------------------------------------------------------------------
profile                         GET             /profiles/:id(.:format)                         profiles#show
-----------------------------------------------------------------------------------------------------------------------------------
                                PATCH           /profiles/:id(.:format)                         profiles#update
-----------------------------------------------------------------------------------------------------------------------------------
                                PUT             /profiles/:id(.:format)                         profiles#update
-----------------------------------------------------------------------------------------------------------------------------------
                                DELETE          /profiles/:id(.:format)                         profiles#destroy
***********************************************************************************************************************************

Admin/Health routes

rails routes | grep admin OR rails routes | grep -v /rails

***********************************************************************************************************************************
PREFIX                          VERB            URI PATTERN                                     CONTROLLER#ACTION
***********************************************************************************************************************************
admin_rails_health_check        GET             /admin/up(.:format)                             rails/health#show
-----------------------------------------------------------------------------------------------------------------------------------
admin_users                     GET             /admin/users(.:format)                          admin/users#index
-----------------------------------------------------------------------------------------------------------------------------------
admin_user                      GET             /admin/users/:id(.:format)                      admin/users#show
-----------------------------------------------------------------------------------------------------------------------------------
                                DELETE          /admin/users/:id(.:format)                      admin/users#destroy
***********************************************************************************************************************************

About

Rufferal's backend (Ruby on Rails) which provisions REST APIs, Authentication including Google and Apple sign on, and other integrations such as 1:1 messaging, payment, and image support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published