parse-community / parse-community/parse-server

Lazy-load Push adapter only when Push is configured

Open
#10,518 1 comment 0 reactions 0 assignees View on GitHub

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
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:

  1. In getPushController(), check whether options.push exists before loading @parse/push-adapter.

  2. If push is 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.
  3. If push is configured:

    • keep the current behavior;
    • load the bundled @parse/push-adapter;
    • support custom push.adapter;
    • initialize Push queue / Push worker as today.
  4. 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
  1. A developer runs Parse Server without Push notifications configured.
  2. Their configuration does not include a push key.
  3. Parse Server starts normally.
  4. Parse Server does not load @parse/push-adapter.
  5. Parse Server does not initialize a Push adapter or Push worker.
  6. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.