Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Migration to NestJS #459

Open
nitrosx opened this issue Jun 30, 2021 · 6 comments
Open

Migration to NestJS #459

nitrosx opened this issue Jun 30, 2021 · 6 comments

Comments

@nitrosx
Copy link
Contributor

nitrosx commented Jun 30, 2021

Summary key items for migration to Loopback 4:

  • no matter which framework we are going looking to a complete refactoring of the code base
  • Each endpoint will require a considerable amount work, even after we have developed the knowhow
  • User management should require work only at the beginning while we set it up. It should require minimal effort to integrate it in each end point.
  • Documentation is fragmented and it is not easy to find an end-to-end tutorial
  • As of now, LB4 is still a viable option

Valid reasons to change framework:

  • longer long term support
  • better and easier documentation
  • better tutorials and how-tos
  • wider user base

Notes

There are many frameworks out there, as illustrated by this post:
In one of the posts that I came across, I read about nestjs and next.js, which apparently have wider user base.
I checked nestjs web page, I could not find any info on End-Of-Life and support. I did find their documentation a little easier to read and follow (here is the authentication documentation: )
I also find this post where they compare nestjs with other frameworks, but not with loopback.
This post provide a little info on differences between LB3, LB4 and nestjs:

@nitrosx
Copy link
Contributor Author

nitrosx commented Aug 20, 2021

@henrikjohansson712 and @nitrosx (myself) agreed that a migration to a Loopback4 requires a considerable code refactoring.

We decided to explore implementing datasets endpoint in express.js and nest.js.

This experience allowed us to conclude the following:

  • using either express.js and nest.js was easier to understand the workflow and the framework/library used
  • in both cases, we were able to write code that was easier to understand
  • with nest,js is easier to access the lower level functionalities and data structure than in LB4
  • nest.js documentation is complete although it lack coverage of edge use cases.

We therefore decided to explore nest.js so we could leverage higher level functionalities already present in the framework.

@nitrosx
Copy link
Contributor Author

nitrosx commented Aug 20, 2021

WE continued our exploration of nest.js and implemented a proof-of-concept of the full Datasets endpoint without changing the underline database.
We also implemented authentication.

Implementation of scicat-nestjs is available in nestjs branch

@nitrosx
Copy link
Contributor Author

nitrosx commented Aug 20, 2021

We just successfully tested the scicat migration middleware (S2M for short).
Here is the configuration:

  • S2M configured to listen on port 3000 directing Datasets end point to scicat-nestjs and all other requests to scicat-lb3 (current implementation).
  • scicat-nestjs listening on port 3002
  • scicat-lb3 listening on port 3001
  • common database accessed by scicat-nestjs and scicat-lb3

Tested performed:

  • login (authentication on both backends and tokens management)
  • retrieved all datasets list (directed to and answered by scicat-nestjs)
  • retrieved one dataset by id (directed to and answered by scicat-nestjs)
  • retrieved all proposals list (directed to and answered by scicat-lb3)
  • retrieved one proposal by id (directed to and answered by scicat-lb3)

@stephan271
Copy link
Member

Congratulations ! Looks like a promising approach .

@nitrosx
Copy link
Contributor Author

nitrosx commented Sep 21, 2021

We are now working to have a functional nestjs endpoint for datasets with authentication and authorization.
Renaming the ticket to Migration to NestJS

@nitrosx nitrosx changed the title Migration to Loopback4 Migration to NestJS Sep 21, 2021
@nguyenlinhlinh
Copy link
Contributor

I can volunteer to migrate the job endpoint.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants