Repo Base

This is a Rails application, initially generated using Potassium by Platanus.

Local installation

Assuming you've just cloned the repo, run this script to setup the project in your machine:

$ ./bin/setup

It assumes you have a machine equipped with Ruby, Node.js, Docker and make.

The script will do the following among other things:

  • Install the dependecies
  • Create a docker container for your database
  • Prepare your database
  • Adds heroku remotes

After the app setup is done you can run it with:

$ ./bin/rails server

Make sure that you have set up your environment variables. The necessary environment variables are availables in .env.development, secrets variables which can't be uploaded to GitHub, can be declared in a local file named .env.local.

Continuous Integrations

The project is setup to run tests in CircleCI

You can also run the test locally simulating the production environment using CircleCI's method.

Style Guides

Style guides are enforced through a CircleCI job with reviewdog as a reporter, using per-project dependencies and style configurations. Please note that this reviewdog implementation requires a GitHub user token to comment on pull requests. A token can be generated here, and it should have at least the repo option checked. The included config.yml assumes your CircleCI organization has a context named org-global with the required token under the environment variable REVIEWDOG_GITHUB_API_TOKEN.

The project comes bundled with configuration files available in this repository.

Linting dependencies like rubocop or rubocop-rspec must be locked in your Gemfile. Similarly, packages like eslint or eslint-plugin-vue must be locked in your package.json.

You can add or modify rules by editing the .rubocop.yml, .eslintrc.json or .stylelintrc.json files.

You can (and should) use linter integrations for your text editor of choice, using the project's configuration.

Sending Emails

The emails can be send through the gem send_grid_mailer using the sendgrid delivery method. All the action_mailer configuration can be found at config/mailer.rb, which is loaded only on production environments.

All emails should be sent using background jobs, by default we install sidekiq for that purpuse.

Testing in staging

If you add the EMAIL_RECIPIENTS= environmental variable, the emails will be intercepted and redirected to the email in the variable.

Internal dependencies

Authentication

We are using the great Devise library by PlataformaTec

Administration

This project uses Active Admin which is a Ruby on Rails framework for creating elegant backends for website administration.

File Storage

For managing uploads, this project uses Active Storage.

Rails pattern enforcing types

This projects uses Power-Types to generate Services, Commands, Utils and Values.

API Support

This projects uses Power API. It's a Rails engine that gathers a set of gems and configurations designed to build incredible REST APIs.

Scheduled Tasks

To schedule recurring work at particular times or dates, this project uses Sidekiq Scheduler

Queue System

For managing tasks in the background, this project uses Sidekiq

Seeds

To populate your database with initial data you can add, inside the /db/seeds.rb file, the code to generate only the necessary data to run the application. If you need to generate data with development purposes, you can customize the lib/fake_data_loader.rb module and then to run the rake load_fake_data task from your terminal.

Development

For hot-reloading and fast webpacker compilation you need to run webpack's dev server along with the rails server:

$ ./bin/webpack-dev-server

Running the dev server will also solve problems with the cache not refreshing between changes and provide better error messages if something fails to compile.

For even faster in-place component refreshing (with no page reloads), you can enable Hot Module Reloading in config/webpacker.yml

development:
  dev_server:
    hmr: true