Skip to content

This project is collection of config / gems / tools for quickstart developing Rails API follow JSON API spec

Notifications You must be signed in to change notification settings

pandabamboo90/rails-json-api

Repository files navigation

rails-json-api

Introduction

This project is collection of config / gems / tools for quickstart developing Rails API follow JSON API spec. No test framework is included, you should add it by yourself, your choice ! :)

Table of Contents


System requirements

  • rbenv latest
  • ruby >= 3.0.1
  • postgres latest
  • docker latest (If you want to run with Docker)

Installation

Without Docker

  1. Clone the repo
    git clone https://github.com/pandabamboo90/rails-json-api
    
  2. Run setup to prepare database
    cd rails-json-api
    bin/setup
  3. Start the server
    rails s

Using Docker

  1. Clone the repo
    git clone https://github.com/pandabamboo90/rails-json-api
    
  2. Open entrypoint.sh and change CONTAINER_TYPE value to "SETUP", this will help you setup DB/migrations/seed data and run the project 1st time
    # entrypoint.sh
    CONTAINER_TYPE=SETUP
  3. Build the image and run container
    docker-compose build
    docker-compose up
  4. At this point your project is ready and should be up & running. Open entrypoint.sh and change CONTAINER_TYPE value to "WEB" for later to speed up the boot time
    # entrypoint.sh
    CONTAINER_TYPE=WEB

In-use gems

Authentication

Gem Info
devise A flexible authentication solution for Rails based on Warden
devise_token_auth Simple, multi-client and secure token-based authentication for Rails.

Authorization

Gem Info
rolify Very simple Roles library without any authorization enforcement supporting scope on resource object
action_policy Authorization framework for Ruby and Rails applications. Composable, extensible and performant

Uploading file

Gem Info
shrine Toolkit for handling file uploads in Ruby.

Soft-delete models

Gem Info
discard A simple ActiveRecord mixin to add conventions for flagging records as discarded.

JSON API serializer / deserializer

Gem Info
oj A fast JSON parser and Object marshaller as a Ruby gem.
jsonapi-serializer A fast JSON:API serializer for Ruby Objects.
jsonapi.rb transform a JSONAPI document into a flat dictionary that can be used to update an ActiveRecord::Base model.

Log

Gem Info
rails_semantic_logger Scalable, next generation enterprise logging for Ruby.

Active Record Validations

Gem Info
validates_overlap Ideal solution for booking applications where you want to make sure, that one place can be booked only once in specific time period.
validates_timeliness Date and time validation plugin for ActiveModel and Rails.

Mailer & test / sending mails in local env

Gem Info
letter_opener Preview mail in the browser instead of sending.

Automatically eager loading associations !

Gem Info
goldiloader Wouldn't it be awesome if ActiveRecord didn't make you think about eager loading and it just did the "right" thing by default? With Goldiloader it can!

Fake data & Seed data management

Gem Info
faker A library for generating fake data such as names, addresses, and phone numbers.
seedbank Seedbank allows you to structure your Rails seed data instead of having it all dumped into one large file.

Automation deployment & Database cloning

Gem Info
capistrano A deployment automation tool built on Ruby, Rake, and SSH.
capistrano-db-tasks Add database AND assets tasks to capistrano to a Rails project. It only works with capistrano 3

Code quality

Gem Info
standard Ruby style guide, linter, and formatter

Contribution


Semantic Versioning

Ransack attempts to follow semantic versioning in the format of x.y.z, where:

x stands for a major version (new features that are not backward-compatible).

y stands for a minor version (new features that are backward-compatible).

z stands for a patch (bug fixes).

In other words: Major.Minor.Patch.


License

Feel free to use this template for your next JSON-API project. Good luck, have fun !

About

This project is collection of config / gems / tools for quickstart developing Rails API follow JSON API spec

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published