Skip to content

fs/rails-base-api

Repository files navigation

Skeleton for new Rails 5 application for REST API

Build Status

This simple application includes Ruby/Rails technology which we use at Flatstack for new REST API projects. Application currently based on Rails 5 stable branch and Ruby 2.5.1

What's included

Application gems:

Development gems

  • brakeman - static analysis security vulnerability scanner
  • bullet - kill n+1 queries and unused eager loading
  • bundler-audit - patch-level verification for gems
  • dotenv - load environment variables from .env
  • letter_opener - preview E-Mails in the browser instead of sending
  • rails-erd - generate a diagram based on application's AR models
  • seedbank - seeds on steroids

Testing gems

Non standard initializes

  • active_model_serializer.rb - setup serializers for REST API
  • bullet.rb - setup Bullet to catch up N+1
  • cors.rb - setup whitelist of domains to allow cross-origin resource sharing
  • health_check.rb - setup Health Check endpoint
  • rollbar.rb - setup Rollbar

Scripts

  • bin/setup - build Docker image and prepare DB
  • bin/server - to run server locally
  • bin/ci - runs RSpec tests and quality tools
  • bin/doc - generates API documentation

Quick start

Clone application as new project with original repository named "rails-base-api"

git clone git:https://github.com/fs/rails-base-api.git --origin rails-base-api [MY-NEW-PROJECT]

Create your new repo on GitHub and push master into it. Make sure master branch is tracking origin repo.

git remote add origin [email protected]:[MY-GITHUB-ACCOUNT]/[MY-NEW-PROJECT].git
git push -u origin master

Run setup script

bin/setup

Make sure all test are green

bin/ci

Do not forget to update this file!

mv doc/README_TEMPLATE.md README.md
# update README.md
git commit -am "Update README.md"