{"id":19648368,"url":"https://github.com/wilsonkinyua/ruby-sinatra-application-structure","last_synced_at":"2025-04-28T15:32:27.470Z","repository":{"id":62798919,"uuid":"562548403","full_name":"WilsonKinyua/ruby-sinatra-application-structure","owner":"WilsonKinyua","description":"Typical file structure for a Sinatra application","archived":false,"fork":false,"pushed_at":"2022-11-08T10:18:05.000Z","size":10,"stargazers_count":1,"open_issues_count":1,"forks_count":21,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T09:25:24.801Z","etag":null,"topics":["folder-structure","ruby","sinatra-applications"],"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/WilsonKinyua.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-11-06T17:35:06.000Z","updated_at":"2022-11-08T13:37:31.000Z","dependencies_parsed_at":"2023-01-21T06:21:22.776Z","dependency_job_id":null,"html_url":"https://github.com/WilsonKinyua/ruby-sinatra-application-structure","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/WilsonKinyua%2Fruby-sinatra-application-structure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilsonKinyua%2Fruby-sinatra-application-structure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilsonKinyua%2Fruby-sinatra-application-structure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WilsonKinyua%2Fruby-sinatra-application-structure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WilsonKinyua","download_url":"https://codeload.github.com/WilsonKinyua/ruby-sinatra-application-structure/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251338851,"owners_count":21573625,"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":["folder-structure","ruby","sinatra-applications"],"created_at":"2024-11-11T14:48:05.535Z","updated_at":"2025-04-28T15:32:26.056Z","avatar_url":"https://github.com/WilsonKinyua.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sinatra Application Structure\n\n\n## Setup\n\nRun these commands to install the dependencies and start the server:\n\n```console\n$ bundle install\n$ bundle exec rake server (will start the server on port 8000 by default 😃)\n```\n\n\n## Separation of Concerns with File Structure\n\nSo far, we've been setting up the file structure for our application in a way\nthat nicely [**separates the concerns**][soc] of our code. Each folder, and each file\nwithin that folder, has a clearly defined responsibility. Let's review:\n\n- `app/models`: Our Active Record models. Responsible for code that accesses and\n  updates data in our database using classes that inherit from\n  `ActiveRecord::Base`.\n- `config`: Code in this folder is responsible for our environment setup, like\n  requiring files/gems, and establishing a connection to the database.\n- `db/migrate`: Our Active Record migrations. Responsible for creating and\n  altering the structure of the database (making new tables, adding columns to\n  existing tables, etc).\n- `db/seeds.rb`: Lets us easily add sample data to the database.\n- `spec`: Our RSpec tests.\n- `Gemfile`: Lists all the gems our application depends on.\n- `Rakefile`: Code for common tasks that we can easily run from the command\n  line, like `rake console`.\n\nBy organizing our code this way and clearly separating out the different parts\nof the application, it becomes much easier for us and other developers to know\nwhere to add new code when it's time to build onto or modify our app.\n\n\u003e **Note**: This file structure also closely mirrors the structure of a typical\n\u003e Rails application, as you'll see in the next phase!\n\n\n## Resources\n\n- [Separation of concerns][soc]\n- [Model-View-Controller pattern][mvc]\n- [Rerun gem][rerun]\n\n[soc]: https://en.wikipedia.org/wiki/Separation_of_concerns\n[rerun]: https://github.com/alexch/rerun\n[mvc]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonkinyua%2Fruby-sinatra-application-structure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwilsonkinyua%2Fruby-sinatra-application-structure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwilsonkinyua%2Fruby-sinatra-application-structure/lists"}