{"id":28160974,"url":"https://github.com/pachacamac/busker","last_synced_at":"2025-05-15T10:15:20.091Z","repository":{"id":18533729,"uuid":"21734372","full_name":"pachacamac/busker","owner":"pachacamac","description":"An extremely simple web framework.","archived":false,"fork":false,"pushed_at":"2019-10-28T14:44:29.000Z","size":28,"stargazers_count":165,"open_issues_count":0,"forks_count":13,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-13T07:48:55.335Z","etag":null,"topics":["embeddable","framework","ruby","sinatra","tiny"],"latest_commit_sha":null,"homepage":null,"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/pachacamac.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-11T11:46:47.000Z","updated_at":"2023-07-30T23:11:13.000Z","dependencies_parsed_at":"2022-09-13T11:00:55.660Z","dependency_job_id":null,"html_url":"https://github.com/pachacamac/busker","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachacamac%2Fbusker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachacamac%2Fbusker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachacamac%2Fbusker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pachacamac%2Fbusker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pachacamac","download_url":"https://codeload.github.com/pachacamac/busker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254319633,"owners_count":22051077,"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":["embeddable","framework","ruby","sinatra","tiny"],"created_at":"2025-05-15T10:15:19.760Z","updated_at":"2025-05-15T10:15:20.066Z","avatar_url":"https://github.com/pachacamac.png","language":"Ruby","readme":"# Busker :walking::notes:\n\nAn extremely simple web framework. It's called Busker as a reference to\nSinatra. It mimics Sinatra in some aspects while still trying to stay a\ntrue wanderer of the streets.\n\nFeatured in the German [Linux Magazin](http://www.linux-magazin.de/Ausgaben/2014/10/Einfuehrung3) for some reason O.o\n\n[![Gem Version](https://badge.fury.io/rb/busker.svg)](http://badge.fury.io/rb/busker) ![Installs](http://img.shields.io/gem/dt/busker.svg) [![security](https://hakiri.io/github/pachacamac/busker/master.svg)](https://hakiri.io/github/pachacamac/busker/master)\n\n## Design principles :page_with_curl:\n\n* Small code base that is easily understandable, hackable and embeddable\n* No dependencies except what is in the Ruby Standard Lib\n* Backward compatibility to older Ruby versions\n* Ease of use / Some minor resemblance to Sinatra, hence the name\n* It's not meant as a complete web framework but concentrates on the basics\n\n## Installation :floppy_disk:\n\nAdd this line to your application's Gemfile:\n\n    gem 'busker'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install busker\n\nOr copy the code into your project ... it's tiny!\n\n## Usage :boom:\n\n```ruby\nrequire 'busker'\n\nBusker::Busker.new do\n\n  # minimal route definition\n  route '/' do\n    \"Busker version: #{Busker::VERSION}\"\n  end\n  \n  # respond to multiple HTTP methods, overwrite response content_type\n  route '/info', [:GET, :POST, :PUT, :DELETE] do |params, request, response|\n    response.content_type = 'text/plain'\n    request.inspect\n  end\n\n  # usage of URL params, render template with variable\n  route '/template', :GET do |params|\n    @title = params[:title] || 'no title'\n    if params[:external]\n      render './template.erb'\n    else\n      render :template\n    end\n  end\n  \n  # render another layout than the default\n  route '/alt_layout', :GET do |params|\n    render :template, :layout =\u003e :another_layout\n  end\n  \n  # usage of dynamic route params\n  route '/item/:id' do |params|\n    \"requested item with id: #{params[:id]}\"\n  end\n\n  # list all defined routes\n  route '/routes', :GET do |params, request, response|\n    response.content_type = 'text/plain'\n    @_[:routes].keys.map{|k| \"#{k[:methods].join('/')} #{k[:path]}\"}.join(\"\\n\")\n  end\n\n  # implicit route definitions\n  route :implicit\n  route '/implicit/something'\n\nend.start # notice the call to start\n\n# inline templates like in Sinatra\n__END__\n@@ layout\n\u003cheader\u003eHeader\u003c/header\u003e\n\u003c%= yield %\u003e\n\u003cfooter\u003eFooter\u003c/footer\u003e\n\n@@ another_layout\n\u003cdiv class=\"batman\"\u003e\u003c%= yield %\u003e\u003c/div\u003e\n\n@@ template\n\u003ch1\u003e\u003c%= @title %\u003e\u003c/h1\u003e\n\n@@ /implicit\n\u003ch1\u003e\u003c%= @params.inspect %\u003e\u003c/h1\u003e\n\n@@ /implicit/something\n\u003ch1\u003e\u003c%= @request.inspect %\u003e\u003c/h1\u003e\n\n```\n\n## Questions :grey_question:\n\n### Why not use Sinatra?\n\nSinatra is about 2000 lines of code (nothing you would directly, as in copy the code, embed in your single-file project) while Busker is less than 50 lines of code. Plus Sinatra depends on Rack and Tilt. Both external Gems while one of Buskers design principles is to only rely on modules that are within the Ruby Standard Library.\n\nThis makes it literally small and deployable enough to be used in a tiny single file project. This is great for toy projects, educational purposes, payloads, embedded projects ...\n\nBut that all being said, you should probably use Rails or Sinatra for your project.\n\n### When shouldn't I use Busker?\n\n**I wouldn't consider Busker to be \"production ready\" by any means. (WEBrick is not the smartest choice for production environments!)** It's something to play around and have fun with. I haven't made exhaustive benchmarks or in depths security checks. And I would love to get honest, constructive opinions (considering the design principles).\n\n### When should I use Busker?\n\nYou find yourself hacking a tiny dirty little web app on your Raspberry Pi and getting annoyed by using only Webrick but not annoyed enough to setup a good Ruby environment and install Sinatra. Or you might have a weird fascination for single file projects that just run with minimal effort. Busker is your best buddy now. Lots of convenience and syntactic sugar for almost no cost.\n\n## TODO / Ideas :bulb:\n\n* More tests! (especially integration tests with Capybara)\n* Improve render method, allow yield etc\n* Improve error handling, honor production/development environment?\n* Auto reload?\n* A fork that doesn't need WEBrick?\n* Anything cool that doesn't break the design principles ...\n\n## Contributing :construction:\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Don't forget to write- and run tests for your new feature (run rspec)!\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create a new Pull Request\n\nOr just use GitHubs on page editing ...\nit will do all of the above for you and is reasonable given the size of the source.\nMake sure to add an explanation though!\n","funding_links":[],"categories":["Web framework for Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpachacamac%2Fbusker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpachacamac%2Fbusker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpachacamac%2Fbusker/lists"}