parse-community / parse-community/parse-server
Lazy-load Push adapter only when Push is configured
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 21.4k
- Forks
- 4.8k
- Avg merge
- 7h 45m
- Merged PRs (30d)
- 11
Description
New Feature / Enhancement Checklist
- Report security issues [confidentially](https://github.com/parse-community/parse-server/security/policy).
- Any contribution is under this [license](https://github.com/parse-community/parse-server/blob/alpha/LICENSE).
- Before posting search [existing issues](https://github.com/parse-community/parse-server/issues?q=is%3Aissue).
Current Limitation
Currently, Parse Server appears to load the default Push adapter during startup even when Push is not configured.
In getPushController(), @parse/push-adapter seems to be loaded before hasPushSupport is determined from the presence of the push configuration. This means deployments that do not use Push may still go through part of the Push initialization path.
@parse/push-adapter is already a separate package, so this issue is not about creating a new Push package. The smaller limitation here is runtime behavior: Push-related code should ideally not be loaded or initialized unless Push is actually enabled.
This matters because many Parse Server deployments do not use Push notifications, especially API-only, serverless, worker, or backend-only deployments.
Feature / Enhancement Description
Lazy-load and initialize Push only when push is configured.
A possible implementation approach:
-
In
getPushController(), check whetheroptions.pushexists before loading@parse/push-adapter. -
If
pushis not configured:- do not call
loadModule('@parse/push-adapter'); - do not create a default Push adapter;
- do not create a Push worker;
- only create the minimum no-op/default controller state required by Parse Server internals.
- do not call
-
If
pushis configured:- keep the current behavior;
- load the bundled
@parse/push-adapter; - support custom
push.adapter; - initialize Push queue / Push worker as today.
-
Preserve backward compatibility for users who configure Push.
This would be a smaller and lower-risk change than changing the dependency relationship between parse-server and @parse/push-adapter. Making @parse/push-adapter optional or peer-installed could be considered later, but the first step would simply be to avoid loading Push when it is not used.
Example Use Case
- A developer runs Parse Server without Push notifications configured.
- Their configuration does not include a
pushkey. - Parse Server starts normally.
- Parse Server does not load
@parse/push-adapter. - Parse Server does not initialize a Push adapter or Push worker.
- The deployment avoids unnecessary startup work for a feature it does not use.
This is especially useful for deployments where startup time and dependency loading matter, such as serverless containers, small Docker images, test environments, or backend-only Parse Server deployments.
Alternatives / Workarounds
Currently, there does not seem to be a complete workaround for avoiding the default Push adapter load path when Push is not configured.
push.queueOptions.disablePushWorker can disable the Push worker when Push configuration exists, but it does not address the case where a deployment does not use Push at all and wants to avoid loading or initializing Push-related code.
Another possible future improvement would be to make @parse/push-adapter an optional peer dependency, but that would be more breaking and probably belongs to a later major-version discussion.
3rd Party References
Related broader modularity discussion:
- #7938 — Parse Server compatibility with Serverless environment
That issue discusses code splitting and loading only the adapters / servers that a deployment actually needs. Push lazy-loading could be a small, concrete first step in that direction.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at getPushController() and trace how options.push, loadModule('@parse/push-adapter'), the default adapter, and the Push worker are handled. Verify the configured-Push path remains unchanged while an unconfigured deployment avoids loading or initializing Push components; run the relevant existing test suite for this controller if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100