{"id":42672394,"url":"https://github.com/lajule/bfa","last_synced_at":"2026-01-29T11:02:59.411Z","repository":{"id":150189642,"uuid":"232195281","full_name":"Lajule/bfa","owner":"Lajule","description":"Build some Blazing Fast APIs","archived":false,"fork":false,"pushed_at":"2020-06-12T17:58:21.000Z","size":16,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-02T02:34:14.477Z","etag":null,"topics":["docker","docker-compose","nginx","openresty"],"latest_commit_sha":null,"homepage":"","language":"Lua","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/Lajule.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":"2020-01-06T22:16:57.000Z","updated_at":"2020-09-18T16:34:57.000Z","dependencies_parsed_at":"2023-04-08T23:32:17.246Z","dependency_job_id":null,"html_url":"https://github.com/Lajule/bfa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Lajule/bfa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lajule%2Fbfa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lajule%2Fbfa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lajule%2Fbfa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lajule%2Fbfa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lajule","download_url":"https://codeload.github.com/Lajule/bfa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lajule%2Fbfa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28876674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-29T10:31:27.438Z","status":"ssl_error","status_checked_at":"2026-01-29T10:31:01.017Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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","docker-compose","nginx","openresty"],"created_at":"2026-01-29T11:02:24.749Z","updated_at":"2026-01-29T11:02:59.403Z","avatar_url":"https://github.com/Lajule.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"bfa\n===\n\nBuild some Blazing Fast APIs, An [OpenResty][1] starter kit to write pure\n[Lua][2] APIs.\n\nNo framework ! Forget about your favorite framework, forget about Flask,\nExpress or even Sinatra, here the HTTP requests are handled directly in\n[nginx][3] by executing [Lua][2] scripts.\n\nGetting started\n---------------\n\nFirst you need [OpenResty][1] to be installed, then you can launch [nginx][3]\nwith :\n\n```shell\nopenresty -p . -c conf/nginx.conf\n```\n\nConfiguration\n-------------\n\nEverything is contained into the [nginx configuration file](conf/nginx.conf) :\n\n```nginx\nworker_processes 1;\n\nerror_log logs/error.log info;\n\nevents {\n    worker_connections 1024;\n}\n\nhttp {\n    charset      utf-8;\n    default_type application/json;\n\n    # Docker DNS\n    resolver 127.0.0.11;\n\n    lua_package_path  '${prefix}lua/?.lua;;';\n    lua_package_cpath '${prefix}lua/?.so;;';\n\n    server {\n        listen 8080;\n\n        # Docker Compose services\n        set $redis_host        redis;\n        set $redis_port        6379;\n        set $postgres_host     postgres;\n        set $postgres_port     5432;\n        set $postgres_database bfa;\n        set $postgres_user     bfa;\n        set $postgres_password bfa;\n\n        location / {\n            content_by_lua_file lua/bootstrap.lua;\n        }\n    }\n}\n```\n\n\u003e If you work outside Docker Compose, pay attention to `resolver` directive and\n\u003e \"Docker Compose services\" variables, you'll probably have to modify these\n\u003e values according to your environment.\n\nDocker\n------\n\nA [Dockerfile](Dockerfile) is provided to build a Docker image of the API :\n\n```shell\ndocker build -t bfa .\n```\n\u003e Note that :\n\u003e * The Docker image is based on the [OpenResty Official Docker Image][4]\n\u003e * OPM dependencies are installed during the building process (See below)\n\nOnce the Docker image is built, start the container with the following command :\n\n```shell\ndocker run -it --rm -p 8080:8080 bfa\n```\n\nDocker Compose\n--------------\n\nA [docker-compose.yml](docker-compose.yml) file is also provided to orchestrate\nthree containers :\n\n* The API (See above)\n* A PostgreSQL database\n* A Redis server\n\nTake a look at the following component diagram :\n\n![Docker Compose services](http://www.plantuml.com/plantuml/png/SoWkIImgAStDuIf8JCvEJ4zLK7B9JyvEBL9mpiyjo2zELLAevb9GYFPpz_IBY0MnWb9JCej1h9J4aiIan6AWZe3yufBqejHYY5gWcgIqH92AMgvQhkIS_D8KY1cP1PbvQVbwcVcnG76Fa9001LqxkCbGMa4NA0Qn0qKCR2QA28fv3gbvAK1F0000)\n\nTo start the environment, simply run :\n\n```shell\ndocker-compose up -d --build\n```\n\n\u003e The Docker image of the API is built before start due to `--build` option.\n\nOPM\n---\n\nTwo libraries are installed during the Docker image building process :\n\n* [lua-resty-http][5] : An HTTP Client\n* [pgmoon][6] : A PostgreSQL driver\n\nExample routes\n--------------\n\nThis stater kit comes with some example routes to demonstrate the usage of\nlibraries :\n\nRoute | Description | Script\n----- | ----------- | ------\n/ip | Call an external service | [ip.lua](lua/ip.lua)\n/kv | Get or set a value in Redis | [kv.lua](lua/kv.lua)\n/articles | CRUD operations on PostgreSQL resource | [articles.lua](lua/articles.lua)\n\n\u003e Routes are defined in [routes.lua](lua/routes.lua) script.\n\n[1]: https://github.com/openresty\n[2]: http://www.lua.org\n[3]: https://nginx.org\n[4]: https://hub.docker.com/r/openresty/openresty\n[5]: https://github.com/ledgetech/lua-resty-http\n[6]: https://github.com/leafo/pgmoon\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flajule%2Fbfa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flajule%2Fbfa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flajule%2Fbfa/lists"}