Contributing To Fastify

    Table Of Contents

    In short, we welcome any type of contribution you are willing to provide. No contribution is too small. We gladly accept contributions such as:

    • Helping others by answering questions in pull requests and
    • Fixing known bugs
    • Reporting previously unknown bugs by opening an issue with a minimal reproduction

    Ground Rules & Expectations

    Before we get started, here are a few things we expect from you (and that you should expect from others):

    • Be respectful and thoughtful in your conversations around this project. This project is maintained by a diverse set of people from all across the globe. Each person has their own views and opinions about the project. Try to listen to each other and reach an agreement or compromise.
    • We have a Code of Conduct. You must adhere to it to participate in this project.
    • If you open a pull request, please ensure that your contribution passes all tests. If there are test failures, you will need to address them before we can merge your contribution.

    If you’d like to contribute, start by searching through the and pull requests to see whether someone else has raised a similar idea or question.

    If you don’t see your idea listed, and you think it fits into the goals of this guide, do one of the following:

    • If your contribution is minor, such as a typo fix, open a pull request.
    • If your contribution is major, such as a new feature, start by opening an issue first. That way, other people can weigh in on the discussion before you do any work.

    Setting Up Your Environment

    What follows is how to use Visual Studio Code (VSCode) portable to create a Fastify specific environment. This guide is written as if you are setting up the environment on macOS, but the principles are the same across all platforms. See the previously linked VSCode portable guide for help with other platforms.

    First, and unpackage it to . Upon doing so, the following should output “found” when run in a terminal:

    As mentioned in the VSCode portable guide, we need to unsandbox the application for the portable mode to work correctly. So issue the following in a terminal:

    1. xattr -dr com.apple.quarantine /Applications/VSCodeFastify/Visual\ Studio\ Code.app

    Next, create the required data directories for VSCode:

    1. mkdir -p /Applications/VSCodeFastify/code-portable-data/{user-data,extensions}

    Before continuing, we need to add the code command to your terminal’s PATH. To do so, we will manually add VSCode to the PATH. As outlined in that document, the instructions vary depending on your default shell, so you should follow the instructions in that guide as relates to your preferred shell. However, we will tweak them slightly by defining an alias instead of a direct reference to the code tool. This is so we do not conflict with any other installation of VSCode you may have, and to keep this guide specific to Fastify. So, ultimately, we want the following:

    1. code-fastify --version
    2. 1.50.0
    3. 93c2f0fbf16c5a4b10e4d5f89737d9c2c25488a3

    Now that VSCode is installed, and we can work with it via the command line, we need to install an extension that will aid in keeping any JavaScript you write for the project formatted according to the project’s style:

    1. code-fastify --install-extension dbaeumer.vscode-eslint

    Upon successful execution of the previous command, the following command should result in “found” being output:

    Now, from within the directory of your local clone of the Fastify project, we can open VSCode:

    1. code-fastify .

    A new VSCode window should open and you should see the Fastify project files in the left sidebar. But wait! We are not quite done yet. There are a few more baseline settings that should be set before VSCode is ready.

    Press cmd+shift+p to bring up the VSCode command input prompt. Type open settings (json) and then choose the same item from the filtered menu. This will open a document that is the settings for the editor. Paste the following JSON into this document, overwriting any text already present, and save it:

    1. {
    2. "[javascript]": {
    3. "editor.defaultFormatter": "dbaeumer.vscode-eslint",
    4. "editor.codeActionsOnSave": {
    5. "source.fixAll": true
    6. },
    7. "workbench.colorCustomizations": {
    8. "statusBar.background": "#178bb9"
    9. }

    At this point, you are all setup with a custom VSCode instance that can be used to work on Fastify contributions. As you edit and save JavaScript files, the editor will autocorrect any style issues.