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

Migration to NestJs #138

Open
10 tasks
dhruv-1001 opened this issue Mar 12, 2024 · 9 comments · May be fixed by #149
Open
10 tasks

Migration to NestJs #138

dhruv-1001 opened this issue Mar 12, 2024 · 9 comments · May be fixed by #149
Assignees
Labels

Comments

@dhruv-1001
Copy link
Collaborator

Migrate Project from Vanilla JS to NestJS

Overview

This issue is created to track the migration of the project from its current JS architecture to NestJS.

Current Situation

The project is currently built using vanilla JavaScript and needs to be migrated to NestJS to leverage its benefits, including a modular and scalable architecture, dependency injection, and enhanced maintainability.

Goals

  1. Framework Migration: Transition the existing codebase from vanilla JS to NestJS.
  2. Module Structure: Organize the project into NestJS modules for improved modularity and maintainability.
  3. Middleware Integration: Integrate necessary middleware for enhanced functionality and request handling.
  4. Testing: Update and create tests to ensure the correctness of the migrated code.
  5. Documentation: Document the migration process, including any potential issues and their resolutions.

Steps

  1. Setup

    • Create a new NestJS project.
    • Set up the necessary configurations.
  2. Code Migration

    • Identify and migrate existing functionality from vanilla JS to NestJS.
    • Refactor code to adhere to NestJS module structure.
    • Setup files with version controlling.
  3. Middleware Integration

    • Identify required middleware for the project.
    • Integrate middleware into the NestJS project.
  4. Testing

    • Update existing tests to match the new NestJS structure.
    • Create additional tests for newly integrated functionality.
  5. Documentation

    • Document the APIs for v1.

Collaborators

@dhruv-1001
Copy link
Collaborator Author

@ChakshuGautam, for documenting APIs, I'm going ahead with swagger docs.

@dhruv-1001 dhruv-1001 self-assigned this Mar 12, 2024
@dhruvchandak30
Copy link

dhruvchandak30 commented Mar 17, 2024

@dhruv-1001 @ChakshuGautam I would Like to work on this issue.
Should I create Next App in the root folder to start with ? So that everybody can help in migrating the codebase.

@Abhinav-Saxena-dev
Copy link

Abhinav-Saxena-dev commented Mar 27, 2024

Hey, I'd like to work on this. I've gone through the project and suggest the following approach:

Folder structure of Nest app:

- src
  - app
    - models
      - city
        - city.controller.ts
        - city.module.ts
        - city.serializer.ts
        - city.controller.spec.ts
      - georev
        - georev.controller.ts
        - georev.module.ts
        - georev.serializer.ts
        - georev.controller.spec.ts
      - location
        - location.controller.ts
        - location.module.ts
        - location.serializer.ts
        - location.controller.spec.ts
        - location.service.ts
        - location.service.spec.ts
  - config
    - config.json
    - swagger.config.json
  - geojson-data
  - services
    - geojson
        - geojson.service.ts
    - logger
        - logger.service.ts
  - util
    - common
      - gdb_to_geojson
      - parse.geojson
    - serializer
      - success
      - error

Justification

  • Creating three modules for handling city, georev, and location routes to maintain distinct functionality.
  • Functions such as those used for formatting response (success or error ) will be moved to their respective serializer ( utils/serializer in case it's a common one )
  • Functions responsible for reading the Geo-Json data from the file path and providing the feature properties will be moved to /services/geojson/geojson.service.ts and will be injected in the modules, wherever necessary.
  • Similarly, functions belonging to location.search.js will be moved to location.service.ts and injected into a module as necessary.

Stencil-cli will be used to setup the project. Finalized structure might slightly defer from the proposed structure.

Logger

  • For logging data, a custom logger service will be set

Swagger

  • Will set up swagger using @nestjs/swagger and implement it with existing config.

Scripts

  • The scripts will be moved to common utilities.

Please let me know what changes are required here, I will create a tech doc post review.

@dhruv-1001
Copy link
Collaborator Author

Hey @Abhinav-Saxena-dev. This looks great!
This seems to cover everything that we have now.
You can go ahead!

@Abhinav-Saxena-dev
Copy link

@dhruv-1001 Hey, I've completed the code migration and have raised a Draft PR. I have added relevant information in the description for now and maintaining a check list of tasks there.

Please review it once and let me know whatever changes / new updates that might be required there.

@Abhinav-Saxena-dev
Copy link

Update:

  • Code clean-up is completed.
  • Cleaned up logger
  • Added validations

To be left / Completed by EOD

  • Swagger documentation needs to be implemented.
  • Test cases for APIs.

A merge conflict has occurred, attempting to public the draft PR by EOD.

@dhruv-1001
Copy link
Collaborator Author

Hey, @Abhinav-Saxena-dev. Will try to review your PR this weekend.

@ChakshuGautam
Copy link
Owner

@dhruv-1001 what's the update on this?

@Abhinav-Saxena-dev
Copy link

@dhruv-1001 I would like to request a review of the PR. The merge conflict arose due to the db.md, which I had updated but the prompt remains. Apart from that, the PR is ready.

Please let me know any changes that you would require.

@35C4n0r 35C4n0r linked a pull request Jun 8, 2024 that will close this issue
@35C4n0r 35C4n0r assigned 35C4n0r and unassigned Abhinav-Saxena-dev Jun 8, 2024
@35C4n0r 35C4n0r added the DMP24 label Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

5 participants