{"id":19657489,"url":"https://github.com/butlerlogic/firebase-api","last_synced_at":"2025-06-22T01:34:43.765Z","repository":{"id":98891188,"uuid":"207032782","full_name":"ButlerLogic/firebase-api","owner":"ButlerLogic","description":"A boilerplate structure for building an HTTP API using Firebase functions.","archived":false,"fork":false,"pushed_at":"2020-03-19T01:58:00.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-03T14:41:18.112Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/ButlerLogic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":["coreybutler"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-09-07T22:30:22.000Z","updated_at":"2020-03-19T01:57:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"76a0dd2f-3b28-48fb-9968-49af7e50a84d","html_url":"https://github.com/ButlerLogic/firebase-api","commit_stats":{"total_commits":47,"total_committers":1,"mean_commits":47.0,"dds":0.0,"last_synced_commit":"a75b4f33ab7e7bcd7ae87aa7692bc5c7e4ae0bda"},"previous_names":[],"tags_count":1,"template":true,"template_full_name":null,"purl":"pkg:github/ButlerLogic/firebase-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButlerLogic%2Ffirebase-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButlerLogic%2Ffirebase-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButlerLogic%2Ffirebase-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButlerLogic%2Ffirebase-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ButlerLogic","download_url":"https://codeload.github.com/ButlerLogic/firebase-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ButlerLogic%2Ffirebase-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261220732,"owners_count":23126802,"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":"2024-11-11T15:32:28.501Z","updated_at":"2025-06-22T01:34:38.743Z","avatar_url":"https://github.com/ButlerLogic.png","language":"JavaScript","funding_links":["https://github.com/sponsors/coreybutler"],"categories":[],"sub_categories":[],"readme":"# firebase-api\n\nA boilerplate structure for building an HTTP API using Firebase functions.\n\n## Usage\n\n**tldr;** _(but you really should read below - this does ALOT)_\n```sh\nnpm i @butlerlogic/firebase-api -S\nnpm run init\n```\n\n**Installation Instructions**\n\nNavigate to the functions directory in your Firebase project and run `npm i @butlerlogic/firebase-api -S`. This will install the module and add it to the `package.json` file. It will also create a new npm script in the `package.json` file, called `init`.\n\nNext, you can initialize the project with a new boilerplate API. Make sure you understand what will be produced (detailed below). Once you're comfortable, run `npm run init`.\n\nThe `init` command performs the following actions:\n\n## Creates a new `index.js` file\n  The index file is very simple, with very little code. However; it is inceredibly powerful. The code in the file will scan the directory it is in (including any top level directories within the root) looking for files that do not begin with a `_` or `.`. It attempts to load/export each of these files as a firebase function.\n  \n  This approach allows developers to organize code into directories however desired.\n\n## Creates `api/routess.js` file\n  This file contains an express configuration, including an example endpoint that will run.\n  \n  You'll also notice a [Common API](https://www.npmjs.com/package/@ecor/common-api) module is preconfigured and applied. This provides rudimentary API endpoints, such as `/ping`, `/version`, and `/info`. It also applies an open CORS policy to make development easy, which you'll most likely want to modify before moving to production if you want strict CORS enforcement (fine to leave as is for most API's).\n  \n  The common API provides a number of rapid prototyping methods that can be used in development and production. It's strongly advised you read about what is possible (mostly because it's really easy).\n\n## Creates `.firebase_credentials.json` _if no credential file can be found_.\n  Running some Firebase functions locally does not require the use of credentials, but you'll need them if you want to connect to the production FireStore database or other features while you're working locally. This file should only be loaded when running the emulator _locally_ and it should **never be commited to git or any part of Firebase**. This module will automatically load the credentials file for you when running the emulator and skip it in when deployed (because the hosted version automatically loads your credentials). This file is referenced in the `env.json` file (see below). If you have a different credential file, make sure to modify the `env.json` file to reflect the appropriate path.\n\n## Creates `env.json` file\n  This module leverages [localenvironment](https://github.com/coreybutler/localenvironment) to simplify environment management. By default, this will load an environment variable this module understands/respects when running Firebase functions in the local emulator.\n\n## Creates npm commands:\n  Several commands are created automatically, using the [@butlerlogic/firebase](https://github.com/butlerlogic/firebase) CLI utility:\n  \n  - `npm run setup`: Parses the API code for all references to `functions.config()` and reverse engineers an appropriate `.runtimeconfig.json` from the code. You will need to fill in the appropriate values. This append `.runtimeconfig.json` if it already exists. This is most useful when trying to find out which environment variables are used within the code base, or when starting work on an existing project.\n  - `npm run configure`: This will configure the environment variables on the Firebase server using the values found in the `.runtimeconfig.json` file.\n  - `npm run configure:debug`: Same as above, but it will print the configuration command to the screen in plaintext. THIS MAY EXPOSE SENSISTIVE CONTENT, so don't use this on a CI server or other remote environment. Only use it when working on your local workstation.\n  - `npm run deploy`: This runs the configure function, then the firebase deploy command (functions only).\n\n## Adds required dependencies:\n  Firebase requires certain dependencies to exist in order to run functions locally. These are automatically added to the `package.json` file if they do not already exist.\n\n## Runs `npm install`\n  Since new dependencies are added, a final npm installation is executed to assure all necessary dependencies exist.\n\n---\n\nWith an initialized project, you can immediately start experimenting with the API by modifying the `api/routes.js` file and running `npm start` to launch the local Firebase function emulator.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbutlerlogic%2Ffirebase-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbutlerlogic%2Ffirebase-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbutlerlogic%2Ffirebase-api/lists"}