[
  {
    "path": ".gitattributes",
    "content": "backend/bin/* eol=lf\nprehook eol=lf\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "version: 2\nupdates:\n- package-ecosystem: bundler\n  directory: \"/backend\"\n  schedule:\n    interval: daily\n    time: \"20:00\"\n  open-pull-requests-limit: 10\n  ignore:\n  - dependency-name: rails\n    versions:\n    - 6.1.2\n    - 6.1.2.1\n  - dependency-name: puma\n    versions:\n    - 5.2.1\n  - dependency-name: bootsnap\n    versions:\n    - 1.6.0\n- package-ecosystem: npm\n  directory: \"/frontend\"\n  schedule:\n    interval: daily\n    time: \"20:00\"\n  open-pull-requests-limit: 10\n"
  },
  {
    "path": ".github/workflows/backend_test.yml",
    "content": "name: Backend Test\n\non: [push]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    defaults:\n      run:\n        working-directory: ./backend\n    services:\n      postgres:\n        image: postgres:11\n        ports:\n          - 5432:5432\n        env:\n          POSTGRES_USER: postgres\n          POSTGRES_PASSWORD: password\n          POSTGRES_DB: test\n        options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5\n    env:\n      RAILS_ENV: test\n      RAILS_DATABASE_HOST: 127.0.0.1\n      RAILS_DATABASE_USER: postgres\n      RAILS_DATABASE_PASSWORD: password\n    steps:\n      - uses: actions/checkout@v2\n      - uses: ruby/setup-ruby@v1\n        with:\n          ruby-version: 3.3.1\n          bundler-cache: true\n          working-directory: ./backend\n      - name: Migration\n        run: |\n          bundle exec rails db:create\n          bundle exec rake db:schema:load\n      - name: Run rspec\n        run: bundle exec rake test\n"
  },
  {
    "path": ".github/workflows/frontend_test.yml",
    "content": "name: Frontend Test\n\non: [push]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    defaults:\n      run:\n        working-directory: ./frontend\n    steps:\n      - uses: actions/checkout@v2\n      - uses: actions/setup-node@v2\n        with:\n          node-version: \"14\"\n      - name: Install dependencies\n        run: yarn install\n      - name: Check TypeScript compiler works well\n        run: yarn typecheck\n      - name: Run test\n        run: yarn test\n"
  },
  {
    "path": ".gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files for more about ignoring files.\n#\n# If you find yourself ignoring temporary files generated by your text editor\n# or operating system, you probably want to add a global ignore instead:\n#   git config --global core.excludesfile '~/.gitignore_global'\n\n# Ignore bundler config.\n/.bundle\n\n# Ignore all logfiles and tempfiles.\n/log/*\n/tmp/*\n*/tmp/*\n!/log/.keep\n!/tmp/.keep\n\n# Ignore uploaded files in development\n/storage/*\n\n/node_modules\n/yarn-error.log\n\n/public/assets\n.byebug_history\n\n# Ignore master key for decrypting credentials and more.\n/config/master.key\n"
  },
  {
    "path": "README.md",
    "content": "# Rails-React-TypeScript-Docker Example ![backend_test](https://github.com/ohbarye/rails-react-typescript-docker-example/actions/workflows/backend_test.yml/badge.svg) ![frontend_test](https://github.com/ohbarye/rails-react-typescript-docker-example/actions/workflows/frontend_test.yml/badge.svg)\n\n## TL;DR\n\n**Here is an example application with the following modern web technology stacks. With this boilerplate, you can easily start to build your own app.**\n\n- [Ruby](https://www.ruby-lang.org/en/) 3.3.1\n- [Rails](https://rubyonrails.org/) 6.1.4\n- [React.js](https://reactjs.org/) 17.0.1\n- [TypeScript](https://www.typescriptlang.org/) 4.3.5\n- [Docker](https://docs.docker.com/)\n- [PostgreSQL](https://www.postgresql.org/) 11\n- [GitHub Actions](https://github.com/features/actions)\n\n## Usage\n\n```shell\n$ git clone https://github.com/ohbarye/rails-react-typescript-docker-example.git && cd rails-react-typescript-docker-example\n\n# Setup\n$ docker-compose run frontend yarn\n$ docker-compose run backend bin/rails db:create db:migrate\n\n# Start\n$ docker-compose up -d\n\n# Open frontend\n$ open http://localhost:80 # You'll see yaichi page, then click any app\n\n# Check backend API\n$ curl -H 'Host: backend.localhost' http://localhost/greetings/hello\n```\n\n## Motivation\n\nNowadays, I feel like **we need a wide range acknowledgment on web development even if we call ourselves \"backend developer\" or \"frontend developer\".**\n\nAs for my experience, I've been a Rails engineer, I'm but recently working like kinda frontend developer because I spend all of my working time for building an SPA (single page application) built with React + TypeScript.\n\nThe SPA, Of course, has a backend API, Ruby on Rails connecting PostgreSQL in my case. I use Docker Compose for defining and running multi-container Docker applications because it's not much simple to bootstrap all of applications and middlewares.\n\n**Learning each technology itself is not a burden. I rather like learning. But I've thought I'd like to pursue my playground whose tech stacks are virtually same as ones I develop in work.**\n\n## Further Details\n\n### Backend\n\nThe combination, Rails + PostgreSQL + Docker Compose, is just a result I followed [Docker Compose's official instruction](https://docs.docker.com/compose/rails/).\n\n### Frontend\n\nIt consist of very thin webpack settings, TypeScript config, and Jest.\n"
  },
  {
    "path": "backend/.gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files for more about ignoring files.\n#\n# If you find yourself ignoring temporary files generated by your text editor\n# or operating system, you probably want to add a global ignore instead:\n#   git config --global core.excludesfile '~/.gitignore_global'\n\n# Ignore bundler config.\n/.bundle\n\n# Ignore all logfiles and tempfiles.\n/log/*\n/tmp/*\n!/log/.keep\n!/tmp/.keep\n\n# Ignore uploaded files in development\n/storage/*\n\n/node_modules\n/yarn-error.log\n\n/public/assets\n.byebug_history\n\n# Ignore master key for decrypting credentials and more.\n/config/master.key\n"
  },
  {
    "path": "backend/.ruby-version",
    "content": "3.3.1\n"
  },
  {
    "path": "backend/Dockerfile",
    "content": "FROM --platform=linux/amd64 ruby:3.3.1\nRUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs\nRUN mkdir -p /myapp/backend\nWORKDIR /myapp/backend\nCOPY Gemfile /myapp/backend/Gemfile\nCOPY Gemfile.lock /myapp/backend/Gemfile.lock\nRUN bundle install\nCOPY . /myapp/backend\n\nENV ENTRYKIT_VERSION 0.4.0\nRUN wget https://github.com/progrium/entrykit/releases/download/v${ENTRYKIT_VERSION}/entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \\\n  && tar -xvzf entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \\\n  && rm entrykit_${ENTRYKIT_VERSION}_Linux_x86_64.tgz \\\n  && mv entrykit /bin/entrykit \\\n  && chmod +x /bin/entrykit \\\n  && entrykit --symlink\n\nENTRYPOINT [ \\\n  \"prehook\", \"ruby -v\", \"--\", \\\n  \"prehook\", \"/myapp/backend/prehook\", \"--\"]\n"
  },
  {
    "path": "backend/Gemfile",
    "content": "source 'https://rubygems.org'\ngit_source(:github) { |repo| \"https://github.com/#{repo}.git\" }\n\nruby '3.3.1'\n\n# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'\ngem 'rails', '~> 6.1.6'\n# gem 'rails', '~> 6.0.3'\n# Use postgresql as the database for Active Record\ngem 'pg', '>= 0.18', '< 2.0'\n# Use Puma as the app server\ngem 'puma', '~> 5.6'\n# See https://github.com/rails/execjs#readme for more supported runtimes\n# gem 'mini_racer', platforms: :ruby\n\n# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks\ngem 'turbolinks', '~> 5'\n# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder\ngem 'jbuilder', '~> 2.11'\n# Use Redis adapter to run Action Cable in production\n# gem 'redis', '~> 4.0'\n# Use ActiveModel has_secure_password\n# gem 'bcrypt', '~> 3.1.7'\n\n# Use ActiveStorage variant\n# gem 'mini_magick', '~> 4.8'\n\n# Use Capistrano for deployment\n# gem 'capistrano-rails', group: :development\n\n# Reduces boot times through caching; required in config/boot.rb\ngem 'bootsnap', '>= 1.1.0', require: false\n\ngroup :development, :test do\n  # Call 'byebug' anywhere in the code to stop execution and get a debugger console\n  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]\nend\n\ngroup :development do\n  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.\n  gem 'web-console', '>= 4.1.0'\n  # Display performance information such as SQL time and flame graphs for each request in your browser.\n  # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md\n  gem 'rack-mini-profiler', '~> 3.0'\n  gem 'listen', '~> 3.7'\n  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring\n  gem 'spring'\n  gem 'spring-watcher-listen', '~> 2.0.0'\nend\n\ngroup :test do\n  # Adds support for Capybara system testing and selenium driver\n  gem 'capybara', '>= 3.26'\n  gem 'selenium-webdriver'\n  # Automate routing spec\n  gem 'route_mechanic'\nend\n\n# Windows does not include zoneinfo files, so bundle the tzinfo-data gem\ngem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]\n\ngem 'rack-cors', require: 'rack/cors'\n"
  },
  {
    "path": "backend/LICENSE",
    "content": "MIT License\n\nCopyright (c) 2018 Masato Ohba\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "backend/README.md",
    "content": "# README\n\nThis README would normally document whatever steps are necessary to get the\napplication up and running.\n\nThings you may want to cover:\n\n* Ruby version\n\n* System dependencies\n\n* Configuration\n\n* Database creation\n\n* Database initialization\n\n* How to run the test suite\n\n* Services (job queues, cache servers, search engines, etc.)\n\n* Deployment instructions\n\n* ...\n"
  },
  {
    "path": "backend/Rakefile",
    "content": "# Add your own tasks in files placed in lib/tasks ending in .rake,\n# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.\n\nrequire_relative 'config/application'\n\nRails.application.load_tasks\n"
  },
  {
    "path": "backend/app/assets/config/manifest.js",
    "content": "//= link_tree ../images\n//= link_directory ../javascripts .js\n//= link_directory ../stylesheets .css\n"
  },
  {
    "path": "backend/app/assets/images/.keep",
    "content": ""
  },
  {
    "path": "backend/app/assets/javascripts/application.js",
    "content": "// This is a manifest file that'll be compiled into application.js, which will include all the files\n// listed below.\n//\n// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, or any plugin's\n// vendor/assets/javascripts directory can be referenced here using a relative path.\n//\n// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the\n// compiled file. JavaScript code in this file should be added after the last require_* statement.\n//\n// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details\n// about supported directives.\n//\n//= require rails-ujs\n//= require activestorage\n//= require turbolinks\n//= require_tree .\n"
  },
  {
    "path": "backend/app/assets/javascripts/cable.js",
    "content": "// Action Cable provides the framework to deal with WebSockets in Rails.\n// You can generate new channels where WebSocket features live using the `rails generate channel` command.\n//\n//= require action_cable\n//= require_self\n//= require_tree ./channels\n\n(function() {\n  this.App || (this.App = {});\n\n  App.cable = ActionCable.createConsumer();\n\n}).call(this);\n"
  },
  {
    "path": "backend/app/assets/javascripts/channels/.keep",
    "content": ""
  },
  {
    "path": "backend/app/assets/stylesheets/application.css",
    "content": "/*\n * This is a manifest file that'll be compiled into application.css, which will include all the files\n * listed below.\n *\n * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's\n * vendor/assets/stylesheets directory can be referenced here using a relative path.\n *\n * You're free to add application-wide styles to this file and they'll appear at the bottom of the\n * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS\n * files in this directory. Styles in this file should be added after the last require_* statement.\n * It is generally better to create a new file per style scope.\n *\n *= require_tree .\n *= require_self\n */\n"
  },
  {
    "path": "backend/app/channels/application_cable/channel.rb",
    "content": "module ApplicationCable\n  class Channel < ActionCable::Channel::Base\n  end\nend\n"
  },
  {
    "path": "backend/app/channels/application_cable/connection.rb",
    "content": "module ApplicationCable\n  class Connection < ActionCable::Connection::Base\n  end\nend\n"
  },
  {
    "path": "backend/app/controllers/application_controller.rb",
    "content": "class ApplicationController < ActionController::Base\nend\n"
  },
  {
    "path": "backend/app/controllers/concerns/.keep",
    "content": ""
  },
  {
    "path": "backend/app/controllers/greetings_controller.rb",
    "content": "class GreetingsController < ApplicationController\n  def hello\n    render json: { content: 'Hello from Rails' }\n  end\nend\n"
  },
  {
    "path": "backend/app/helpers/application_helper.rb",
    "content": "module ApplicationHelper\nend\n"
  },
  {
    "path": "backend/app/jobs/application_job.rb",
    "content": "class ApplicationJob < ActiveJob::Base\nend\n"
  },
  {
    "path": "backend/app/mailers/application_mailer.rb",
    "content": "class ApplicationMailer < ActionMailer::Base\n  default from: 'from@example.com'\n  layout 'mailer'\nend\n"
  },
  {
    "path": "backend/app/models/application_record.rb",
    "content": "class ApplicationRecord < ActiveRecord::Base\n  self.abstract_class = true\nend\n"
  },
  {
    "path": "backend/app/models/concerns/.keep",
    "content": ""
  },
  {
    "path": "backend/app/views/layouts/application.html.erb",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <title>Myapp</title>\n    <%= csrf_meta_tags %>\n    <%= csp_meta_tag %>\n\n    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>\n    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>\n  </head>\n\n  <body>\n    <%= yield %>\n  </body>\n</html>\n"
  },
  {
    "path": "backend/app/views/layouts/mailer.html.erb",
    "content": "<!DOCTYPE html>\n<html>\n  <head>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n    <style>\n      /* Email styles need to be inline */\n    </style>\n  </head>\n\n  <body>\n    <%= yield %>\n  </body>\n</html>\n"
  },
  {
    "path": "backend/app/views/layouts/mailer.text.erb",
    "content": "<%= yield %>\n"
  },
  {
    "path": "backend/bin/bundle",
    "content": "#!/usr/bin/env ruby\nENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)\nload Gem.bin_path('bundler', 'bundle')\n"
  },
  {
    "path": "backend/bin/rails",
    "content": "#!/usr/bin/env ruby\nload File.expand_path(\"spring\", __dir__)\nAPP_PATH = File.expand_path('../config/application', __dir__)\nrequire_relative \"../config/boot\"\nrequire \"rails/commands\"\n"
  },
  {
    "path": "backend/bin/rake",
    "content": "#!/usr/bin/env ruby\nload File.expand_path(\"spring\", __dir__)\nrequire_relative \"../config/boot\"\nrequire \"rake\"\nRake.application.run\n"
  },
  {
    "path": "backend/bin/setup",
    "content": "#!/usr/bin/env ruby\nrequire \"fileutils\"\n\n# path to your application root.\nAPP_ROOT = File.expand_path('..', __dir__)\n\ndef system!(*args)\n  system(*args) || abort(\"\\n== Command #{args} failed ==\")\nend\n\nFileUtils.chdir APP_ROOT do\n  # This script is a way to set up or update your development environment automatically.\n  # This script is idempotent, so that you can run it at any time and get an expectable outcome.\n  # Add necessary setup steps to this file.\n\n  puts '== Installing dependencies =='\n  system! 'gem install bundler --conservative'\n  system('bundle check') || system!('bundle install')\n\n  # Install JavaScript dependencies\n  system! 'bin/yarn'\n\n  # puts \"\\n== Copying sample files ==\"\n  # unless File.exist?('config/database.yml')\n  #   FileUtils.cp 'config/database.yml.sample', 'config/database.yml'\n  # end\n\n  puts \"\\n== Preparing database ==\"\n  system! 'bin/rails db:prepare'\n\n  puts \"\\n== Removing old logs and tempfiles ==\"\n  system! 'bin/rails log:clear tmp:clear'\n\n  puts \"\\n== Restarting application server ==\"\n  system! 'bin/rails restart'\nend\n"
  },
  {
    "path": "backend/bin/spring",
    "content": "#!/usr/bin/env ruby\nif !defined?(Spring) && [nil, \"development\", \"test\"].include?(ENV[\"RAILS_ENV\"])\n  gem \"bundler\"\n  require \"bundler\"\n\n  # Load Spring without loading other gems in the Gemfile, for speed.\n  Bundler.locked_gems.specs.find { |spec| spec.name == \"spring\" }&.tap do |spring|\n    Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path\n    gem \"spring\", spring.version\n    require \"spring/binstub\"\n  rescue Gem::LoadError\n    # Ignore when Spring is not installed.\n  end\nend\n"
  },
  {
    "path": "backend/bin/update",
    "content": "#!/usr/bin/env ruby\nrequire 'fileutils'\ninclude FileUtils\n\n# path to your application root.\nAPP_ROOT = File.expand_path('..', __dir__)\n\ndef system!(*args)\n  system(*args) || abort(\"\\n== Command #{args} failed ==\")\nend\n\nchdir APP_ROOT do\n  # This script is a way to update your development environment automatically.\n  # Add necessary update steps to this file.\n\n  puts '== Installing dependencies =='\n  system! 'gem install bundler --conservative'\n  system('bundle check') || system!('bundle install')\n\n  # Install JavaScript dependencies if using Yarn\n  # system('bin/yarn')\n\n  puts \"\\n== Updating database ==\"\n  system! 'bin/rails db:migrate'\n\n  puts \"\\n== Removing old logs and tempfiles ==\"\n  system! 'bin/rails log:clear tmp:clear'\n\n  puts \"\\n== Restarting application server ==\"\n  system! 'bin/rails restart'\nend\n"
  },
  {
    "path": "backend/bin/yarn",
    "content": "#!/usr/bin/env ruby\nAPP_ROOT = File.expand_path('..', __dir__)\nDir.chdir(APP_ROOT) do\n  yarn = ENV[\"PATH\"].split(File::PATH_SEPARATOR).\n    select { |dir| File.expand_path(dir) != __dir__ }.\n    product([\"yarn\", \"yarn.exe\"]).\n    map { |dir, file| File.expand_path(file, dir) }.\n    find { |file| File.executable?(file) }\n\n  if yarn\n    exec yarn, *ARGV\n  else\n    $stderr.puts \"Yarn executable was not detected in the system.\"\n    $stderr.puts \"Download Yarn at https://yarnpkg.com/en/docs/install\"\n    exit 1\n  end\nend\n"
  },
  {
    "path": "backend/config/application.rb",
    "content": "require_relative \"boot\"\n\nrequire \"rails/all\"\n\n# Require the gems listed in Gemfile, including any gems\n# you've limited to :test, :development, or :production.\nBundler.require(*Rails.groups)\n\nmodule Myapp\n  class Application < Rails::Application\n    # Initialize configuration defaults for originally generated Rails version.\n    config.load_defaults 6.0\n\n    # Configuration for the application, engines, and railties goes here.\n    #\n    # These settings can be overridden in specific environments using the files\n    # in config/environments, which are processed later.\n    #\n    # config.time_zone = \"Central Time (US & Canada)\"\n    # config.eager_load_paths << Rails.root.join(\"extras\")\n\n    config.middleware.insert_before 0, Rack::Cors do\n      allow do\n        origins '*'\n        resource '*', headers: :any, methods: [:get, :post, :options]\n      end\n    end\n  end\nend\n"
  },
  {
    "path": "backend/config/boot.rb",
    "content": "ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)\n\nrequire \"bundler/setup\" # Set up gems listed in the Gemfile.\nrequire \"bootsnap/setup\" # Speed up boot time by caching expensive operations.\n"
  },
  {
    "path": "backend/config/cable.yml",
    "content": "development:\n  adapter: async\n\ntest:\n  adapter: test\n\nproduction:\n  adapter: redis\n  url: <%= ENV.fetch(\"REDIS_URL\") { \"redis://localhost:6379/1\" } %>\n  channel_prefix: myapp_production\n"
  },
  {
    "path": "backend/config/credentials.yml.enc",
    "content": "MhFYHHqzWPtI+D4H1TUKngSXfC1tnHJ3ELcJPi5hDCoAQSkwNsBRJBsOfQpHmHpBP7FZscShFFJBzZhu5WI20K7eeQzIKKoID4hnT5Xxkczib1MEWaAKfEkyRfkW6ui5kUwXDzLlZqb2Vz5gw54h+Wc2AHRys4ixR5kIH6mQrFyXM6TJeEZMowRil0f+a035BOrk4lNjmFQc6qe//DyCPAic7waY8iPrp51R00j/OB2I3LuU8MQILyOlkqVi7kinHYs6ATMElw2BpQR3zl7YU7hWgrMkVJY0Ivq0LGKxbTDh1+stIixppM6ycCkmdRdnunvqAFqoHf62AEh/F7aByyLVuT9pbEvjC0baC2k/KHHq2T/BSMeHxoiiE2/9nRw8tyq2pK1ABdW7BkUOJd7JfqSyoV8Uaf+c0jCV--UuHo79qD2WhbY77G--jzfM8cZ45rAvAU5O5X4QhQ=="
  },
  {
    "path": "backend/config/database.yml",
    "content": "# PostgreSQL. Versions 9.1 and up are supported.\n#\n# Install the pg driver:\n#   gem install pg\n# On OS X with Homebrew:\n#   gem install pg -- --with-pg-config=/usr/local/bin/pg_config\n# On OS X with MacPorts:\n#   gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config\n# On Windows:\n#   gem install pg\n#       Choose the win32 build.\n#       Install PostgreSQL and put its /bin directory on your path.\n#\n# Configure Using Gemfile\n# gem 'pg'\n#\ndefault: &default\n  adapter: postgresql\n  encoding: unicode\n  host: <%= ENV.fetch(\"RAILS_DATABASE_HOST\") { 'postgres' } %>\n  username: <%= ENV.fetch(\"RAILS_DATABASE_USER\") { 'postgres' } %>\n  password: <%= ENV.fetch(\"RAILS_DATABASE_PASSWORD\") { 'password' } %>\n  pool: <%= ENV.fetch(\"RAILS_MAX_THREADS\") { 5 } %>\n\ndevelopment:\n  <<: *default\n  database: myapp_development\n\n  # The specified database role being used to connect to postgres.\n  # To create additional roles in postgres see `$ createuser --help`.\n  # When left blank, postgres will use the default role. This is\n  # the same name as the operating system user that initialized the database.\n  #username: myapp\n\n  # The password associated with the postgres role (username).\n  #password:\n\n  # Connect on a TCP socket. Omitted by default since the client uses a\n  # domain socket that doesn't need configuration. Windows does not have\n  # domain sockets, so uncomment these lines.\n  #host: localhost\n\n  # The TCP port the server listens on. Defaults to 5432.\n  # If your server runs on a different port number, change accordingly.\n  #port: 5432\n\n  # Schema search path. The server defaults to $user,public\n  #schema_search_path: myapp,sharedapp,public\n\n  # Minimum log levels, in increasing order:\n  #   debug5, debug4, debug3, debug2, debug1,\n  #   log, notice, warning, error, fatal, and panic\n  # Defaults to warning.\n  #min_messages: notice\n\n# Warning: The database defined as \"test\" will be erased and\n# re-generated from your development database when you run \"rake\".\n# Do not set this db to the same as development or production.\ntest:\n  <<: *default\n  database: <%= ENV.fetch(\"POSTGRES_DB\") { 'myapp_test' } %>\n\n# As with config/secrets.yml, you never want to store sensitive information,\n# like your database password, in your source code. If your source code is\n# ever seen by anyone, they now have access to your database.\n#\n# Instead, provide the password as a unix environment variable when you boot\n# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database\n# for a full rundown on how to provide these environment variables in a\n# production deployment.\n#\n# On Heroku and other platform providers, you may have a full connection URL\n# available as an environment variable. For example:\n#\n#   DATABASE_URL=\"postgres://myuser:mypass@localhost/somedatabase\"\n#\n# You can use this database configuration with:\n#\n#   production:\n#     url: <%= ENV['DATABASE_URL'] %>\n#\nproduction:\n  <<: *default\n  database: myapp_production\n  username: myapp\n  password: <%= ENV['MYAPP_DATABASE_PASSWORD'] %>\n"
  },
  {
    "path": "backend/config/environment.rb",
    "content": "# Load the Rails application.\nrequire_relative \"application\"\n\n# Initialize the Rails application.\nRails.application.initialize!\n"
  },
  {
    "path": "backend/config/environments/development.rb",
    "content": "require \"active_support/core_ext/integer/time\"\n\nRails.application.configure do\n  # Settings specified here will take precedence over those in config/application.rb.\n\n  # In the development environment your application's code is reloaded any time\n  # it changes. This slows down response time but is perfect for development\n  # since you don't have to restart the web server when you make code changes.\n  config.cache_classes = false\n\n  # Do not eager load code on boot.\n  config.eager_load = false\n\n  # Show full error reports.\n  config.consider_all_requests_local = true\n\n  # Enable/disable caching. By default caching is disabled.\n  # Run rails dev:cache to toggle caching.\n  if Rails.root.join('tmp', 'caching-dev.txt').exist?\n    config.action_controller.perform_caching = true\n    config.action_controller.enable_fragment_cache_logging = true\n\n    config.cache_store = :memory_store\n    config.public_file_server.headers = {\n      'Cache-Control' => \"public, max-age=#{2.days.to_i}\"\n    }\n  else\n    config.action_controller.perform_caching = false\n\n    config.cache_store = :null_store\n  end\n\n  # Store uploaded files on the local file system (see config/storage.yml for options).\n  config.active_storage.service = :local\n\n  # Don't care if the mailer can't send.\n  config.action_mailer.raise_delivery_errors = false\n\n  config.action_mailer.perform_caching = false\n\n  # Print deprecation notices to the Rails logger.\n  config.active_support.deprecation = :log\n\n  # Raise exceptions for disallowed deprecations.\n  config.active_support.disallowed_deprecation = :raise\n\n  # Tell Active Support which deprecation messages to disallow.\n  config.active_support.disallowed_deprecation_warnings = []\n\n  # Raise an error on page load if there are pending migrations.\n  config.active_record.migration_error = :page_load\n\n  # Highlight code that triggered database queries in logs.\n  config.active_record.verbose_query_logs = true\n\n  # Debug mode disables concatenation and preprocessing of assets.\n  # This option may cause significant delays in view rendering with a large\n  # number of complex assets.\n  config.assets.debug = true\n\n  # Suppress logger output for asset requests.\n  config.assets.quiet = true\n\n  # Raises error for missing translations.\n  # config.i18n.raise_on_missing_translations = true\n\n  # Annotate rendered view with file names.\n  # config.action_view.annotate_rendered_view_with_filenames = true\n\n  # Use an evented file watcher to asynchronously detect changes in source code,\n  # routes, locales, etc. This feature depends on the listen gem.\n  config.file_watcher = ActiveSupport::EventedFileUpdateChecker\n\n  # Uncomment if you wish to allow Action Cable access from any origin.\n  # config.action_cable.disable_request_forgery_protection = true\nend\n"
  },
  {
    "path": "backend/config/environments/production.rb",
    "content": "require \"active_support/core_ext/integer/time\"\n\nRails.application.configure do\n  # Settings specified here will take precedence over those in config/application.rb.\n\n  # Code is not reloaded between requests.\n  config.cache_classes = true\n\n  # Eager load code on boot. This eager loads most of Rails and\n  # your application in memory, allowing both threaded web servers\n  # and those relying on copy on write to perform better.\n  # Rake tasks automatically ignore this option for performance.\n  config.eager_load = true\n\n  # Full error reports are disabled and caching is turned on.\n  config.consider_all_requests_local       = false\n  config.action_controller.perform_caching = true\n\n  # Ensures that a master key has been made available in either ENV[\"RAILS_MASTER_KEY\"]\n  # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).\n  # config.require_master_key = true\n\n  # Disable serving static files from the `/public` folder by default since\n  # Apache or NGINX already handles this.\n  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?\n\n  # Compress CSS using a preprocessor.\n  # config.assets.css_compressor = :sass\n\n  # Do not fallback to assets pipeline if a precompiled asset is missed.\n  config.assets.compile = false\n\n  # Enable serving of images, stylesheets, and JavaScripts from an asset server.\n  # config.asset_host = 'http://assets.example.com'\n\n  # Specifies the header that your server uses for sending files.\n  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache\n  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX\n\n  # Store uploaded files on the local file system (see config/storage.yml for options).\n  config.active_storage.service = :local\n\n  # Mount Action Cable outside main process or domain.\n  # config.action_cable.mount_path = nil\n  # config.action_cable.url = 'wss://example.com/cable'\n  # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\\/\\/example.*/ ]\n\n  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.\n  # config.force_ssl = true\n\n  # Include generic and useful information about system operation, but avoid logging too much\n  # information to avoid inadvertent exposure of personally identifiable information (PII).\n  config.log_level = :info\n\n  # Prepend all log lines with the following tags.\n  config.log_tags = [ :request_id ]\n\n  # Use a different cache store in production.\n  # config.cache_store = :mem_cache_store\n\n  # Use a real queuing backend for Active Job (and separate queues per environment).\n  # config.active_job.queue_adapter     = :resque\n  # config.active_job.queue_name_prefix = \"myapp_production\"\n\n  config.action_mailer.perform_caching = false\n\n  # Ignore bad email addresses and do not raise email delivery errors.\n  # Set this to true and configure the email server for immediate delivery to raise delivery errors.\n  # config.action_mailer.raise_delivery_errors = false\n\n  # Enable locale fallbacks for I18n (makes lookups for any locale fall back to\n  # the I18n.default_locale when a translation cannot be found).\n  config.i18n.fallbacks = true\n\n  # Send deprecation notices to registered listeners.\n  config.active_support.deprecation = :notify\n\n  # Log disallowed deprecations.\n  config.active_support.disallowed_deprecation = :log\n\n  # Tell Active Support which deprecation messages to disallow.\n  config.active_support.disallowed_deprecation_warnings = []\n\n  # Use default logging formatter so that PID and timestamp are not suppressed.\n  config.log_formatter = ::Logger::Formatter.new\n\n  # Use a different logger for distributed setups.\n  # require \"syslog/logger\"\n  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')\n\n  if ENV[\"RAILS_LOG_TO_STDOUT\"].present?\n    logger           = ActiveSupport::Logger.new(STDOUT)\n    logger.formatter = config.log_formatter\n    config.logger    = ActiveSupport::TaggedLogging.new(logger)\n  end\n\n  # Do not dump schema after migrations.\n  config.active_record.dump_schema_after_migration = false\n\n  # Inserts middleware to perform automatic connection switching.\n  # The `database_selector` hash is used to pass options to the DatabaseSelector\n  # middleware. The `delay` is used to determine how long to wait after a write\n  # to send a subsequent read to the primary.\n  #\n  # The `database_resolver` class is used by the middleware to determine which\n  # database is appropriate to use based on the time delay.\n  #\n  # The `database_resolver_context` class is used by the middleware to set\n  # timestamps for the last write to the primary. The resolver uses the context\n  # class timestamps to determine how long to wait before reading from the\n  # replica.\n  #\n  # By default Rails will store a last write timestamp in the session. The\n  # DatabaseSelector middleware is designed as such you can define your own\n  # strategy for connection switching and pass that into the middleware through\n  # these configuration options.\n  # config.active_record.database_selector = { delay: 2.seconds }\n  # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver\n  # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session\nend\n"
  },
  {
    "path": "backend/config/environments/test.rb",
    "content": "require \"active_support/core_ext/integer/time\"\n\n# The test environment is used exclusively to run your application's\n# test suite. You never need to work with it otherwise. Remember that\n# your test database is \"scratch space\" for the test suite and is wiped\n# and recreated between test runs. Don't rely on the data there!\n\nRails.application.configure do\n  # Settings specified here will take precedence over those in config/application.rb.\n\n  config.cache_classes = false\n  config.action_view.cache_template_loading = true\n\n  # Do not eager load code on boot. This avoids loading your whole application\n  # just for the purpose of running a single test. If you are using a tool that\n  # preloads Rails for running tests, you may have to set it to true.\n  config.eager_load = false\n\n  # Configure public file server for tests with Cache-Control for performance.\n  config.public_file_server.enabled = true\n  config.public_file_server.headers = {\n    'Cache-Control' => \"public, max-age=#{1.hour.to_i}\"\n  }\n\n  # Show full error reports and disable caching.\n  config.consider_all_requests_local       = true\n  config.action_controller.perform_caching = false\n  config.cache_store = :null_store\n\n  # Raise exceptions instead of rendering exception templates.\n  config.action_dispatch.show_exceptions = false\n\n  # Disable request forgery protection in test environment.\n  config.action_controller.allow_forgery_protection = false\n\n  # Store uploaded files on the local file system in a temporary directory.\n  config.active_storage.service = :test\n\n  config.action_mailer.perform_caching = false\n\n  # Tell Action Mailer not to deliver emails to the real world.\n  # The :test delivery method accumulates sent emails in the\n  # ActionMailer::Base.deliveries array.\n  config.action_mailer.delivery_method = :test\n\n  # Print deprecation notices to the stderr.\n  config.active_support.deprecation = :stderr\n\n  # Raise exceptions for disallowed deprecations.\n  config.active_support.disallowed_deprecation = :raise\n\n  # Tell Active Support which deprecation messages to disallow.\n  config.active_support.disallowed_deprecation_warnings = []\n\n  # Raises error for missing translations.\n  # config.i18n.raise_on_missing_translations = true\n\n  # Annotate rendered view with file names.\n  # config.action_view.annotate_rendered_view_with_filenames = true\nend\n"
  },
  {
    "path": "backend/config/initializers/application_controller_renderer.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# ActiveSupport::Reloader.to_prepare do\n#   ApplicationController.renderer.defaults.merge!(\n#     http_host: 'example.org',\n#     https: false\n#   )\n# end\n"
  },
  {
    "path": "backend/config/initializers/assets.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Version of your assets, change this if you want to expire all your assets.\nRails.application.config.assets.version = '1.0'\n\n# Add additional assets to the asset load path.\n# Rails.application.config.assets.paths << Emoji.images_path\n# Add Yarn node_modules folder to the asset load path.\nRails.application.config.assets.paths << Rails.root.join('node_modules')\n\n# Precompile additional assets.\n# application.js, application.css, and all non-JS/CSS in the app/assets\n# folder are already added.\n# Rails.application.config.assets.precompile += %w( admin.js admin.css )\n"
  },
  {
    "path": "backend/config/initializers/backtrace_silencers.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.\n# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }\n\n# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code\n# by setting BACKTRACE=1 before calling your invocation, like \"BACKTRACE=1 ./bin/rails runner 'MyClass.perform'\".\nRails.backtrace_cleaner.remove_silencers! if ENV[\"BACKTRACE\"]\n"
  },
  {
    "path": "backend/config/initializers/content_security_policy.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Define an application-wide content security policy\n# For further information see the following documentation\n# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy\n\n# Rails.application.config.content_security_policy do |policy|\n#   policy.default_src :self, :https\n#   policy.font_src    :self, :https, :data\n#   policy.img_src     :self, :https, :data\n#   policy.object_src  :none\n#   policy.script_src  :self, :https\n#   policy.style_src   :self, :https\n#   # If you are using webpack-dev-server then specify webpack-dev-server host\n#   policy.connect_src :self, :https, \"http://localhost:3035\", \"ws://localhost:3035\" if Rails.env.development?\n\n#   # Specify URI for violation reports\n#   # policy.report_uri \"/csp-violation-report-endpoint\"\n# end\n\n# If you are using UJS then enable automatic nonce generation\n# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }\n\n# Set the nonce only to specific directives\n# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)\n\n# Report CSP violations to a specified URI\n# For further information see the following documentation:\n# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only\n# Rails.application.config.content_security_policy_report_only = true\n"
  },
  {
    "path": "backend/config/initializers/cookies_serializer.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Specify a serializer for the signed and encrypted cookie jars.\n# Valid options are :json, :marshal, and :hybrid.\nRails.application.config.action_dispatch.cookies_serializer = :json\n"
  },
  {
    "path": "backend/config/initializers/filter_parameter_logging.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Configure sensitive parameters which will be filtered from the log file.\nRails.application.config.filter_parameters += [\n  :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn\n]\n"
  },
  {
    "path": "backend/config/initializers/inflections.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Add new inflection rules using the following format. Inflections\n# are locale specific, and you may define rules for as many different\n# locales as you wish. All of these examples are active by default:\n# ActiveSupport::Inflector.inflections(:en) do |inflect|\n#   inflect.plural /^(ox)$/i, '\\1en'\n#   inflect.singular /^(ox)en/i, '\\1'\n#   inflect.irregular 'person', 'people'\n#   inflect.uncountable %w( fish sheep )\n# end\n\n# These inflection rules are supported but not enabled by default:\n# ActiveSupport::Inflector.inflections(:en) do |inflect|\n#   inflect.acronym 'RESTful'\n# end\n"
  },
  {
    "path": "backend/config/initializers/mime_types.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# Add new mime types for use in respond_to blocks:\n# Mime::Type.register \"text/richtext\", :rtf\n"
  },
  {
    "path": "backend/config/initializers/new_framework_defaults_6_0.rb",
    "content": "# Be sure to restart your server when you modify this file.\n#\n# This file contains migration options to ease your Rails 6.0 upgrade.\n#\n# Once upgraded flip defaults one by one to migrate to the new default.\n#\n# Read the Guide for Upgrading Ruby on Rails for more info on each option.\n\n# Don't force requests from old versions of IE to be UTF-8 encoded.\n# Rails.application.config.action_view.default_enforce_utf8 = false\n\n# Embed purpose and expiry metadata inside signed and encrypted\n# cookies for increased security.\n#\n# This option is not backwards compatible with earlier Rails versions.\n# It's best enabled when your entire app is migrated and stable on 6.0.\n# Rails.application.config.action_dispatch.use_cookies_with_metadata = true\n\n# Change the return value of `ActionDispatch::Response#content_type` to Content-Type header without modification.\n# Rails.application.config.action_dispatch.return_only_media_type_on_content_type = false\n\n# Return false instead of self when enqueuing is aborted from a callback.\n# Rails.application.config.active_job.return_false_on_aborted_enqueue = true\n\n# Send Active Storage analysis and purge jobs to dedicated queues.\n# Rails.application.config.active_storage.queues.analysis = :active_storage_analysis\n# Rails.application.config.active_storage.queues.purge    = :active_storage_purge\n\n# When assigning to a collection of attachments declared via `has_many_attached`, replace existing\n# attachments instead of appending. Use #attach to add new attachments without replacing existing ones.\n# Rails.application.config.active_storage.replace_on_assign_to_many = true\n\n# Use ActionMailer::MailDeliveryJob for sending parameterized and normal mail.\n#\n# The default delivery jobs (ActionMailer::Parameterized::DeliveryJob, ActionMailer::DeliveryJob),\n# will be removed in Rails 6.1. This setting is not backwards compatible with earlier Rails versions.\n# If you send mail in the background, job workers need to have a copy of\n# MailDeliveryJob to ensure all delivery jobs are processed properly.\n# Make sure your entire app is migrated and stable on 6.0 before using this setting.\n# Rails.application.config.action_mailer.delivery_job = \"ActionMailer::MailDeliveryJob\"\n\n# Enable the same cache key to be reused when the object being cached of type\n# `ActiveRecord::Relation` changes by moving the volatile information (max updated at and count)\n# of the relation's cache key into the cache version to support recycling cache key.\n# Rails.application.config.active_record.collection_cache_versioning = true\n"
  },
  {
    "path": "backend/config/initializers/wrap_parameters.rb",
    "content": "# Be sure to restart your server when you modify this file.\n\n# This file contains settings for ActionController::ParamsWrapper which\n# is enabled by default.\n\n# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.\nActiveSupport.on_load(:action_controller) do\n  wrap_parameters format: [:json]\nend\n\n# To enable root element in JSON for ActiveRecord objects.\n# ActiveSupport.on_load(:active_record) do\n#   self.include_root_in_json = true\n# end\n"
  },
  {
    "path": "backend/config/locales/en.yml",
    "content": "# Files in the config/locales directory are used for internationalization\n# and are automatically loaded by Rails. If you want to use locales other\n# than English, add the necessary files in this directory.\n#\n# To use the locales, use `I18n.t`:\n#\n#     I18n.t 'hello'\n#\n# In views, this is aliased to just `t`:\n#\n#     <%= t('hello') %>\n#\n# To use a different locale, set it with `I18n.locale`:\n#\n#     I18n.locale = :es\n#\n# This would use the information in config/locales/es.yml.\n#\n# The following keys must be escaped otherwise they will not be retrieved by\n# the default I18n backend:\n#\n# true, false, on, off, yes, no\n#\n# Instead, surround them with single quotes.\n#\n# en:\n#   'true': 'foo'\n#\n# To learn more, please read the Rails Internationalization guide\n# available at https://guides.rubyonrails.org/i18n.html.\n\nen:\n  hello: \"Hello world\"\n"
  },
  {
    "path": "backend/config/puma.rb",
    "content": "# Puma can serve each request in a thread from an internal thread pool.\n# The `threads` method setting takes two numbers: a minimum and maximum.\n# Any libraries that use thread pools should be configured to match\n# the maximum value specified for Puma. Default is set to 5 threads for minimum\n# and maximum; this matches the default thread size of Active Record.\n#\nmax_threads_count = ENV.fetch(\"RAILS_MAX_THREADS\") { 5 }\nmin_threads_count = ENV.fetch(\"RAILS_MIN_THREADS\") { max_threads_count }\nthreads min_threads_count, max_threads_count\n\n# Specifies the `worker_timeout` threshold that Puma will use to wait before\n# terminating a worker in development environments.\n#\nworker_timeout 3600 if ENV.fetch(\"RAILS_ENV\", \"development\") == \"development\"\n\n# Specifies the `port` that Puma will listen on to receive requests; default is 3000.\n#\nport ENV.fetch(\"PORT\") { 3000 }\n\n# Specifies the `environment` that Puma will run in.\n#\nenvironment ENV.fetch(\"RAILS_ENV\") { \"development\" }\n\n# Specifies the `pidfile` that Puma will use.\npidfile ENV.fetch(\"PIDFILE\") { \"tmp/pids/server.pid\" }\n\n# Specifies the number of `workers` to boot in clustered mode.\n# Workers are forked web server processes. If using threads and workers together\n# the concurrency of the application would be max `threads` * `workers`.\n# Workers do not work on JRuby or Windows (both of which do not support\n# processes).\n#\n# workers ENV.fetch(\"WEB_CONCURRENCY\") { 2 }\n\n# Use the `preload_app!` method when specifying a `workers` number.\n# This directive tells Puma to first boot the application and load code\n# before forking the application. This takes advantage of Copy On Write\n# process behavior so workers use less memory.\n#\n# preload_app!\n\n# Allow puma to be restarted by `rails restart` command.\nplugin :tmp_restart\n"
  },
  {
    "path": "backend/config/routes.rb",
    "content": "Rails.application.routes.draw do\n  get 'greetings/hello'\n  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html\nend\n"
  },
  {
    "path": "backend/config/spring.rb",
    "content": "Spring.watch(\n  \".ruby-version\",\n  \".rbenv-vars\",\n  \"tmp/restart.txt\",\n  \"tmp/caching-dev.txt\"\n)\n"
  },
  {
    "path": "backend/config/storage.yml",
    "content": "test:\n  service: Disk\n  root: <%= Rails.root.join(\"tmp/storage\") %>\n\nlocal:\n  service: Disk\n  root: <%= Rails.root.join(\"storage\") %>\n\n# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)\n# amazon:\n#   service: S3\n#   access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>\n#   secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>\n#   region: us-east-1\n#   bucket: your_own_bucket\n\n# Remember not to checkin your GCS keyfile to a repository\n# google:\n#   service: GCS\n#   project: your_project\n#   credentials: <%= Rails.root.join(\"path/to/gcs.keyfile\") %>\n#   bucket: your_own_bucket\n\n# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)\n# microsoft:\n#   service: AzureStorage\n#   storage_account_name: your_account_name\n#   storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>\n#   container: your_container_name\n\n# mirror:\n#   service: Mirror\n#   primary: local\n#   mirrors: [ amazon, google, microsoft ]\n"
  },
  {
    "path": "backend/config.ru",
    "content": "# This file is used by Rack-based servers to start the application.\n\nrequire_relative \"config/environment\"\n\nrun Rails.application\nRails.application.load_server\n"
  },
  {
    "path": "backend/db/schema.rb",
    "content": "# This file is auto-generated from the current state of the database. Instead\n# of editing this file, please use the migrations feature of Active Record to\n# incrementally modify your database, and then regenerate this schema definition.\n#\n# This file is the source Rails uses to define your schema when running `bin/rails\n# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to\n# be faster and is potentially less error prone than running all of your\n# migrations from scratch. Old migrations may fail to apply correctly if those\n# migrations use external dependencies or application code.\n#\n# It's strongly recommended that you check this file into your version control system.\n\nActiveRecord::Schema.define(version: 0) do\n\n  # These are extensions that must be enabled in order to support this database\n  enable_extension \"plpgsql\"\n\nend\n"
  },
  {
    "path": "backend/db/seeds.rb",
    "content": "# This file should contain all the record creation needed to seed the database with its default values.\n# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).\n#\n# Examples:\n#\n#   movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])\n#   Character.create(name: 'Luke', movie: movies.first)\n"
  },
  {
    "path": "backend/lib/assets/.keep",
    "content": ""
  },
  {
    "path": "backend/lib/tasks/.keep",
    "content": ""
  },
  {
    "path": "backend/log/.keep",
    "content": ""
  },
  {
    "path": "backend/prehook",
    "content": "#!/usr/bin/env bash\n\nif [ -e Gemfile ]; then\n  bundle check || bundle install\nfi\n\nif [ -e tmp/pids/server.pid ]; then\n  rm tmp/pids/server.pid\nfi\n"
  },
  {
    "path": "backend/public/404.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>The page you were looking for doesn't exist (404)</title>\n  <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n  <style>\n  .rails-default-error-page {\n    background-color: #EFEFEF;\n    color: #2E2F30;\n    text-align: center;\n    font-family: arial, sans-serif;\n    margin: 0;\n  }\n\n  .rails-default-error-page div.dialog {\n    width: 95%;\n    max-width: 33em;\n    margin: 4em auto 0;\n  }\n\n  .rails-default-error-page div.dialog > div {\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #BBB;\n    border-top: #B00100 solid 4px;\n    border-top-left-radius: 9px;\n    border-top-right-radius: 9px;\n    background-color: white;\n    padding: 7px 12% 0;\n    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n\n  .rails-default-error-page h1 {\n    font-size: 100%;\n    color: #730E15;\n    line-height: 1.5em;\n  }\n\n  .rails-default-error-page div.dialog > p {\n    margin: 0 0 1em;\n    padding: 1em;\n    background-color: #F7F7F7;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #999;\n    border-bottom-left-radius: 4px;\n    border-bottom-right-radius: 4px;\n    border-top-color: #DADADA;\n    color: #666;\n    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n  </style>\n</head>\n\n<body class=\"rails-default-error-page\">\n  <!-- This file lives in public/404.html -->\n  <div class=\"dialog\">\n    <div>\n      <h1>The page you were looking for doesn't exist.</h1>\n      <p>You may have mistyped the address or the page may have moved.</p>\n    </div>\n    <p>If you are the application owner check the logs for more information.</p>\n  </div>\n</body>\n</html>\n"
  },
  {
    "path": "backend/public/422.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>The change you wanted was rejected (422)</title>\n  <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n  <style>\n  .rails-default-error-page {\n    background-color: #EFEFEF;\n    color: #2E2F30;\n    text-align: center;\n    font-family: arial, sans-serif;\n    margin: 0;\n  }\n\n  .rails-default-error-page div.dialog {\n    width: 95%;\n    max-width: 33em;\n    margin: 4em auto 0;\n  }\n\n  .rails-default-error-page div.dialog > div {\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #BBB;\n    border-top: #B00100 solid 4px;\n    border-top-left-radius: 9px;\n    border-top-right-radius: 9px;\n    background-color: white;\n    padding: 7px 12% 0;\n    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n\n  .rails-default-error-page h1 {\n    font-size: 100%;\n    color: #730E15;\n    line-height: 1.5em;\n  }\n\n  .rails-default-error-page div.dialog > p {\n    margin: 0 0 1em;\n    padding: 1em;\n    background-color: #F7F7F7;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #999;\n    border-bottom-left-radius: 4px;\n    border-bottom-right-radius: 4px;\n    border-top-color: #DADADA;\n    color: #666;\n    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n  </style>\n</head>\n\n<body class=\"rails-default-error-page\">\n  <!-- This file lives in public/422.html -->\n  <div class=\"dialog\">\n    <div>\n      <h1>The change you wanted was rejected.</h1>\n      <p>Maybe you tried to change something you didn't have access to.</p>\n    </div>\n    <p>If you are the application owner check the logs for more information.</p>\n  </div>\n</body>\n</html>\n"
  },
  {
    "path": "backend/public/500.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n  <title>We're sorry, but something went wrong (500)</title>\n  <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n  <style>\n  .rails-default-error-page {\n    background-color: #EFEFEF;\n    color: #2E2F30;\n    text-align: center;\n    font-family: arial, sans-serif;\n    margin: 0;\n  }\n\n  .rails-default-error-page div.dialog {\n    width: 95%;\n    max-width: 33em;\n    margin: 4em auto 0;\n  }\n\n  .rails-default-error-page div.dialog > div {\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #BBB;\n    border-top: #B00100 solid 4px;\n    border-top-left-radius: 9px;\n    border-top-right-radius: 9px;\n    background-color: white;\n    padding: 7px 12% 0;\n    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n\n  .rails-default-error-page h1 {\n    font-size: 100%;\n    color: #730E15;\n    line-height: 1.5em;\n  }\n\n  .rails-default-error-page div.dialog > p {\n    margin: 0 0 1em;\n    padding: 1em;\n    background-color: #F7F7F7;\n    border: 1px solid #CCC;\n    border-right-color: #999;\n    border-left-color: #999;\n    border-bottom-color: #999;\n    border-bottom-left-radius: 4px;\n    border-bottom-right-radius: 4px;\n    border-top-color: #DADADA;\n    color: #666;\n    box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);\n  }\n  </style>\n</head>\n\n<body class=\"rails-default-error-page\">\n  <!-- This file lives in public/500.html -->\n  <div class=\"dialog\">\n    <div>\n      <h1>We're sorry, but something went wrong.</h1>\n    </div>\n    <p>If you are the application owner check the logs for more information.</p>\n  </div>\n</body>\n</html>\n"
  },
  {
    "path": "backend/public/robots.txt",
    "content": "# See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file\n"
  },
  {
    "path": "backend/test/application_system_test_case.rb",
    "content": "require \"test_helper\"\n\nclass ApplicationSystemTestCase < ActionDispatch::SystemTestCase\n  driven_by :selenium, using: :chrome, screen_size: [1400, 1400]\nend\n"
  },
  {
    "path": "backend/test/controllers/.keep",
    "content": ""
  },
  {
    "path": "backend/test/fixtures/.keep",
    "content": ""
  },
  {
    "path": "backend/test/fixtures/files/.keep",
    "content": ""
  },
  {
    "path": "backend/test/helpers/.keep",
    "content": ""
  },
  {
    "path": "backend/test/integration/.keep",
    "content": ""
  },
  {
    "path": "backend/test/mailers/.keep",
    "content": ""
  },
  {
    "path": "backend/test/models/.keep",
    "content": ""
  },
  {
    "path": "backend/test/routing/routing_test.rb",
    "content": "class RoutingTest < Minitest::Test\n  include ::RouteMechanic::Testing::Methods\n\n  def test_that_application_has_correct_routes\n    assert_all_routes\n  end\nend\n"
  },
  {
    "path": "backend/test/system/.keep",
    "content": ""
  },
  {
    "path": "backend/test/test_helper.rb",
    "content": "ENV['RAILS_ENV'] ||= 'test'\nrequire_relative '../config/environment'\nrequire 'rails/test_help'\n\nclass ActiveSupport::TestCase\n  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.\n  fixtures :all\n\n  # Add more helper methods to be used by all tests here...\nend\n"
  },
  {
    "path": "backend/vendor/.keep",
    "content": ""
  },
  {
    "path": "docker-compose.yml",
    "content": "version: '3'\nservices:\n  db:\n    container_name: postgres\n    image: postgres:11\n    volumes:\n      - ./tmp/db:/var/lib/postgresql/data\n    environment:\n      POSTGRES_HOST_AUTH_METHOD: trust\n  backend:\n    container_name: backend\n    platform: linux/amd64\n    build: ./backend\n    command: bundle exec rails s -p 3000 -b '0.0.0.0'\n    volumes:\n      - ./backend:/myapp/backend\n    depends_on:\n      - db\n  frontend:\n    container_name: frontend\n    platform: linux/amd64\n    image: \"node:14-alpine\"\n    user: \"node\"\n    working_dir: /myapp/frontend\n    volumes:\n      - ./frontend:/myapp/frontend\n    command: \"yarn dev\"\n    depends_on:\n      - backend\n  yaichi:\n    container_name: yaichi\n    platform: linux/amd64\n    image: mtsmfm/yaichi:1.5.0\n    ports:\n      - 80:3000\n    volumes:\n      - /var/run/docker.sock:/var/run/docker.sock\n  "
  },
  {
    "path": "frontend/.gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "frontend/jest.config.js",
    "content": "module.exports = {\n  \"roots\": [\n    \"./src\"\n  ],\n  \"transform\": {\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  \"testRegex\": \"(/__tests__/.*|(\\\\.|/)(test|spec))\\\\.tsx?$\",\n  \"moduleFileExtensions\": [\n    \"ts\",\n    \"tsx\",\n    \"js\",\n  ],\n  moduleNameMapper: {\n    '\\\\.(css)$': '<rootDir>/src/__tests__/styleMock.js',\n  },\n}\n"
  },
  {
    "path": "frontend/package.json",
    "content": "{\n  \"name\": \"frontend\",\n  \"version\": \"1.0.0\",\n  \"main\": \"index.js\",\n  \"license\": \"MIT\",\n  \"scripts\": {\n    \"build\": \"webpack --mode production\",\n    \"dev\": \"webpack-dev-server\",\n    \"test\": \"jest\",\n    \"typecheck\": \"tsc -p . --noEmit\"\n  },\n  \"devDependencies\": {\n    \"@types/jest\": \"^27.5.0\",\n    \"@types/react\": \"^17.0.40\",\n    \"@types/react-dom\": \"^17.0.11\",\n    \"css-loader\": \"^3.5.3\",\n    \"html-webpack-plugin\": \"^4.5.2\",\n    \"jest\": \"^26.6.3\",\n    \"style-loader\": \"^1.2.1\",\n    \"ts-jest\": \"^26.5.6\",\n    \"ts-loader\": \"^7.0.5\",\n    \"typescript\": \"^4.6.4\",\n    \"webpack\": \"^4.44.2\",\n    \"webpack-cli\": \"^3.3.12\",\n    \"webpack-dev-server\": \"^4.7.4\"\n  },\n  \"dependencies\": {\n    \"react\": \"^17.0.2\",\n    \"react-dom\": \"^17.0.2\"\n  }\n}\n"
  },
  {
    "path": "frontend/src/App.css",
    "content": ".App {\n  text-align: center;\n}\n\n.App-logo {\n  animation: App-logo-spin infinite 20s linear;\n  height: 40vmin;\n  pointer-events: none;\n}\n\n.App-header {\n  background-color: #282c34;\n  min-height: 100vh;\n  display: flex;\n  flex-direction: column;\n  align-items: center;\n  justify-content: center;\n  font-size: calc(10px + 2vmin);\n  color: white;\n}\n\n.App-link {\n  color: #61dafb;\n}\n\n@keyframes App-logo-spin {\n  from {\n    transform: rotate(0deg);\n  }\n  to {\n    transform: rotate(360deg);\n  }\n}\n"
  },
  {
    "path": "frontend/src/App.tsx",
    "content": "import React from 'react';\nimport './App.css';\n\nconst BACKEND_API_URL = process.env.BACKEND_API_URL || 'http://backend.localhost';\n\nconst fetchContent = async (updateContent: (content: string) => void) => {\n  const response = await fetch(`${BACKEND_API_URL}/greetings/hello`,{\n    headers: {\n      'Accept': 'application/json',\n      'Content-Type': 'application/json',\n    },\n  });\n  const data = await response.json();\n  updateContent(data.content);\n};\n\nconst App: React.FC = () => {\n  const [content, updateContent] = React.useState('Waiting for a response from Rails...');\n\n  React.useEffect(() => {\n    fetchContent(updateContent);\n  }, []);\n\n  return (\n    <div className=\"App\">\n      <header className=\"App-header\">\n        <p>\n          {content}\n        </p>\n      </header>\n    </div>\n  );\n}\n\nexport default App;\n"
  },
  {
    "path": "frontend/src/__tests__/App.test.tsx",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from '../App';\n\nit('renders without crashing', () => {\n  const div = document.createElement('div');\n  ReactDOM.render(<App />, div);\n  ReactDOM.unmountComponentAtNode(div);\n});\n"
  },
  {
    "path": "frontend/src/__tests__/styleMock.js",
    "content": "module.exports = {};\n"
  },
  {
    "path": "frontend/src/index.css",
    "content": "body {\n  margin: 0;\n  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n    sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n    monospace;\n}\n"
  },
  {
    "path": "frontend/src/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"utf-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <meta name=\"theme-color\" content=\"#000000\" />\n    <title>React App</title>\n</head>\n<body>\n<noscript>You need to enable JavaScript to run this app.</noscript>\n<div id=\"root\"></div>\n</body>\n</html>\n"
  },
  {
    "path": "frontend/src/index.tsx",
    "content": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\n\nReactDOM.render(<App />, document.getElementById('root'));\n"
  },
  {
    "path": "frontend/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es2019\",\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"node\",\n    \"jsx\": \"react\",\n    \"strict\": true,\n    \"esModuleInterop\": true,\n    \"forceConsistentCasingInFileNames\": true\n  }\n}\n"
  },
  {
    "path": "frontend/webpack.config.js",
    "content": "const path = require(\"path\");\nconst HTMLPlugin = require(\"html-webpack-plugin\");\n\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.tsx?$/,\n        use: {\n          loader: \"ts-loader\",\n          options: {\n            transpileOnly: true,\n          },\n        },\n      },\n      {\n        test: /\\.css$/i,\n        use: [\"style-loader\", \"css-loader\"]\n      },\n    ],\n  },\n  resolve: {\n    extensions: [\".js\", \".ts\", \".tsx\", \".json\", \".mjs\", \".wasm\"],\n  },\n  plugins: [\n    new HTMLPlugin({\n      template: path.join(__dirname, \"src/index.html\"),\n    }),\n  ],\n  devServer: {\n    host: '0.0.0.0',\n    port: 3000,\n    disableHostCheck: true,\n  },\n};\n"
  }
]