{"id":14955325,"url":"https://github.com/eggmantv/rails7vite","last_synced_at":"2025-10-01T18:31:05.182Z","repository":{"id":56768971,"uuid":"524900584","full_name":"eggmantv/rails7vite","owner":"eggmantv","description":"Rails 7 + Vite + React + Docker","archived":false,"fork":false,"pushed_at":"2022-08-24T05:28:46.000Z","size":88,"stargazers_count":34,"open_issues_count":1,"forks_count":3,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-01-14T11:14:06.779Z","etag":null,"topics":["docker","rails","rails7","ruby","vite"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eggmantv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-15T07:54:57.000Z","updated_at":"2024-09-12T05:59:30.000Z","dependencies_parsed_at":"2023-01-16T17:45:23.622Z","dependency_job_id":null,"html_url":"https://github.com/eggmantv/rails7vite","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/eggmantv%2Frails7vite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggmantv%2Frails7vite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggmantv%2Frails7vite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eggmantv%2Frails7vite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eggmantv","download_url":"https://codeload.github.com/eggmantv/rails7vite/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234719838,"owners_count":18876526,"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":["docker","rails","rails7","ruby","vite"],"created_at":"2024-09-24T13:10:59.437Z","updated_at":"2025-10-01T18:31:04.796Z","avatar_url":"https://github.com/eggmantv.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"English | [简体中文](./README.zh-CN.md)\n\n# Rails 7 + Vite + React + Docker\n\nThis project is a scaffold to help you easily and quickly to create your own Ruby on Rails 7 project with Vite, React and Docker support.\n\nComparing with webpack, Vite is a super fast and easy-to-use **Next Generation Frontend Tooling**, learn more [vite](https://github.com/vitejs/vite).\n\n## Setup\n\nYou need to install ruby 3.x first, you can use [rbenv](https://github.com/rbenv/rbenv), and make sure you have latest version of nodejs and yarn installed already.\n\nClone this project, then run:\n\n```shell\nbundle\ncd vite\nyarn\n```\n\nThen start development daemons:\n\n```shell\n# go to project root\n./start_dev.sh # puma\n./start_dev_vite.sh # vite\n```\n\nthen open http://localhost:5100 in your browser.\n\n## Development\n\n- Add more entry files\n\nAssets(javascript, css, images, etc.) are under vite directory, if you want add more javascript entry files just change _vite.config.js_:\n\n```javascript\n....\nbuild: {\n    manifest: true,\n    assetsDir: \"packs/assets\",\n    rollupOptions: {\n      input: [\n        \"./src/packs/app.jsx\",\n        \"./src/packs/home/index.jsx\",\n        \"./src/packs/other/new/entry/file.jsx\", // new entry file here\n      ]\n    }\n  }\n```\n\nand then use the helper method in your view:\n\n```ruby\n\u003c%= vite_include_tag \"js\", \"other/new/entry/file.jsx\" %\u003e\n```\n\nwe already create a demo with the _WelcomeController_ and its view, you can follow it to see how it works. (which will also show you how to use CSS and images)\n\n\u003e All your javascript entry files should be placed under **vite/src/packs** directory.\n\n- Database\n\nThis project is shipped with MongoDB by default, you can change it to other SQL databases if you want.\n\n- Puma\n\nPuma config file is _config/puma.rb_, you can search 5100(default port) through the project to change the default port.\n\n- Vite port\n\nThe default vite port for local development is _3036_, you can search it through the whole project if you want a modify.\n\n- master key\n\nFor convenient, this project commited the _master.key_, which is not recommended for your own project, please re-generate the master.key after cloned and ignore it from your git repository:\n\n```shell\nrm -f config/master.key\nrm -f config/credentials.yml.enc\nEDITOR=\"vim\" bin/rails credentials:edit # just save, no need editing\ngit rm --cached config/master.key\n# then edit .gitignore and add the master.key to it.\n```\n\n## Build \u0026 Deployment\n\n- Build docker images\n\n```shell\n./docker-build.sh\n```\n\nand then, you can push the image to your registry server. You can change the image name if you want. you can also put the docker push command to the end of the _docker-build.sh_ script to save some time.\n\n- Apple M1 \u0026 M2\n\nIf you are building images at Apple silicon(M1, M2 etc.) for linux, you need to uncomment the line with **build_opts** in both **docker-build.sh** scripts.\n\n- If you want to run docker image locally:\n\nYou can run with docker-compose.yml or use **docker run** directly:\n\n```shell\ndocker run --rm -it -p 5100:5100 \\\n--env RAILS_SERVE_STATIC_FILES=true rails7vite:latest\n```\n\nyou may need to adjust the environment variables by your needs.\n\n## Follow us\n\nFor more turorials and dev videos, you can follow us here [重力不足](https://space.bilibili.com/25990460)，cheers:)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggmantv%2Frails7vite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feggmantv%2Frails7vite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feggmantv%2Frails7vite/lists"}