fastify 4.0.0-rc.4 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/.markdownlint-cli2.yaml +22 -0
  2. package/GOVERNANCE.md +30 -20
  3. package/PROJECT_CHARTER.md +48 -17
  4. package/README.md +164 -77
  5. package/SECURITY.md +55 -44
  6. package/build/build-error-serializer.js +11 -7
  7. package/build/build-validation.js +12 -2
  8. package/docs/Guides/Benchmarking.md +2 -0
  9. package/docs/Guides/Delay-Accepting-Requests.md +98 -90
  10. package/docs/Guides/Ecosystem.md +48 -38
  11. package/docs/Guides/Index.md +3 -1
  12. package/docs/Guides/Migration-Guide-V3.md +1 -1
  13. package/docs/Guides/Migration-Guide-V4.md +55 -0
  14. package/docs/Guides/Plugins-Guide.md +3 -3
  15. package/docs/Guides/Prototype-Poisoning.md +1 -1
  16. package/docs/Guides/Recommendations.md +2 -2
  17. package/docs/Guides/Serverless.md +17 -16
  18. package/docs/Guides/Write-Plugin.md +3 -3
  19. package/docs/Reference/ContentTypeParser.md +17 -13
  20. package/docs/Reference/Errors.md +6 -5
  21. package/docs/Reference/Middleware.md +3 -3
  22. package/docs/Reference/Plugins.md +8 -6
  23. package/docs/Reference/Reply.md +30 -16
  24. package/docs/Reference/Request.md +3 -3
  25. package/docs/Reference/Routes.md +113 -38
  26. package/docs/Reference/Server.md +129 -68
  27. package/docs/Reference/Type-Providers.md +28 -8
  28. package/docs/Reference/TypeScript.md +13 -7
  29. package/docs/Reference/Validation-and-Serialization.md +47 -35
  30. package/fastify.d.ts +1 -1
  31. package/fastify.js +36 -13
  32. package/lib/configValidator.js +402 -307
  33. package/lib/error-serializer.js +32 -204
  34. package/lib/errors.js +4 -0
  35. package/lib/pluginUtils.js +10 -0
  36. package/lib/route.js +2 -1
  37. package/lib/schemas.js +3 -0
  38. package/lib/validation.js +4 -2
  39. package/package.json +34 -32
  40. package/test/close-pipelining.test.js +4 -2
  41. package/test/close.test.js +93 -3
  42. package/test/custom-http-server.test.js +22 -0
  43. package/test/internals/initialConfig.test.js +0 -2
  44. package/test/output-validation.test.js +6 -2
  45. package/test/plugin.test.js +191 -0
  46. package/test/schema-serialization.test.js +57 -0
  47. package/test/types/logger.test-d.ts +13 -1
  48. package/test/types/type-provider.test-d.ts +6 -0
  49. package/types/logger.d.ts +3 -1
  50. package/types/schema.d.ts +1 -1
  51. package/types/type-provider.d.ts +2 -3
  52. package/docs/Migration-Guide-V4.md +0 -12
@@ -0,0 +1,22 @@
1
+ # See https://github.com/DavidAnson/markdownlint-cli2
2
+ config:
3
+ # Disable all rules by default.
4
+ default: false
5
+
6
+ # Enforce line length.
7
+ MD013:
8
+ line_length: 80
9
+ code_block_line_length: 120
10
+ headers: false
11
+ tables: false
12
+ strict: false
13
+ stern: false
14
+
15
+ globs:
16
+ - '**/*.md'
17
+
18
+ ignores:
19
+ - 'node_modules/**'
20
+ - 'test/**/*.md'
21
+
22
+ noProgress: true
package/GOVERNANCE.md CHANGED
@@ -14,9 +14,10 @@
14
14
 
15
15
  ## Lead Maintainers
16
16
 
17
- Fastify Lead Maintainers are the founder of the project and the organization owners.
18
- They are the only members of the `@fastify/leads` team.
19
- The Lead Maintainers are the curator of the Fastify project and their key responsibility is to issue releases of Fastify and its dependencies.
17
+ Fastify Lead Maintainers are the founder of the project and the organization
18
+ owners. They are the only members of the `@fastify/leads` team. The Lead
19
+ Maintainers are the curator of the Fastify project and their key responsibility
20
+ is to issue releases of Fastify and its dependencies.
20
21
 
21
22
  ## Collaborators
22
23
 
@@ -40,9 +41,9 @@ Collaborators have:
40
41
  * Grant to release new versions of the project
41
42
 
42
43
  Both Collaborators and non-Collaborators may propose changes to the source code
43
- of the projects of the organization.
44
- The mechanism to propose such a change is a GitHub pull request.
45
- Collaborators review and merge (_land_) pull requests following the [CONTRIBUTING](CONTRIBUTING.md#rules) guidelines.
44
+ of the projects of the organization. The mechanism to propose such a change is a
45
+ GitHub pull request. Collaborators review and merge (_land_) pull requests
46
+ following the [CONTRIBUTING](CONTRIBUTING.md#rules) guidelines.
46
47
 
47
48
  ### Collaborator activities
48
49
 
@@ -53,43 +54,52 @@ Collaborators review and merge (_land_) pull requests following the [CONTRIBUTIN
53
54
  * Merging pull requests
54
55
  * Release plugins
55
56
 
56
- The Lead Maintainers can remove inactive Collaborators or provide them with _Past Collaborators_
57
- status. Past Collaborators may request that the Lead Maintainers restore them to active status.
57
+ The Lead Maintainers can remove inactive Collaborators or provide them with
58
+ _Past Collaborators_ status. Past Collaborators may request that the Lead
59
+ Maintainers restore them to active status.
58
60
 
59
61
 
60
62
  ## Great Contributors
61
63
 
62
- Great contributors on a specific area in the Fastify ecosystem will be invited to join this group by Lead Maintainers.
63
- This group has the same permissions of a contributor.
64
+ Great contributors on a specific area in the Fastify ecosystem will be invited
65
+ to join this group by Lead Maintainers. This group has the same permissions of a
66
+ contributor.
64
67
 
65
68
  ## Collaborator nominations
66
69
 
67
- Individuals making significant and valuable contributions to the project may be a candidate to join the Fastify organization.
70
+ Individuals making significant and valuable contributions to the project may be
71
+ a candidate to join the Fastify organization.
68
72
 
69
- A Collaborator needs to open a private team discussion on GitHub and list the candidates
70
- they want to sponsor with a link to the user's contributions. For example:
73
+ A Collaborator needs to open a private team discussion on GitHub and list the
74
+ candidates they want to sponsor with a link to the user's contributions. For
75
+ example:
71
76
 
72
- * Activities in the Fastify organization `[USERNAME](https://github.com/search?q=author:USERNAME+org:fastify)`
77
+ * Activities in the Fastify organization
78
+ `[USERNAME](https://github.com/search?q=author:USERNAME+org:fastify)`
73
79
 
74
- Otherwise, a Contributor may self-apply if they believe they meet the above criteria by reaching out
75
- to a Lead Maintainer privately with the links to their valuable contributions.
76
- The Lead Maintainers will reply to the Contributor and will decide if candidate it to be made a collaborator.
80
+ Otherwise, a Contributor may self-apply if they believe they meet the above
81
+ criteria by reaching out to a Lead Maintainer privately with the links to their
82
+ valuable contributions. The Lead Maintainers will reply to the Contributor and
83
+ will decide if candidate it to be made a collaborator.
77
84
 
78
85
  The consensus to grant a new candidate Collaborator status is reached when:
79
86
 
80
87
  - at least one of the Lead Maintainers approve
81
88
  - at least two of the Team Members approve
82
89
 
83
- After these conditions are satisfied, the [onboarding process](CONTRIBUTING.md#onboarding-collaborators) may start.
90
+ After these conditions are satisfied, the [onboarding
91
+ process](CONTRIBUTING.md#onboarding-collaborators) may start.
84
92
 
85
93
 
86
94
  ## Lead Maintainers nominations
87
95
 
88
- A Team Member may be promoted to a Lead Maintainers only through nomination by a Lead maintainer and with agreement from the rest of Lead Maintainers.
96
+ A Team Member may be promoted to a Lead Maintainers only through nomination by a
97
+ Lead maintainer and with agreement from the rest of Lead Maintainers.
89
98
 
90
99
 
91
100
  ## Consensus seeking process
92
101
 
93
102
  The Fastify organization follows a [Consensus Seeking][] decision-making model.
94
103
 
95
- [Consensus Seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
104
+ [Consensus Seeking]:
105
+ https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
@@ -1,20 +1,26 @@
1
1
  # Fastify Charter
2
2
 
3
- The Fastify project aims to build a fast and low overhead web framework for Node.js.
3
+ The Fastify project aims to build a fast and low overhead web framework for
4
+ Node.js.
4
5
 
5
6
 
6
7
  ## Section 0: Guiding Principles
7
8
 
8
- The Fastify project is part of the [OpenJS Foundation][openjs foundation]. It operates transparently, openly, collaboratively, and ethically. Project proposals, timelines, and status must not merely be open, but also easily visible to outsiders.
9
+ The Fastify project is part of the [OpenJS Foundation][openjs foundation]. It
10
+ operates transparently, openly, collaboratively, and ethically. Project
11
+ proposals, timelines, and status must not merely be open, but also easily
12
+ visible to outsiders.
9
13
 
10
14
 
11
15
  ## Section 1: Scope
12
16
 
13
- Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a plugin architecture.
17
+ Fastify is a web framework highly focused on providing the best developer
18
+ experience with the least overhead and a plugin architecture.
14
19
 
15
20
  ### 1.1: In-scope
16
21
 
17
- + Develop a web framework for Node.js with a focus on developer experience, performance and extensibility.
22
+ + Develop a web framework for Node.js with a focus on developer experience,
23
+ performance and extensibility.
18
24
  + Plugin Architecture
19
25
  + Support web protocols
20
26
  + Official plugins for common user requirements
@@ -42,9 +48,21 @@ Fastify is a web framework highly focused on providing the best developer experi
42
48
 
43
49
  ## Section 2: Relationship with OpenJS Foundation CPC.
44
50
 
45
- Technical leadership for the projects within the [OpenJS Foundation][openjs foundation] is delegated to the projects through their project charters by the [OpenJS Foundation Cross-Project Council](https://openjsf.org/about/governance/) (CPC). In the case of the Fastify project, it is delegated to the [Fastify Collaborators](README.md#team). The OpenJS Foundation's business leadership is the Board of Directors (the "Board").
51
+ Technical leadership for the projects within the [OpenJS Foundation][openjs
52
+ foundation] is delegated to the projects through their project charters by the
53
+ [OpenJS Foundation Cross-Project Council](https://openjsf.org/about/governance/)
54
+ (CPC). In the case of the Fastify project, it is delegated to the [Fastify
55
+ Collaborators](README.md#team). The OpenJS Foundation's business leadership is
56
+ the Board of Directors (the "Board").
46
57
 
47
- This Fastify Charter reflects a carefully constructed balanced role for the Collaborators and the CPC in the governance of the OpenJS Foundation. The charter amendment process is for the Fastify Collaborators to propose change using simple majority of the full Fastify Organization, the proposed changes being subject to review and approval by the CPC. The CPC may additionally make amendments to the Collaborators charter at any time, though the CPC will not interfere with day-to-day discussions, votes or meetings of the Fastify Organization.
58
+ This Fastify Charter reflects a carefully constructed balanced role for the
59
+ Collaborators and the CPC in the governance of the OpenJS Foundation. The
60
+ charter amendment process is for the Fastify Collaborators to propose change
61
+ using simple majority of the full Fastify Organization, the proposed changes
62
+ being subject to review and approval by the CPC. The CPC may additionally make
63
+ amendments to the Collaborators charter at any time, though the CPC will not
64
+ interfere with day-to-day discussions, votes or meetings of the Fastify
65
+ Organization.
48
66
 
49
67
 
50
68
  ### 2.1 Other Formal Project Relationships
@@ -54,12 +72,14 @@ Section Intentionally Left Blank
54
72
 
55
73
  ## Section 3: Fastify Governing Body
56
74
 
57
- Fastify is governed by its [maintainers](README.md#team). See [how it is structured](GOVERNANCE.md) for more information.
75
+ Fastify is governed by its [maintainers](README.md#team). See [how it is
76
+ structured](GOVERNANCE.md) for more information.
58
77
 
59
78
 
60
- ## Section 4: Roles & Responsibilities
79
+ ## Section 4: Roles & Responsibilities
61
80
 
62
- The roles and responsibilities of Fastify's maintainers are described in [the project organization](GOVERNANCE.md).
81
+ The roles and responsibilities of Fastify's maintainers are described in [the
82
+ project organization](GOVERNANCE.md).
63
83
 
64
84
  ### Section 4.1 Project Operations & Management
65
85
 
@@ -69,11 +89,11 @@ Section Intentionally Left Blank
69
89
 
70
90
  **Decision-making**
71
91
 
72
- Fastify's features can be discussed in GitHub issues and/or projects.
73
- Consensus on a discussion is reached when there is no objection by any
74
- collaborators.
92
+ Fastify's features can be discussed in GitHub issues and/or projects. Consensus
93
+ on a discussion is reached when there is no objection by any collaborators.
75
94
 
76
- Whenever there is not consensus, Lead Maintainers will have final say on the topic.
95
+ Whenever there is not consensus, Lead Maintainers will have final say on the
96
+ topic.
77
97
 
78
98
  **Voting, and/or Elections**
79
99
 
@@ -85,11 +105,22 @@ Section Intentionally Left Blank
85
105
 
86
106
  ## Section 5: Definitions
87
107
 
88
- + *Contributors*: contribute code or other artifacts, but do not have the right to commit to the code base. Contributors work with the project’s Collaborators to have code committed to the code base. Contributors should rarely be encumbered by the Fastify Collaborators and never by the CPC or OpenJS Foundation Board.
108
+ + *Contributors*: contribute code or other artifacts, but do not have the right
109
+ to commit to the code base. Contributors work with the project’s Collaborators
110
+ to have code committed to the code base. Contributors should rarely be
111
+ encumbered by the Fastify Collaborators and never by the CPC or OpenJS
112
+ Foundation Board.
89
113
 
90
- + *Collaborators*: contribute code and other artifacts, have the right to commit to the code base and release plugins projects. Collaborators follow the [CONTRIBUTING](CONTRIBUTING.md) guidelines to manage the project. A Collaborator could be encumbered by other Fastify Collaborators and never by the CPC or OpenJS Foundation Board.
114
+ + *Collaborators*: contribute code and other artifacts, have the right to commit
115
+ to the code base and release plugins projects. Collaborators follow the
116
+ [CONTRIBUTING](CONTRIBUTING.md) guidelines to manage the project. A
117
+ Collaborator could be encumbered by other Fastify Collaborators and never by
118
+ the CPC or OpenJS Foundation Board.
91
119
 
92
- + *Lead Maintainers*: founders of the project, contribute code and other artifacts, have the right to commit to the code base and release the project. Lead Maintainers follow the [CONTRIBUTING](CONTRIBUTING.md) guidelines to manage the project. A Lead Maintainer will be encumbered by the Fastify Collaborators and by the CPC or OpenJS Foundation Board.
120
+ + *Lead Maintainers*: founders of the project, contribute code and other
121
+ artifacts, have the right to commit to the code base and release the project.
122
+ Lead Maintainers follow the [CONTRIBUTING](CONTRIBUTING.md) guidelines to
123
+ manage the project. A Lead Maintainer will be encumbered by the Fastify
124
+ Collaborators and by the CPC or OpenJS Foundation Board.
93
125
 
94
126
  [openjs foundation]: https://openjsf.org
95
- [Consensus Seeking]: https://en.wikipedia.org/wiki/Consensus-seeking_decision-making
package/README.md CHANGED
@@ -1,21 +1,29 @@
1
1
  <div align="center"> <a href="https://fastify.io/">
2
- <img src="https://github.com/fastify/graphics/raw/HEAD/fastify-landscape-outlined.svg" width="650" height="auto"/>
2
+ <img
3
+ src="https://github.com/fastify/graphics/raw/HEAD/fastify-landscape-outlined.svg"
4
+ width="650"
5
+ height="auto"
6
+ />
3
7
  </a>
4
8
  </div>
5
9
 
6
10
  <div align="center">
7
11
 
8
12
  [![CI](https://github.com/fastify/fastify/workflows/ci/badge.svg)](https://github.com/fastify/fastify/actions/workflows/ci.yml)
9
- [![Package Manager CI](https://github.com/fastify/fastify/workflows/package-manager-ci/badge.svg)](https://github.com/fastify/fastify/actions/workflows/package-manager-ci.yml)
10
- [![Web SIte](https://github.com/fastify/fastify/workflows/website/badge.svg)](https://github.com/fastify/fastify/actions/workflows/website.yml)
13
+ [![Package Manager
14
+ CI](https://github.com/fastify/fastify/workflows/package-manager-ci/badge.svg)](https://github.com/fastify/fastify/actions/workflows/package-manager-ci.yml)
15
+ [![Web
16
+ SIte](https://github.com/fastify/fastify/workflows/website/badge.svg)](https://github.com/fastify/fastify/actions/workflows/website.yml)
11
17
  [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://standardjs.com/)
12
18
 
13
19
  </div>
14
20
 
15
21
  <div align="center">
16
22
 
17
- [![NPM version](https://img.shields.io/npm/v/fastify.svg?style=flat)](https://www.npmjs.com/package/fastify)
18
- [![NPM downloads](https://img.shields.io/npm/dm/fastify.svg?style=flat)](https://www.npmjs.com/package/fastify)
23
+ [![NPM
24
+ version](https://img.shields.io/npm/v/fastify.svg?style=flat)](https://www.npmjs.com/package/fastify)
25
+ [![NPM
26
+ downloads](https://img.shields.io/npm/dm/fastify.svg?style=flat)](https://www.npmjs.com/package/fastify)
19
27
  [![Security Responsible
20
28
  Disclosure](https://img.shields.io/badge/Security-Responsible%20Disclosure-yellow.svg)](https://github.com/fastify/fastify/blob/main/SECURITY.md)
21
29
  [![Discord](https://img.shields.io/discord/725613461949906985)](https://discord.gg/fastify)
@@ -24,8 +32,11 @@ Disclosure](https://img.shields.io/badge/Security-Responsible%20Disclosure-yello
24
32
 
25
33
  <br />
26
34
 
27
- An efficient server implies a lower cost of the infrastructure, a better responsiveness under load and happy users.
28
- How can you efficiently handle the resources of your server, knowing that you are serving the highest number of requests as possible, without sacrificing security validations and handy development?
35
+ An efficient server implies a lower cost of the infrastructure, a better
36
+ responsiveness under load and happy users. How can you efficiently handle the
37
+ resources of your server, knowing that you are serving the highest number of
38
+ requests as possible, without sacrificing security validations and handy
39
+ development?
29
40
 
30
41
  - [Quick start](./README.md#quick-start)
31
42
  - [Install](./README.md#install)
@@ -40,9 +51,13 @@ How can you efficiently handle the resources of your server, knowing that you ar
40
51
  - [Hosted by](./README.md#hosted-by)
41
52
  - [License](./README.md#license)
42
53
 
43
- Enter Fastify. Fastify is a web framework highly focused on providing the best developer experience with the least overhead and a powerful plugin architecture. It is inspired by Hapi and Express and as far as we know, it is one of the fastest web frameworks in town.
54
+ Enter Fastify. Fastify is a web framework highly focused on providing the best
55
+ developer experience with the least overhead and a powerful plugin architecture.
56
+ It is inspired by Hapi and Express and as far as we know, it is one of the
57
+ fastest web frameworks in town.
44
58
 
45
- This branch refers to the upcoming Fastify v4 release. Check out the [v3.x](https://github.com/fastify/fastify/tree/v3.x) branch for v3.
59
+ This branch refers to the upcoming Fastify v4 release. Check out the
60
+ [v3.x](https://github.com/fastify/fastify/tree/v3.x) branch for v3.
46
61
 
47
62
  ### Quick start
48
63
 
@@ -77,13 +92,15 @@ For production mode:
77
92
  npm start
78
93
  ```
79
94
 
80
- Under the hood `npm init` downloads and runs [Fastify Create](https://github.com/fastify/create-fastify),
81
- which in turn uses the generate functionality of [Fastify CLI](https://github.com/fastify/fastify-cli).
95
+ Under the hood `npm init` downloads and runs [Fastify
96
+ Create](https://github.com/fastify/create-fastify), which in turn uses the
97
+ generate functionality of [Fastify CLI](https://github.com/fastify/fastify-cli).
82
98
 
83
99
 
84
100
  ### Install
85
101
 
86
- If installing in an existing project, then Fastify can be installed into the project as a dependency:
102
+ If installing in an existing project, then Fastify can be installed into the
103
+ project as a dependency:
87
104
 
88
105
  Install with npm:
89
106
  ```sh
@@ -145,31 +162,52 @@ fastify.listen({ port: 3000 }, (err, address) => {
145
162
  })
146
163
  ```
147
164
 
148
- Do you want to know more? Head to the <a href="./docs/Guides/Getting-Started.md"><code><b>Getting Started</b></code></a>.
165
+ Do you want to know more? Head to the <a
166
+ href="./docs/Guides/Getting-Started.md"><code><b>Getting Started</b></code></a>.
149
167
 
150
168
 
151
169
  ### Fastify v1.x and v2.x
152
170
 
153
- Code for Fastify's **v1.x** is in [**`branch 1.x`**](https://github.com/fastify/fastify/tree/1.x), so all Fastify 1.x related changes should be based on **`branch 1.x`**.
154
- In a similar way, all Fastify **v2.x** related changes should be based on [**`branch 2.x`**](https://github.com/fastify/fastify/tree/2.x).
171
+ Code for Fastify's **v1.x** is in [**`branch
172
+ 1.x`**](https://github.com/fastify/fastify/tree/1.x), so all Fastify 1.x related
173
+ changes should be based on **`branch 1.x`**. In a similar way, all Fastify
174
+ **v2.x** related changes should be based on [**`branch
175
+ 2.x`**](https://github.com/fastify/fastify/tree/2.x).
155
176
 
156
177
  > ## Note
157
- > `.listen` binds to the local host, `localhost`, interface by default (`127.0.0.1` or `::1`, depending on the operating system configuration). If you are running Fastify in a container (Docker, [GCP](https://cloud.google.com/), etc.), you may need to bind to `0.0.0.0`. Be careful when deciding to listen on all interfaces; it comes with inherent [security risks](https://web.archive.org/web/20170711105010/https://snyk.io/blog/mongodb-hack-and-secure-defaults/).
158
- > See [the documentation](./docs/Reference/Server.md#listen) for more information.
178
+ > `.listen` binds to the local host, `localhost`, interface by default
179
+ > (`127.0.0.1` or `::1`, depending on the operating system configuration). If
180
+ > you are running Fastify in a container (Docker,
181
+ > [GCP](https://cloud.google.com/), etc.), you may need to bind to `0.0.0.0`. Be
182
+ > careful when deciding to listen on all interfaces; it comes with inherent
183
+ > [security
184
+ > risks](https://web.archive.org/web/20170711105010/https://snyk.io/blog/mongodb-hack-and-secure-defaults/).
185
+ > See [the documentation](./docs/Reference/Server.md#listen) for more
186
+ > information.
159
187
 
160
188
  ### Core features
161
189
 
162
- - **Highly performant:** as far as we know, Fastify is one of the fastest web frameworks in town, depending on the code complexity we can serve up to 76+ thousand requests per second.
163
- - **Extendible:** Fastify is fully extensible via its hooks, plugins and decorators.
164
- - **Schema based:** even if it is not mandatory we recommend to use [JSON Schema](https://json-schema.org/) to validate your routes and serialize your outputs, internally Fastify compiles the schema in a highly performant function.
165
- - **Logging:** logs are extremely important but are costly; we chose the best logger to almost remove this cost, [Pino](https://github.com/pinojs/pino)!
166
- - **Developer friendly:** the framework is built to be very expressive and help the developer in their daily use, without sacrificing performance and security.
190
+ - **Highly performant:** as far as we know, Fastify is one of the fastest web
191
+ frameworks in town, depending on the code complexity we can serve up to 76+
192
+ thousand requests per second.
193
+ - **Extendible:** Fastify is fully extensible via its hooks, plugins and
194
+ decorators.
195
+ - **Schema based:** even if it is not mandatory we recommend to use [JSON
196
+ Schema](https://json-schema.org/) to validate your routes and serialize your
197
+ outputs, internally Fastify compiles the schema in a highly performant
198
+ function.
199
+ - **Logging:** logs are extremely important but are costly; we chose the best
200
+ logger to almost remove this cost, [Pino](https://github.com/pinojs/pino)!
201
+ - **Developer friendly:** the framework is built to be very expressive and help
202
+ the developer in their daily use, without sacrificing performance and
203
+ security.
167
204
 
168
205
  ### Benchmarks
169
206
 
170
207
  __Machine:__ EX41S-SSD, Intel Core i7, 4Ghz, 64GB RAM, 4C/8T, SSD.
171
208
 
172
- __Method:__: `autocannon -c 100 -d 40 -p 10 localhost:3000` * 2, taking the second average
209
+ __Method:__: `autocannon -c 100 -d 40 -p 10 localhost:3000` * 2, taking the
210
+ second average
173
211
 
174
212
  | Framework | Version | Router? | Requests/sec |
175
213
  | :----------------- | :------------------------- | :----------: | ------------: |
@@ -182,47 +220,57 @@ __Method:__: `autocannon -c 100 -d 40 -p 10 localhost:3000` * 2, taking the seco
182
220
  | `http.Server` | 16.14.2 | &#10007; | 74,513 |
183
221
 
184
222
  Benchmarks taken using https://github.com/fastify/benchmarks. This is a
185
- synthetic, "hello world" benchmark that aims to evaluate the framework
186
- overhead. The overhead that each framework has on your application
187
- depends on your application, you should __always__ benchmark if performance
188
- matters to you.
223
+ synthetic, "hello world" benchmark that aims to evaluate the framework overhead.
224
+ The overhead that each framework has on your application depends on your
225
+ application, you should __always__ benchmark if performance matters to you.
189
226
 
190
227
  ## Documentation
191
- * <a href="./docs/Guides/Getting-Started.md"><code><b>Getting Started</b></code></a>
228
+ * <a href="./docs/Guides/Getting-Started.md"><code><b>Getting
229
+ Started</b></code></a>
192
230
  * <a href="./docs/Guides/Index.md"><code><b>Guides</b></code></a>
193
231
  * <a href="./docs/Reference/Server.md"><code><b>Server</b></code></a>
194
232
  * <a href="./docs/Reference/Routes.md"><code><b>Routes</b></code></a>
195
- * <a href="./docs/Reference/Encapsulation.md"><code><b>Encapsulation</b></code></a>
233
+ * <a
234
+ href="./docs/Reference/Encapsulation.md"><code><b>Encapsulation</b></code></a>
196
235
  * <a href="./docs/Reference/Logging.md"><code><b>Logging</b></code></a>
197
236
  * <a href="./docs/Reference/Middleware.md"><code><b>Middleware</b></code></a>
198
237
  * <a href="./docs/Reference/Hooks.md"><code><b>Hooks</b></code></a>
199
238
  * <a href="./docs/Reference/Decorators.md"><code><b>Decorators</b></code></a>
200
- * <a href="./docs/Reference/Validation-and-Serialization.md"><code><b>Validation and Serialization</b></code></a>
239
+ * <a href="./docs/Reference/Validation-and-Serialization.md"><code><b>Validation
240
+ and Serialization</b></code></a>
201
241
  * <a href="./docs/Guides/Fluent-Schema.md"><code><b>Fluent Schema</b></code></a>
202
242
  * <a href="./docs/Reference/Lifecycle.md"><code><b>Lifecycle</b></code></a>
203
243
  * <a href="./docs/Reference/Reply.md"><code><b>Reply</b></code></a>
204
244
  * <a href="./docs/Reference/Request.md"><code><b>Request</b></code></a>
205
245
  * <a href="./docs/Reference/Errors.md"><code><b>Errors</b></code></a>
206
- * <a href="./docs/Reference/ContentTypeParser.md"><code><b>Content Type Parser</b></code></a>
246
+ * <a href="./docs/Reference/ContentTypeParser.md"><code><b>Content Type
247
+ Parser</b></code></a>
207
248
  * <a href="./docs/Reference/Plugins.md"><code><b>Plugins</b></code></a>
208
249
  * <a href="./docs/Guides/Testing.md"><code><b>Testing</b></code></a>
209
250
  * <a href="./docs/Guides/Benchmarking.md"><code><b>Benchmarking</b></code></a>
210
- * <a href="./docs/Guides/Write-Plugin.md"><code><b>How to write a good plugin</b></code></a>
251
+ * <a href="./docs/Guides/Write-Plugin.md"><code><b>How to write a good
252
+ plugin</b></code></a>
211
253
  * <a href="./docs/Guides/Plugins-Guide.md"><code><b>Plugins Guide</b></code></a>
212
254
  * <a href="./docs/Reference/HTTP2.md"><code><b>HTTP2</b></code></a>
213
255
  * <a href="./docs/Reference/LTS.md"><code><b>Long Term Support</b></code></a>
214
- * <a href="./docs/Reference/TypeScript.md"><code><b>TypeScript and types support</b></code></a>
256
+ * <a href="./docs/Reference/TypeScript.md"><code><b>TypeScript and types
257
+ support</b></code></a>
215
258
  * <a href="./docs/Guides/Serverless.md"><code><b>Serverless</b></code></a>
216
- * <a href="./docs/Guides/Recommendations.md"><code><b>Recommendations</b></code></a>
259
+ * <a
260
+ href="./docs/Guides/Recommendations.md"><code><b>Recommendations</b></code></a>
217
261
 
218
262
  中文文档[地址](https://github.com/fastify/docs-chinese/blob/HEAD/README.md)
219
263
 
220
264
  ## Ecosystem
221
265
 
222
- - [Core](./docs/Guides/Ecosystem.md#core) - Core plugins maintained by the _Fastify_ [team](#team).
223
- - [Community](./docs/Guides/Ecosystem.md#community) - Community supported plugins.
224
- - [Live Examples](https://github.com/fastify/example) - Multirepo with a broad set of real working examples.
225
- - [Discord](https://discord.gg/D3FZYPy) - Join our discord server and chat with the maintainers.
266
+ - [Core](./docs/Guides/Ecosystem.md#core) - Core plugins maintained by the
267
+ _Fastify_ [team](#team).
268
+ - [Community](./docs/Guides/Ecosystem.md#community) - Community supported
269
+ plugins.
270
+ - [Live Examples](https://github.com/fastify/example) - Multirepo with a broad
271
+ set of real working examples.
272
+ - [Discord](https://discord.gg/D3FZYPy) - Join our discord server and chat with
273
+ the maintainers.
226
274
 
227
275
  ## Support
228
276
  Please visit [Fastify help](https://github.com/fastify/help) to view prior
@@ -230,61 +278,99 @@ support issues and to ask new support questions.
230
278
 
231
279
  ## Team
232
280
 
233
- _Fastify_ is the result of the work of a great community.
234
- Team members are listed in alphabetical order.
281
+ _Fastify_ is the result of the work of a great community. Team members are
282
+ listed in alphabetical order.
235
283
 
236
284
  **Lead Maintainers:**
237
- * [__Matteo Collina__](https://github.com/mcollina), <https://twitter.com/matteocollina>, <https://www.npmjs.com/~matteo.collina>
238
- * [__Tomas Della Vedova__](https://github.com/delvedor), <https://twitter.com/delvedor>, <https://www.npmjs.com/~delvedor>
285
+ * [__Matteo Collina__](https://github.com/mcollina),
286
+ <https://twitter.com/matteocollina>, <https://www.npmjs.com/~matteo.collina>
287
+ * [__Tomas Della Vedova__](https://github.com/delvedor),
288
+ <https://twitter.com/delvedor>, <https://www.npmjs.com/~delvedor>
239
289
 
240
290
  ### Fastify Core team
241
- * [__Tommaso Allevi__](https://github.com/allevo), <https://twitter.com/allevitommaso>, <https://www.npmjs.com/~allevo>
242
- * [__Ethan Arrowood__](https://github.com/Ethan-Arrowood/), <https://twitter.com/arrowoodtech>, <https://www.npmjs.com/~ethan_arrowood>
243
- * [__Harry Brundage__](https://github.com/airhorns/), <https://twitter.com/harrybrundage>, <https://www.npmjs.com/~airhorns>
244
- * [__David Mark Clements__](https://github.com/davidmarkclements), <https://twitter.com/davidmarkclem>, <https://www.npmjs.com/~davidmarkclements>
245
- * [__Matteo Collina__](https://github.com/mcollina), <https://twitter.com/matteocollina>, <https://www.npmjs.com/~matteo.collina>
246
- * [__Tomas Della Vedova__](https://github.com/delvedor), <https://twitter.com/delvedor>, <https://www.npmjs.com/~delvedor>
247
- * [__Dustin Deus__](https://github.com/StarpTech), <https://twitter.com/dustindeus>, <https://www.npmjs.com/~starptech>
248
- * [__Ayoub El Khattabi__](https://github.com/AyoubElk), <https://twitter.com/ayoubelkh>, <https://www.npmjs.com/~ayoubelk>
249
- * [__Denis Fäcke__](https://github.com/SerayaEryn), <https://twitter.com/serayaeryn>, <https://www.npmjs.com/~serayaeryn>
250
- * [__Rafael Gonzaga__](https://github.com/rafaelgss), <https://twitter.com/_rafaelgss>, <https://www.npmjs.com/~rafaelgss>
291
+ * [__Tommaso Allevi__](https://github.com/allevo),
292
+ <https://twitter.com/allevitommaso>, <https://www.npmjs.com/~allevo>
293
+ * [__Ethan Arrowood__](https://github.com/Ethan-Arrowood/),
294
+ <https://twitter.com/arrowoodtech>, <https://www.npmjs.com/~ethan_arrowood>
295
+ * [__Harry Brundage__](https://github.com/airhorns/),
296
+ <https://twitter.com/harrybrundage>, <https://www.npmjs.com/~airhorns>
297
+ * [__David Mark Clements__](https://github.com/davidmarkclements),
298
+ <https://twitter.com/davidmarkclem>,
299
+ <https://www.npmjs.com/~davidmarkclements>
300
+ * [__Matteo Collina__](https://github.com/mcollina),
301
+ <https://twitter.com/matteocollina>, <https://www.npmjs.com/~matteo.collina>
302
+ * [__Tomas Della Vedova__](https://github.com/delvedor),
303
+ <https://twitter.com/delvedor>, <https://www.npmjs.com/~delvedor>
304
+ * [__Dustin Deus__](https://github.com/StarpTech),
305
+ <https://twitter.com/dustindeus>, <https://www.npmjs.com/~starptech>
306
+ * [__Ayoub El Khattabi__](https://github.com/AyoubElk),
307
+ <https://twitter.com/ayoubelkh>, <https://www.npmjs.com/~ayoubelk>
308
+ * [__Denis Fäcke__](https://github.com/SerayaEryn),
309
+ <https://twitter.com/serayaeryn>, <https://www.npmjs.com/~serayaeryn>
310
+ * [__Rafael Gonzaga__](https://github.com/rafaelgss),
311
+ <https://twitter.com/_rafaelgss>, <https://www.npmjs.com/~rafaelgss>
251
312
  * [__Vincent Le Goff__](https://github.com/zekth)
252
- * [__Luciano Mammino__](https://github.com/lmammino), <https://twitter.com/loige>, <https://www.npmjs.com/~lmammino>
253
- * [__Luis Orbaiceta__](https://github.com/luisorbaiceta), <https://twitter.com/luisorbai>, <https://www.npmjs.com/~luisorbaiceta>
254
- * [__Maksim Sinik__](https://github.com/fox1t), <https://twitter.com/maksimsinik>, <https://www.npmjs.com/~fox1t>
255
- * [__Manuel Spigolon__](https://github.com/eomm), <https://twitter.com/manueomm>, <https://www.npmjs.com/~eomm>
256
- * [__James Sumners__](https://github.com/jsumners), <https://twitter.com/jsumners79>, <https://www.npmjs.com/~jsumners>
313
+ * [__Luciano Mammino__](https://github.com/lmammino),
314
+ <https://twitter.com/loige>, <https://www.npmjs.com/~lmammino>
315
+ * [__Luis Orbaiceta__](https://github.com/luisorbaiceta),
316
+ <https://twitter.com/luisorbai>, <https://www.npmjs.com/~luisorbaiceta>
317
+ * [__Maksim Sinik__](https://github.com/fox1t),
318
+ <https://twitter.com/maksimsinik>, <https://www.npmjs.com/~fox1t>
319
+ * [__Manuel Spigolon__](https://github.com/eomm),
320
+ <https://twitter.com/manueomm>, <https://www.npmjs.com/~eomm>
321
+ * [__James Sumners__](https://github.com/jsumners),
322
+ <https://twitter.com/jsumners79>, <https://www.npmjs.com/~jsumners>
257
323
 
258
324
  ### Fastify Plugins team
259
- * [__Matteo Collina__](https://github.com/mcollina), <https://twitter.com/matteocollina>, <https://www.npmjs.com/~matteo.collina>
260
- * [__Harry Brundage__](https://github.com/airhorns/), <https://twitter.com/harrybrundage>, <https://www.npmjs.com/~airhorns>
261
- * [__Tomas Della Vedova__](https://github.com/delvedor), <https://twitter.com/delvedor>, <https://www.npmjs.com/~delvedor>
262
- * [__Ayoub El Khattabi__](https://github.com/AyoubElk), <https://twitter.com/ayoubelkh>, <https://www.npmjs.com/~ayoubelk>
325
+ * [__Matteo Collina__](https://github.com/mcollina),
326
+ <https://twitter.com/matteocollina>, <https://www.npmjs.com/~matteo.collina>
327
+ * [__Harry Brundage__](https://github.com/airhorns/),
328
+ <https://twitter.com/harrybrundage>, <https://www.npmjs.com/~airhorns>
329
+ * [__Tomas Della Vedova__](https://github.com/delvedor),
330
+ <https://twitter.com/delvedor>, <https://www.npmjs.com/~delvedor>
331
+ * [__Ayoub El Khattabi__](https://github.com/AyoubElk),
332
+ <https://twitter.com/ayoubelkh>, <https://www.npmjs.com/~ayoubelk>
263
333
  * [__Vincent Le Goff__](https://github.com/zekth)
264
- * [__Salman Mitha__](https://github.com/salmanm), <https://www.npmjs.com/~salmanm>
265
- * [__Maksim Sinik__](https://github.com/fox1t), <https://twitter.com/maksimsinik>, <https://www.npmjs.com/~fox1t>
334
+ * [__Salman Mitha__](https://github.com/salmanm),
335
+ <https://www.npmjs.com/~salmanm>
336
+ * [__Maksim Sinik__](https://github.com/fox1t),
337
+ <https://twitter.com/maksimsinik>, <https://www.npmjs.com/~fox1t>
266
338
  * [__Frazer Smith__](https://github.com/Fdawgs), <https://www.npmjs.com/~fdawgs>
267
- * [__Manuel Spigolon__](https://github.com/eomm), <https://twitter.com/manueomm>, <https://www.npmjs.com/~eomm>
268
- * [__Rafael Gonzaga__](https://github.com/rafaelgss), <https://twitter.com/_rafaelgss>, <https://www.npmjs.com/~rafaelgss>
339
+ * [__Manuel Spigolon__](https://github.com/eomm),
340
+ <https://twitter.com/manueomm>, <https://www.npmjs.com/~eomm>
341
+ * [__Rafael Gonzaga__](https://github.com/rafaelgss),
342
+ <https://twitter.com/_rafaelgss>, <https://www.npmjs.com/~rafaelgss>
269
343
 
270
344
  ### Great Contributors
271
- Great contributors on a specific area in the Fastify ecosystem will be invited to join this group by Lead Maintainers.
345
+ Great contributors on a specific area in the Fastify ecosystem will be invited
346
+ to join this group by Lead Maintainers.
272
347
 
273
- * [__dalisoft__](https://github.com/dalisoft), <https://twitter.com/dalisoft>, <https://www.npmjs.com/~dalisoft>
274
- * [__Luciano Mammino__](https://github.com/lmammino), <https://twitter.com/loige>, <https://www.npmjs.com/~lmammino>
275
- * [__Evan Shortiss__](https://github.com/evanshortiss), <https://twitter.com/evanshortiss>, <https://www.npmjs.com/~evanshortiss>
348
+ * [__dalisoft__](https://github.com/dalisoft), <https://twitter.com/dalisoft>,
349
+ <https://www.npmjs.com/~dalisoft>
350
+ * [__Luciano Mammino__](https://github.com/lmammino),
351
+ <https://twitter.com/loige>, <https://www.npmjs.com/~lmammino>
352
+ * [__Evan Shortiss__](https://github.com/evanshortiss),
353
+ <https://twitter.com/evanshortiss>, <https://www.npmjs.com/~evanshortiss>
276
354
 
277
355
  **Past Collaborators**
278
- * [__Çağatay Çalı__](https://github.com/cagataycali), <https://twitter.com/cagataycali>, <https://www.npmjs.com/~cagataycali>
279
- * [__Trivikram Kamat__](https://github.com/trivikr), <https://twitter.com/trivikram>, <https://www.npmjs.com/~trivikr>
280
- * [__Cemre Mengu__](https://github.com/cemremengu), <https://twitter.com/cemremengu>, <https://www.npmjs.com/~cemremengu>
281
- * [__Nathan Woltman__](https://github.com/nwoltman), <https://twitter.com/NathanWoltman>, <https://www.npmjs.com/~nwoltman>
356
+ * [__Çağatay Çalı__](https://github.com/cagataycali),
357
+ <https://twitter.com/cagataycali>, <https://www.npmjs.com/~cagataycali>
358
+ * [__Trivikram Kamat__](https://github.com/trivikr),
359
+ <https://twitter.com/trivikram>, <https://www.npmjs.com/~trivikr>
360
+ * [__Cemre Mengu__](https://github.com/cemremengu),
361
+ <https://twitter.com/cemremengu>, <https://www.npmjs.com/~cemremengu>
362
+ * [__Nathan Woltman__](https://github.com/nwoltman),
363
+ <https://twitter.com/NathanWoltman>, <https://www.npmjs.com/~nwoltman>
282
364
 
283
365
  ## Hosted by
284
366
 
285
- [<img src="https://github.com/openjs-foundation/artwork/blob/main/openjs_foundation/openjs_foundation-logo-horizontal-color.png?raw=true" width="250px;"/>](https://openjsf.org/projects/#growth)
367
+ [<img
368
+ src="https://github.com/openjs-foundation/artwork/blob/main/openjs_foundation/openjs_foundation-logo-horizontal-color.png?raw=true"
369
+ width="250px;"/>](https://openjsf.org/projects/#growth)
286
370
 
287
- We are a [Growth Project](https://github.com/openjs-foundation/cross-project-council/blob/HEAD/PROJECT_PROGRESSION.md#growth-stage) in the [OpenJS Foundation](https://openjsf.org/).
371
+ We are a [Growth
372
+ Project](https://github.com/openjs-foundation/cross-project-council/blob/HEAD/PROJECT_PROGRESSION.md#growth-stage)
373
+ in the [OpenJS Foundation](https://openjsf.org/).
288
374
 
289
375
  ## Acknowledgements
290
376
 
@@ -292,13 +378,14 @@ This project is kindly sponsored by:
292
378
  - [nearForm](https://nearform.com)
293
379
 
294
380
  Past Sponsors:
295
- - [LetzDoIt](http://www.letzdoitapp.com/)
381
+ - [LetzDoIt](https://www.letzdoitapp.com/)
296
382
 
297
383
  ## License
298
384
 
299
385
  Licensed under [MIT](./LICENSE).
300
386
 
301
- For your convenience, here is a list of all the licenses of our production dependencies:
387
+ For your convenience, here is a list of all the licenses of our production
388
+ dependencies:
302
389
  - MIT
303
390
  - ISC
304
391
  - BSD-3-Clause