Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core,core-api): use fastify, drop express #3598

Open
petermetz opened this issue Oct 18, 2024 · 4 comments · May be fixed by #3788
Open

refactor(core,core-api): use fastify, drop express #3598

petermetz opened this issue Oct 18, 2024 · 4 comments · May be fixed by #3788
Assignees
Labels
Breaking_V2 Changes that can only be made with the release of v3.0.0 due to them being breaking changes. P3 Priority 3: Medium Significant_Change Applying this label triggers the more stringent review of the maintainers and the 2+1 PR rule. Triage_Needed Triage if the issue is/still relevant, bug report is valid, arch/design details etc.
Milestone

Comments

@petermetz
Copy link
Contributor

Description

Express v5 just came out: https://expressjs.com/2024/10/15/v5-release.html
but it still doesn't support HTTP 2 so I'd say it's best for us to jump over to the Fastify bandwagon because it has proven itself already (we are already using it in the API server to serve ConnectRPC HTTP 2 traffic)

So this task is about taking it all the way and using Fastify for everything.
This involves modifying the core-api/core utility methods/types that are currently dependent on express types. This will be a massive breaking change so we need to schedule this for 3.0.0 instead of a minor or patch release of 2.x.

In the meantime what we can still (probably) do is identify a subset of the places in the code that can be refactored without breaking changes to not use the Express type signatures. (We can create our own type signatures with precision so that they only include a copy of the relevant parts of the Express types/method signatures).

Acceptance Criteria

  1. All tests are still passing.
  2. express and @types/express are completely eliminated from the codebase
@petermetz petermetz added Triage_Needed Triage if the issue is/still relevant, bug report is valid, arch/design details etc. Significant_Change Applying this label triggers the more stringent review of the maintainers and the 2+1 PR rule. P3 Priority 3: Medium Breaking_V2 Changes that can only be made with the release of v3.0.0 due to them being breaking changes. labels Oct 18, 2024
@petermetz petermetz added this to the v3.0.0 milestone Oct 18, 2024
@aldousalvarez
Copy link
Contributor

Hello @jagpreetsinghsasan I would like to work on this one, Thanks

@jagpreetsinghsasan
Copy link
Contributor

As the refactoring is huge, splitting this task into 2 smaller tasks

@jagpreetsinghsasan jagpreetsinghsasan changed the title refactor(cmd-api-server,core,core-api): use fastify, drop express refactor(core,core-api): use fastify, drop express Feb 19, 2025
@jagpreetsinghsasan
Copy link
Contributor

The other task (for cmd-api-server) is located here: #3778

@aldousalvarez
Copy link
Contributor

Hello, @petermetz I have a question about which Fastify version to use. The docs state that Fastify v5.x supports Node 20 and 22, while our current Node version (18.19.0) only supports Fastify v4.x, 3.x, and 2.x. Should we use Fastify v4.x for now and upgrade later, or upgrade Node and use the latest Fastify version?

aldousalvarez added a commit to aldousalvarez/cactus that referenced this issue Feb 26, 2025
Primary Changes
---------------
1. Migrated files of (cactus-core and core-api) using
   express to fastify

Fixes: hyperledger-cacti#3598
Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com>
aldousalvarez added a commit to aldousalvarez/cactus that referenced this issue Feb 27, 2025
Primary Changes
---------------
1. Migrated files of (cactus-core and core-api) using
   express to fastify

Fixes: hyperledger-cacti#3598
Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com>
@aldousalvarez aldousalvarez linked a pull request Feb 27, 2025 that will close this issue
5 tasks
aldousalvarez added a commit to aldousalvarez/cactus that referenced this issue Feb 27, 2025
Primary Changes
---------------
1. Migrated files of (cactus-core and core-api) using
   express to fastify

Fixes: hyperledger-cacti#3598
Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Breaking_V2 Changes that can only be made with the release of v3.0.0 due to them being breaking changes. P3 Priority 3: Medium Significant_Change Applying this label triggers the more stringent review of the maintainers and the 2+1 PR rule. Triage_Needed Triage if the issue is/still relevant, bug report is valid, arch/design details etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants