Skip to content

Remove dependency on Parse JS SDK #8787

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

Open
3 tasks done
mtrezza opened this issue Oct 23, 2023 · 7 comments · May be fixed by #9721
Open
3 tasks done

Remove dependency on Parse JS SDK #8787

mtrezza opened this issue Oct 23, 2023 · 7 comments · May be fixed by #9721
Labels
type:feature New feature or improvement of existing feature

Comments

@mtrezza
Copy link
Member

mtrezza commented Oct 23, 2023

New Feature / Enhancement Checklist

Current Limitation

Parse Server currently depends on the Parse JS SDK. This is because the Parse JS SDK is leading a double life - as a Parse client SDK and as a internal module of Parse Server that is uses for various features. This creates the following issues:

  • Difficult development; its adds a circular dependency where changes in the server requires changes in the SDK and vice versa.
  • Bloated client SDK; it contains code that is unnecessary outside of the Cloud Code environment.

Feature / Enhancement Description

Remove Parse Server's dependency on the Parse JS SDK. It should only be needed:

  • As a dependency alongside Parse Server if a developer wants to use the Cloud Code feature. In that case the developer needs to add the Parse JS SDK as a dependency themselves.
  • As a devDependency for the Parse Server tests of Cloud Code.

All elements of the Parse JS SDK that are currently in use in Parse Server should be moved to the Parse.Cloud namespace.

@parse-github-assistant
Copy link

parse-github-assistant bot commented Oct 23, 2023

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza
Copy link
Member Author

mtrezza commented Apr 15, 2025

A possible approach could be to move the common internal APIs such as Parse.Error, Parse._encode, Parse._decode into a separate repository and use it as a dependency in Parse Server and possibly all client SDKs, if there's a way to do that. It may need to be abstracted in a way that makes it compatible across ecosystems. For Parse.Error that's easy with a JSON import, but Object transcoding may be a challenge.

@dplewis
Copy link
Member

dplewis commented Apr 15, 2025

@mtrezza This might be easier than I thought, all we have to do is isolate which parts of the is Cloud Code, routers, hooks, triggers. Thats where the Object transcoding happens then just await import('parse/node') at the scope level.

@mtrezza
Copy link
Member Author

mtrezza commented Apr 15, 2025

I hope it is as easy as you make it sound - if you guessed, would you say this is an effort of days, weeks or months?

@dplewis
Copy link
Member

dplewis commented Apr 15, 2025

Depends on how fast you can move Parse.Error to another repo? This could take weeks

@dplewis
Copy link
Member

dplewis commented Apr 15, 2025

Here are all the features from the Parse JS SDK used internally on the Server. Most likely Parse.applicationId will give us the most trouble as it depends on the SDK maybe get it from config. I should probably note LiveQuery depends heavily on the Parse JS SDK.

module.exports = {
  applicationId: Parse.applicationId, // needs investigation
  AnonymousUtils: Parse.AnonymousUtils, // checking isLinked not needed as check for authdata does the same
  _decode: Parse._decode, // Cloud Only
  _encode: Parse._encode, // Cloud Only
  CLP: Parse.CLP, // Used for types not needed
  CoreManager: Parse.CoreManager, // Cloud Only
  Config: Parse.Config, // Cloud Only
  Error: Parse.Error, // Needs to be moved to another repo
  File: Parse.File, // Cloud only
  GeoPoint: Parse.GeoPoint, // toRadians can be moved to utils
  Polygon: Parse.Polygon, // containsPoint can be moved to utils
  Object: Parse.Object, // LiveQuery, Cloud, Auth
  Query: Parse.Query, // LiveQuery and Cloud
  Role: Parse.Role, // Used for className on Query creation can replace with `_Role`
  Schema: Parse.Schema, // Types and schema migration
  Session: Parse.Session, // Cloud Only
  User: Parse.User, // Authentication, Email verification, Cloud
  Server: ParseServer, // Cloud Only
};

From what I can tell developers should be able to run Parse Server standalone without the Parse JS SDK but for features like Email Verification, Authentication, LIveQuery, CloudCode and Schema Migration, DirectAccess (default true) would need the Parse JS SDK

@dplewis dplewis linked a pull request Apr 16, 2025 that will close this issue
4 tasks
@mtrezza
Copy link
Member Author

mtrezza commented Apr 17, 2025

What inside the JS SDK that makes these server features require it?

  • Parse.Error: can be moved into a separate repo in form of JSON file to import across client SDKs and server.
  • REST API calls: server should directly call its REST API without going through the SDK.

Then there are the tests that heavily use the JS SDK. Maybe none of the tests should actually use it but use the REST API. But given the amount of tests, it'd be an enormous effort to migrate them all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants