Awesome Open Source
Awesome Open Source

Niklick

Rails Versioned API solution template for hipsters!

  • Version 3.1.0

Table of Contents

Prerequisites

Project Setup

  • For production, you need to replace the asterisk with the URL of your client-side application in ./config/initializers/cors.rb file.
  1. Clone or download this repo
  2. Run bundle install
  3. Run rake db:create
  4. Run bin/rails db:migrate RAILS_ENV=development
  5. Run bin/rails db:seed RAILS_ENV=development
  6. Run foreman start -f Procfile.dev
  7. Visit --> http://localhost:5000/. That's it!.

GraphQL API playground

Tools

  • Run rubocop for Ruby lint.
  • Run rubocop -a for fixed some issues automatically.
  • Run reek . for analyzing code.
  • Run brakeman for static analysis and for security vulnerabilities.
  • Run rails_best_practices . in root app directory. Helps to find unused methods, missing indexes into database tables and many other things.

Annotate (aka AnnotateModels) usage

To annotate all your models, tests, fixtures, and factories:

cd /path/to/app
annotate

To annotate just your models, tests, and factories:

annotate --exclude fixtures

To annotate just your models:

annotate --exclude tests,fixtures,factories,serializers

To annotate routes.rb:

annotate --routes

To remove model/test/fixture/factory/serializer annotations:

annotate --delete

To remove routes.rb annotations:

annotate --routes --delete

To automatically annotate every time you run db:migrate, either run rails g annotate:install or add Annotate.load_tasks to your Rakefile. See the configuration in Rails section for more info.

Gitlab CI

  • You need configure .gitlab-ci.yml file with your Heroku credentials.

Travis CI

  • You need configure .travis.yml file with your Travis and Heroku credentials.

Pry initializer

Avoid repeating yourself, use pry-rails instead of copying the initializer to every rails project.

  • Run rails console and in Rails console:
  • For showing models --> show-models.
  • For showing routes --> show-routes.

Traceroute

  • Run rake traceroute.

GraphQL Preload gem

Test API with Postman

  • You can find some examples here.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Ruby (311,821
Docker (33,306
Database (9,343
Graphql (8,113
Postgresql (7,445
Ruby On Rails (6,272
Ruby On Rails (6,272
Boilerplate (5,598
Postgres (2,148
Starter Kit (1,394
Starter (1,244
Starter Template (656
Starter Project (365
Postgresql Database (288
Related Projects