Skip to content

klikaba/rails-api-template

Repository files navigation

Rails Api Template

This template provides starting point for Rails API backend, following Klika quality guidelines, with implemented authentication following OAuth2 standard.

Setup

Dependencies

  • Ruby version defined in .ruby-version
  • Postgres database
$ bin/setup

this script will:

  • install gem dependencies
  • setup overcommit
  • create .env.local
  • create database and load default schema

Configuration

To get basic idea about configuration approach read 12factor.

.env configuration file has to include all basic configuration required for this project to work. For any environment specific configuration use .env.#{Rails.env} specific configuration file. For local specific configuration use .env.local

Getting started

Use Klika quality guidelines for general development references.

Ruby styleguides

This project is following ruby style guide

New feature

Use GitFlow development workflow with controller tests and documentation included.

Pull request quality gates

  • no conflicts with target branch
  • pass CircleCI tests
  • code review approval
  • feature followed by integration tests with dox annotations
  • documentation generated from test before

Generate documentation

Write request specs for new endpoints and include defined dox description files. See dox for usage details and specs/docs/v1/descriptions for examples. Run $ rake api:doc:html to generate documentation. Generated html documentation will be saved in 'public/api/docs/v1/index.html' and publicly available on api domain. Eg. https://klika-rails-api.herokuapp.com/api/docs/v1/index.html

$ rake api:doc:html

Tools

Authentication using OAuth2 standard

Authentication is implemented using Doorkeeper and JWT token standard implementing both password and code grant flows. More datails about OAuth2 Standard.

Quality gates

This project will run static code analyser on every commit and full test suite on git push.

Static code analyser

This template us using Rubocop for static code analysis. All rubocop offenses are automatically tracked and prevented on every commit. This feature is handled by Overcommit git hook manager.

Testing

We are using RSpec testing framework.

Automatic API Documentation

We are generating API documentation from request specs with Dox

Continuous Integration

Setup for Circle CI

Maintainers

About

A template for starting rails API projects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages