Skip to content

TrailBuddies/api

Repository files navigation

trailbuddies logo

TrailBuddies (api)

https://trailbuddies.club

Find friends to hike with!

⚠️ This project is under development. If you want to help please read this ⚠️


Maintenance Website GitHub commit activity GitHub last commit GitHub Workflow Status GitHub Workflow Status

Code Climate maintainability Code Climate coverage Code Climate technical debt

GitHub

Libraries.io dependency status for GitHub repo Snyk Vulnerabilities for GitHub Repo

Setup

Primary Dependencies

Tool Version Help
Ruby on Rails Rails 7.0.1 Installation guide
RBEnv rbenv 1.2.0 Installation guide
Ruby ruby 3.1.0p0 (2021-12-25 revision fb4df44d16) Install via RBEnv
PostgreSQL postgres (PostgreSQL) 14.5 Installation guide
ImageMagick ImageMagick 7.1.0-45 Q16-HDRI x86_64 20319 Installation guide
TomTom API 1 n/a
Cloudinary API n/a n/a

Secondary (Ruby) Dependencies

❗ These are all defined in Gemfile

Package Version Help Reason
net-smtp '~> 0.3.1' Github repo 🤷
rails '~> 7.0.1', '>= 7.0.0' Rails Guides pretty obvious, right?
pg '~> 1.1' Docs Allows PostgreSQL Active Record intergration
puma '~> 5.0' Docs 🤷
bcrypt '~> 3.1.7' Github repo Hash and compare password digests for users
bootsnap '>= 1.4.4' Github repo 🤷
byebug '~> 11.1.3' Rubydoc 🤷
listen '~> 3.3' Rubydoc 🤷
spring '~> 4.0.0' Rubydoc 🤷
rails-erd '~> 1.6.0' RubyDoc Generates /docs/ERD.png. (Entity Relationship Diagram)
simplecov '~> 0.21.2' GitHub repo Generates coverage reports (/coverage/**/*)
simplecov_json_formatter '~> 0.1.2' GitHub repo JSON formatter for simplecov
tzinfo-data '~> 1.2021.5' Rubydoc 🤷
jwt '~> 2.3' Docs (github) Create, sign, and validate Json Web Tokens
rack-cors '~> 1.1.1' Rubydoc Something to do with CORS I think
rmagick '~> 4.2.4' Rubydoc To edit images before storing them with Cloudinary
cloudinary '~> 1.22' Docs Use Cloudinary for Active Record attachments
httparty '~> 0.20' Rubydoc Send HTTP requests to the TomTom API

Environment Variables

Name Description Required Default
DEV_API_DB_USER Development PostgreSQL user that can access all necessary databases nil
DEV_API_DB_PASSWORD The development password for the above user nil
DEV_API_DB_HOST The development PostgreSQL daemon host address localhost
DEV_API_DB_PORT Production PostgreSQL connection port 5432
PROD_API_DB_USER Production PostgreSQL user that can access all necessary databases nil
PROD_API_DB_PASSWORD The production password for the above user nil
PROD_API_DB_HOST The production PostgreSQL daemon host address localhost
PROD_API_DB_PORT Production PostgreSQL connection port 5432
EMAIL An email address for the seed user (created with rails db:seed) nil
PASSWORD An unhashed (plain text) password for the seed user (above) nil
CLOUDINARY_SECRET A Cloudinary API secret. Will be used to store images nil
TOMTOM_API_KEY A TomTom maps API key. Will be used te generate map images nil
SMTP_USERNAME A valid Sendinblue SMTP login nil
SMTP_PASSWORD A valid Sendinblue SMTP key nil

Git Ignored Files

File Description
config/master.key The Rails credentials master key
config/rsa/*.pem The RSA keypair generated with bin/keygen
coverage/ Test coverage reports

RSA Keypair

You will need to generate a private/public keypair. On linux the commands would be: (in the project root)

$ rm -rf config/rsa/*.pem
$ mkdir -p config/rsa
$ ssh-keygen -o -f config/rsa/key -N $PASSPHRASE -t rsa -b 2048 -m pem
$ mv config/rsa/key config/rsa/private.pem
$ ssh-keygen -f config/rsa/key.pub -e -m pem > config/rsa/public.pem
$ rm config/rsa/key.pub

❗ These commands are saved in the bin/keygen file

Useful Information

Location image resolution

width: '1024',
height: '336',

No Fixtures for Token Model?

That's right. There are no fixtures for the Token model. No sample data is given because each token is generated with a unique passphrase. If I put a token generated with passphrase foo in the fixtures file, it will not be able to be decoded in another instance of the project running with a passphrase of bar.

You cannot decode a JWT if you do not have the right passphrase