Skip to content

Latest commit

 

History

History
306 lines (203 loc) · 13.5 KB

backend.md

File metadata and controls

306 lines (203 loc) · 13.5 KB

Back-end

  1. Technologies
  2. Preferred Gems
  3. Coding Conventions
  4. .gitignore
  5. Best Practices
  6. Load Balancing
  7. Load Testing
  8. Useful Links
  9. Recommended Books

Technologies

  • Ruby 2.7.x (latest stable)
  • Ruby on Rails 5.x (latest stable)
  • Ruby environment management: rvm

Development OS

We don’t use Windows as OS for development machines. We use latest macOS or Ubuntu/Debian (long-term support releases are preferred).

IDE

HTTP Server

  • Use latest stable nginx

Database Server

Cloud Hosting Platform

Preferred Gems

Authentication

Authorization

  • pundit - Minimal authorization through OO design and pure Ruby classes.
  • rolify - Role management library with resource scoping.

Active Record

  • AASM - State machines for Ruby classes.
  • active_record_union - UNIONs in ActiveRecord! Adds proper union and union_all methods to ActiveRecord::Relation.
  • PaperTrail - PaperTrail lets you track changes to your models' data. It's good for auditing or versioning.
  • globalize - Rails I18n de-facto standard library for ActiveRecord model/data translation.

Abstraction

  • interactor - Interactor provides a common interface for performing complex user interactions.
  • wisper - A micro library providing objects with Publish-Subscribe capabilities.

Pagination

  • Pagy - Pagy is the ultimate pagination gem that outperforms the others in each and every benchmark and comparison.
  • Kaminari - A Scope & Engine based, clean, powerful, customizable and sophisticated paginator for modern web app frameworks and ORMs.

API

Email

  • letter_opener - Preview mail in the browser instead of sending.
  • email_address - Provides a ruby language library for working with email addresses.

Caching

  • Dalli - A high performance pure Ruby client for accessing memcached servers.

Decorators

  • Draper - Draper adds an object-oriented layer of presentation logic to your Rails application.

File Uploading

  • shrine - File Attachment toolkit for Ruby applications.
    • image_processing - High-level image processing helper methods with libvips and ImageMagick/GraphicsMagick.
    • shrine-url - Custom URL storage for Shrine.

HTTP Clients

  • Faraday - HTTP client lib that provides a common interface over many adapters (such as Net::HTTP) and embraces the concept of Rack middleware when processing the request/response cycle.

Searching

  • elasticsearch-rails
  • searchkick - Intelligent search made easy with Rails and Elasticsearch.
  • pg_search - pg_search builds ActiveRecord named scopes that take advantage of PostgreSQL's full text search.

Scheduled/Recurrence Jobs

  • Whenever - whenever is a Ruby gem that provides a clear syntax for writing and deploying cron jobs.
  • Sidekiq - Simple, efficient background processing for Ruby.

Environment Variables

  • dotenv - For setting shell environment variables.

Admin Panel

  • ActiveAdmin - ActiveAdmin is a administration framework for Ruby on Rails applications.

Logging

  • Ahoy - Ahoy provides a solid foundation to track visits and events in Ruby, JavaScript, and native apps.
  • Lograge - An attempt to tame Rails' default policy to log everything.

Debug

  • pry-rails - Avoid repeating yourself, use pry-rails instead of copying the initializer to every rails project. This is a small gem which causes rails console to open pry. It therefore depends on pry.
  • awesome_print - Awesome Print is a Ruby library that pretty prints Ruby objects in full color exposing their internal structure with proper indentation.

Data Visualization

  • RailsRoady - UML diagram generation on models and controllers.

Database Tools

  • lol_dba - Small package of rake tasks that scan your application models and displays a list of columns that probably should be indexed.

Code Analysis and Metrics

  • RuboCop - Rubocop is a Ruby static code analyzer.
  • Reek - Code smell detector for Ruby.
  • rails_best_practices - Code metric tool for Rails projects.
  • Fasterer - Make your Rubies go faster with this command line tool highly inspired by fast-ruby and Sferik's talk at Baruco Conf.
  • Rubycritic - A Ruby code quality reporter.

Testing

Security

  • brakeman - Brakeman is a static analysis tool which checks Ruby on Rails applications for security vulnerabilities.
  • bundler-audit - bundler-audit is a patch-level verification tool for Bundler which checks for vulnerable versions of gems and insecure gem sources.

Production

Error Handling

Mobile Development

  • rpush
  • venice - Venice is a simple gem for verifying Apple In-App Purchase receipts, and retrieving the information associated with receipt data.

Other

Coding Conventions

Best Practices

.gitignore

Add the following lines to default Rails-generated .gitignore file:

.DS_Store
database.yml
secrets.yml
.idea
coverage/
.env.development.local
.env.test.local
.env.production.local

Best practices

Databases

  • Use ActiveRecord ORM (scopes, enums, where with conditions, order etc) instead of raw SQL queries
  • You may want to keep your schema up-to-date with Rails ERD

Security

  • Avoid common security problems following Ruby on Rails Security Guide
  • Never store production data (logins, passwords etc) in source code repository
  • Keep config/database.yml and config/secrets.yml outside of the source code repository. Use shell environment variables instead. More info here

Load Testing

  • We use Apache JMeter in strong collaboration with our QA Department.

Load Balancing

Useful Links

Recommended Books