{"id":13819042,"url":"https://github.com/giannisp/rails-react-boilerplate","last_synced_at":"2025-05-16T04:32:06.666Z","repository":{"id":54133014,"uuid":"80992509","full_name":"giannisp/rails-react-boilerplate","owner":"giannisp","description":"Ruby on Rails, React, Webpack 4 boilerplate app.","archived":true,"fork":false,"pushed_at":"2021-03-29T16:30:19.000Z","size":2077,"stargazers_count":91,"open_issues_count":2,"forks_count":59,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-19T18:45:38.223Z","etag":null,"topics":["boilerplate","rails","react","ruby-on-rails","webpack4"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/giannisp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-05T12:51:44.000Z","updated_at":"2023-10-28T04:32:05.000Z","dependencies_parsed_at":"2022-08-13T07:10:45.443Z","dependency_job_id":null,"html_url":"https://github.com/giannisp/rails-react-boilerplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisp%2Frails-react-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisp%2Frails-react-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisp%2Frails-react-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/giannisp%2Frails-react-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/giannisp","download_url":"https://codeload.github.com/giannisp/rails-react-boilerplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254469187,"owners_count":22076450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boilerplate","rails","react","ruby-on-rails","webpack4"],"created_at":"2024-08-04T08:00:38.444Z","updated_at":"2025-05-16T04:32:05.627Z","avatar_url":"https://github.com/giannisp.png","language":"Ruby","readme":"# rails-react-boilerplate\n\nThis is a pure [Ruby on Rails](http://rubyonrails.org/) / [React](https://facebook.github.io/react/) / [Webpack 4](https://webpack.js.org/) boilerplate app.\n\n## Features\n\n- Ruby on Rails 6.x\n- React 16.x\n- Webpack 4.x\n- Babel 7.x\n- ESLint support\n- Prettier support\n- SASS and StyleLint support\n- Hashed filenames for production assets\n- Separate app and vendor JS bundles\n- Postgres compatibility\n- Using Rails default gems and NPM packages only\n\n## Exit Asset Pipeline, Enter Webpack\n\nWhy Webpack?  \nWebpack is a module bundler. It can bundle all JS files for usage in the browser, but can also transform / bundle / package any resource or frontend asset.  \nThe [NPM](https://www.npmjs.com/) ecosystem is huge, and Webpack makes it available in the simplest way possible.  \nWebpack can support every modern JS app, using ES6 or CommonJS modules, or both, create a single or multiple bundles, and in general can be customized to accomplish any application requirement.\n\nThe frontend assets on this repository are placed on a more accessible directory, at `front/js` and `front/css`, rather than `app/assets/javascripts` and `app/assets/stylesheets`.  \nAt any point, migration to a different backend (for example NodeJS) can be seamless since Webpack is running as a stand-alone bundler, there's absolutely no dependence to the Asset Pipeline or any other framework-specific module.\n\n## Install\n\nIt's recommended to use Ruby 2.7.1 and NodeJS 12.x.\n\n```sh\n# install bundler if not available\ngem install bundler\n\n# install gem dependencies\nbundle install\n\n# install npm dependencies\nnpm install\n\n# create the postgres databases\n# update config/database.yml details if needed\nrake db:create\n\n# generate assets for development\nnpm run webpack\n\n# start server\nrails s\n```\n\n## Webpack scripts\n\n`npm run webpack`  \nBuilds the assets for development mode.\n\n`npm run webpack:watch`  \nBuilds the assets for development mode, and rebuilds on every detected change.\n\n`npm run webpack:production`  \nBuilds the assets for production mode, output files are hashed.\n\n## Load assets in production from a custom root directory or URL\n\nBy default JS/CSS assets are being served from the `public/dist` directory. However in production it may be needed to serve assets from a CDN or an S3 bucket etc.  \nSimply override the `Rails.application.config.assets.root_path` property on the production environment to accomplish it.  \nOf course during the deployment script and after the `npm run webpack-production` command, `public/dist/*` output files should be copied to the target dir or infrastructure.\n\n## Run in production\n\n```\n# build assets\nnpm run webpack:production\n\n# run rails server\nSECRET_KEY_BASE=abcd RAILS_SERVE_STATIC_FILES=true rails s -e production\n```\n\n## Run in Docker (optional)\n\nRepository contains a basic Dockerfile for running the app in production mode.  \nAssets should be compiled first using webpack outside of the container.\n\n```sh\n# build docker image\ndocker build -t rails-react-boilerplate .\n\n# run docker image\ndocker run -p 3000:3000 -e SECRET_KEY_BASE=abcd rails-react-boilerplate\n```\n","funding_links":[],"categories":["Happy Exploring 🤘"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiannisp%2Frails-react-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgiannisp%2Frails-react-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgiannisp%2Frails-react-boilerplate/lists"}