{"id":25440543,"url":"https://github.com/pglevy/firstrailsapp","last_synced_at":"2025-05-15T13:34:38.584Z","repository":{"id":197695688,"uuid":"698822708","full_name":"pglevy/FirstRailsApp","owner":"pglevy","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-07T22:36:07.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T11:38:12.868Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"replit.com/@pglevy/FirstRailsApp","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/pglevy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-01T04:25:08.000Z","updated_at":"2023-10-01T04:25:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe192480-09e5-432a-9307-080e22df070e","html_url":"https://github.com/pglevy/FirstRailsApp","commit_stats":null,"previous_names":["pglevy/firstrailsapp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pglevy%2FFirstRailsApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pglevy%2FFirstRailsApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pglevy%2FFirstRailsApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pglevy%2FFirstRailsApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pglevy","download_url":"https://codeload.github.com/pglevy/FirstRailsApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254349658,"owners_count":22056392,"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":[],"created_at":"2025-02-17T11:37:34.727Z","updated_at":"2025-05-15T13:34:38.562Z","avatar_url":"https://github.com/pglevy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rails on Replit\n\nThis is a template to get you started with Rails on Replit. It's ready to go so you can just hit run and start coding!\n\nThis template was generated using `rails new` (after you install the `rails` gem from the packager sidebar) so you can always do that if you prefer to set it up from scratch. We only made a couple changes to make to run it on Replit:\n\n- bind the app on `0.0.0.0` instead of `localhost` (see `.replit`)\n- allow `*.repl.co` hosts (see `config/environments/development.rb`)\n- allow the app to be iframed on `replit.com` (see `config/application.rb`)\n\n## Running the app\n\nSimply hit run! You can edit the run command from the `.replit` file.\n\n## Running commands\n\nStart every command with `bundle exec` so that it runs in the context of the installed gems environment. The console pane will give you output from the server but you can run arbitrary commands from the shell without stopping the server.\n\n## Database\n\nSQLite would work in development but we don't recommend running it in production. Instead look into using the built-in [Replit database](http://docs.replit.com/misc/database). Otherwise you are welcome to connect databases from your favorite provider. \n\n## Securing your app\n\nThe default setup runs Rails in *development mode*, which is fine for learning\nRails and building small projects where security is not a big concern.\nIf you are building more ambitious projects with users and access control, \nyou may want to tighten up the app's security. Here are the steps to securing your app:\n\n1. Generate your master key\n2. Run the `rails credentials:edit` command\n3. Edit your run command to run Rails in production mode\n\nWe'll go through each step in more detail below. You can also\nfollow along with this [5 minute video](https://www.loom.com/share/e17ccdb58249402b95b458e6c6bedb5d) which walks you through.\n\n### 1. Generate your master key\n\nIn rails, the master key is a master password that's used to encrypt all of the secret information\nthat is used by the application. Usually, this contained in a file `config/master.key`,\nbut in an repl, we don't store secrets in files because they are publicly viewable. Instead\nwe create a secret.\n\n1. Open the \"Secrets (environment variables)\" panel (the lock icon)\n2. Add a new secret with the key of RAILS_MASTER_KEY\n3. Run these commands in the shell to generate a random key:\n```\nirb\nrequire 'securerandom'\nputs SecureRandom.hex(16)\n```\n4. Copy the random value from the shell to the secret value field\n5. Refresh the browser to let the secret take affect in the shell\n\n### 2. Run the `rails credentials:edit` command\n\nThis step will create the `config/credentials.enc.yml` file, which will contain the secret\nvalues used by the Rails application and is encrypted with the master key. Even if someone\nobtained `config/credentials.enc.yml`, they will not be able to read its contents without\nyour master key.\n\n1. In the shell, run:\n\n```\nrails credentials:edit\n```\n\n2. This will open the `nano` editor which will allow you to edit the file in YAML format.\nHere, you have the option of adding additional secret information, such as API keys for 3rd\nparty services. It will initially contain a single secret value called `secret_key_base`\nwhich is used to encrypt session cookies. Hit Ctrl-X to exit nano and this file will be\nencrypted and saved.\n\n### 3. Edit your run command to run Rails in production mode\n\nNow we need to tell Rails to run in production mode.\nIt will not use the credentials file otherwise. To do this:\n\n1. If don't see the `.replit` file, select \"Show hidden files\"\nunder the triple dot menu on the \"Files\" panel.\n2. Open `.replit` and find the run command. Change it to read:\n`rails server --binding=0.0.0.0`\n3. Hit the run button, again, and now you are running in production mode!\n\nThere are some differences between how production mode works from\ndev mode. One difference is it won't show the normal Rails\nwelcome screen.\n\n### More about security\n\nIf you were wondering why running in development is insecure, Rails generates\na secret_key_base based on the name of your app. So if someone knows the name of\nyour app, they can guess your secret_key_base.\nIf you'd like to learn more about security in Rails, read\n[Securing Rails Applications](https://guides.rubyonrails.org/security.html) on rubyonrails.org.\n\n## Help\n\nIf you need help you might be able to find an answer on our [docs](https://docs.replit.com) page. Feel free to report bugs and give us feedback [here](https://replit.com/support).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpglevy%2Ffirstrailsapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpglevy%2Ffirstrailsapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpglevy%2Ffirstrailsapp/lists"}