Sitelet https://web.archive.org/web/20220411021009/https://github.com/verdaccio/verdaccio/issues/2623
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

Migrate all API endpoints to Fastify as secondary server #2623

Open
11 tasks
juanpicado opened this issue Nov 3, 2021 Discussed in #2155 · 4 comments
Open
11 tasks

Migrate all API endpoints to Fastify as secondary server #2623

juanpicado opened this issue Nov 3, 2021 Discussed in #2155 · 4 comments

Comments

@juanpicado
Copy link
Member

@juanpicado juanpicado commented Nov 3, 2021 •

Discussed in #2155

The current progress could be tested via

pnpm install
pnpm build
pnpm debug:fastify

or

npm i -g verdaccio@6-next
verdaccio fastify-server

The main idea is launch fastify with next major but under a flag, so could be tested for a period of time until replaces completely Express server.

The main blocker of this migration, the fact some important logic still remains on express endpoints, should be ported to another place were could be reused from both servers and avoid duplication and easy testing.

Steps to migrate

  • API (cli)
  • Web API
  • Improvements
    • Apply hooks for Header Authorization validation
    • Apply validations, schema etc #2653
    • Apply require host header on some endpoints, (packages and manifest)
    • Improve Types (remove @ts-ignore
    • UserRemote requestDecodarator
    • Improve integration with @verdaccio/node-api, currently is not able to enable from this API fastify
    • Review compatibility with Express (it should remains as primary server, Fastify as secondary opt-in)
    • Integrate Fastify server to E2E CLI and E2E UI
    • Add integration basic test on fastify server package
    • Enable fastify via environment variable as also replace verdaccio fastify by verdaccio --fastify via CLI (this will enable Docker nightly build to use Fastify)
    • Document on server page the possibility to using fastify (This is the very last task to be done)
@juanpicado juanpicado changed the title Fastify over Express Migrate from Express to Fastify Nov 3, 2021
@juanpicado juanpicado added this to the v6 release milestone Nov 3, 2021
@juanpicado juanpicado added this to In progress in Fastify migration Nov 3, 2021
@juanpicado juanpicado pinned this issue Nov 3, 2021
dianmorales added a commit that referenced this issue Nov 8, 2021
#2623

When a request is made, the following error is displayed on log
error--- Promise may not be fulfilled with 'undefined' when statusCode is not 204

fastify/fastify#2702
juanpicado added a commit that referenced this issue Nov 10, 2021
* feat: add body schema validation to login endpoint

#2623

When a request is made, the following error is displayed on log
error--- Promise may not be fulfilled with 'undefined' when statusCode is not 204

fastify/fastify#2702

* feat: add body schema validation to resetPassword endpoint

Co-authored-by: Juan Picado <juanpicado19@gmail.com>
@juanpicado juanpicado changed the title Migrate from Express to Fastify Migrate all API endpoints to Fastify as secondary server Nov 11, 2021
@juanpicado juanpicado moved this from In progress to To do in Fastify migration Jan 9, 2022
@edclement
Copy link
Contributor

@edclement edclement commented Apr 4, 2022 •

@juanpicado - how do you envision this impacting the middleware plugins? Would something like fastify-express be leveraged for compatibility?

@juanpicado
Copy link
Member Author

@juanpicado juanpicado commented Apr 4, 2022 •

@juanpicado - how do you envision this impacting the middleware plugins? Would something like fastify-express be leveraged for compatibility?

tbh, I have no answer yet, I haven´t experienced enough with it, but the idea is extend compability longer as possible as I try to do with all features. Express won´t go anytime soon as a default server, a lot of things still to refactor 😓 (there is a lot of bussines logic on express layers inherited from sinopia and completely undocumented).

@edclement
Copy link
Contributor

@edclement edclement commented Apr 4, 2022

Thanks. Maybe when we eventually migrate to v6 I'll see if we can use the fastify server and take a look at what is entailed in switching the middleware plugins to be compatible with v6. I'll open a discussion if/when that occurs and if a discussion hasn't already been started.

@juanpicado
Copy link
Member Author

@juanpicado juanpicado commented Apr 5, 2022

Thanks. Maybe when we eventually migrate to v6 I'll see if we can use the fastify server and take a look at what is entailed in switching the middleware plugins to be compatible with v6. I'll open a discussion if/when that occurs and if a discussion hasn't already been started.

No discussions open yet regarding plugin future, that´s also an open topic, my position on v6 with plugins is leave it as it is (with minor improvements) and back to it on v7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

3 participants