{"id":13401304,"url":"https://github.com/thomasp85/fiery","last_synced_at":"2025-05-15T09:07:35.599Z","repository":{"id":66336284,"uuid":"61149478","full_name":"thomasp85/fiery","owner":"thomasp85","description":"A flexible and lightweight web server","archived":false,"fork":false,"pushed_at":"2025-04-01T12:25:56.000Z","size":4341,"stargazers_count":250,"open_issues_count":8,"forks_count":13,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-04-11T19:56:14.340Z","etag":null,"topics":["http-server","httpuv","rstats","webserver","websocket-server"],"latest_commit_sha":null,"homepage":"https://fiery.data-imaginist.com","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomasp85.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2016-06-14T19:18:01.000Z","updated_at":"2025-04-08T10:46:04.000Z","dependencies_parsed_at":"2024-06-21T05:42:42.184Z","dependency_job_id":"50c5ba2e-b1e6-4315-913c-b57d5a10f0f3","html_url":"https://github.com/thomasp85/fiery","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Ffiery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Ffiery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Ffiery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasp85%2Ffiery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasp85","download_url":"https://codeload.github.com/thomasp85/fiery/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254310515,"owners_count":22049469,"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":["http-server","httpuv","rstats","webserver","websocket-server"],"created_at":"2024-07-30T19:01:01.168Z","updated_at":"2025-05-15T09:07:30.589Z","avatar_url":"https://github.com/thomasp85.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, echo = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"README-\"\n)\n```\n\n\u003cimg src=\"man/figures/fiery.png\"/\u003e\n\n\u003c!-- badges: start --\u003e\n[![R-CMD-check](https://github.com/thomasp85/fiery/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/thomasp85/fiery/actions/workflows/R-CMD-check.yaml)\n[![CRAN status](https://www.r-pkg.org/badges/version/fiery)](https://CRAN.R-project.org/package=fiery)\n[![Codecov test coverage](https://codecov.io/gh/thomasp85/fiery/graph/badge.svg)](https://app.codecov.io/gh/thomasp85/fiery)\n\u003c!-- badges: end --\u003e\n\nFiery is a flexible and lightweight framework for building web servers in R. It\nis relatively unopinionated about how you chose to build your server logic and\nsupports many use cases, from serving static files to being used as a base for a\nmodel-view-controller based setup.\n\n## How to install this\nInstall the release from CRAN using `install.packages('fiery')` or get the\ndevelopment version directly from GitHub using `pak`:\n\n```{r, eval=FALSE}\n# install.packages('pak')\npak::pak('thomasp85/fiery')\n```\n\n## Design\nFiery is designed around a clear server life-cycle with events being triggered\nat specific points during the life-cycle that will call the handlers attached to\nthese events. In addition to the life-cycle events, it is possible to trigger\ncustom events and attach handlers to these as well. Fiery is designed with\nmodularity in mind so that plugins can be developed for different tasks and\nmixed and matched to suit the specific project.\n\nWhile the intro might indicate that fiery is difficult to use, this is not the\ncase. Much of the hard work of handling http requests has been encapsulated in\nthe [`reqres`](https://github.com/thomasp85/reqres) that fiery uses to handle\nhttp requests and responses. Further, A plugin that will often be used\nis [`routr`](https://github.com/thomasp85/routr), which provides powerful routing\nof HTTP requests, thus simplifying the server logic even more.\n\n## A minimal example\nFollowing is a very *Hello World*-ish example of a fiery app (sans `routr`),\nthat showcases some of the different life-cycle events:\n\n```{r}\nlibrary(fiery)\n\n# Create a New App\napp \u003c- Fire$new()\n\n# Setup the data every time it starts\napp$on('start', function(server, ...) {\n    server$set_data('visits', 0)\n    server$set_data('cycles', 0)\n})\n\n# Count the number of cycles (internal loops)\napp$on('cycle-start', function(server, ...) {\n    server$set_data('cycles', server$get_data('cycles') + 1)\n})\n\n# Count the number of requests\napp$on('before-request', function(server, ...) {\n    server$set_data('visits', server$get_data('visits') + 1)\n})\n\n# Handle requests\napp$on('request', function(server, request, ...) {\n    response \u003c- request$respond()\n    response$status \u003c- 200L\n    response$body \u003c- paste0('\u003ch1\u003eThis is indeed a test. You are number ', server$get_data('visits'), '\u003c/h1\u003e')\n    response$type \u003c- 'html'\n})\n\n# Show number of requests in the console\napp$on('after-request', function(server, ...) {\n    message(server$get_data('visits'))\n    flush.console()\n})\n\n# Terminate the server after 50 cycles\napp$on('cycle-end', function(server, ...) {\n    if (server$get_data('cycles') \u003e 50) {\n        message('Ending...')\n        flush.console()\n        server$extinguish()\n    }\n})\n\n# Be polite\napp$on('end', function(server) {\n    message('Goodbye')\n    flush.console()\n})\n\napp$ignite(showcase = TRUE)\n```\n\nIn general much of the logic will happen in the `request` and `message` handlers\nand you are free to ignore the other life-cycle events if they are not needed.\n\n## Code of Conduct\nPlease note that the 'fiery' project is released with a\n[Contributor Code of Conduct](https://fiery.data-imaginist.com/CODE_OF_CONDUCT.html).\nBy contributing to this project, you agree to abide by its terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasp85%2Ffiery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasp85%2Ffiery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasp85%2Ffiery/lists"}