# QwikDev/partytown

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/qwikdev-partytown).**

13,706 stars · 450 forks · TypeScript · MIT

## Links

- GitHub: https://github.com/QwikDev/partytown
- Homepage: https://partytown.qwik.dev
- awesome-repositories: https://awesome-repositories.com/repository/qwikdev-partytown.md

## Topics

`3rd-party` `3rdparty` `analytics` `core-web-vitals` `dom` `javascript` `lighthouse` `lighthouse-score` `performance` `web-worker` `webworker`

## Description

Partytown is a library designed to offload resource-intensive third-party scripts to background web workers. By executing these scripts outside of the main thread, it prevents them from blocking the critical rendering path, thereby maintaining a responsive user interface and improving overall page load performance.

The project functions as a web worker proxy library that synchronizes browser interfaces between the main thread and background environments. It uses proxy-based access and synchronous messaging to replicate global objects like the window and document, allowing scripts to interact with the DOM and browser APIs from a worker thread. To ensure compatibility, it includes request proxying to bypass cross-origin restrictions and provides fallback execution mechanisms for environments where background processing is limited.

Beyond core offloading, the library offers granular control over script execution through filtering, event forwarding, and configuration settings. It includes diagnostic utilities for auditing third-party activity and tracing script execution, as well as security features for managing storage isolation and content security policies. The library operates as a standalone utility, requiring no specific framework integration or complex build-time modifications to deploy.

## Tags

### Software Engineering & Architecture

- [Script Offloaders](https://awesome-repositories.com/f/software-engineering-architecture/performance-reliability/performance-optimization/frontend-rendering-loading/ui-thread-responsiveness/script-offloaders.md) — Executes resource-intensive third-party scripts in a background thread to prevent main thread blocking and improve page performance. ([source](https://partytown.qwik.dev/browser-support/))
- [Interface Virtualizers](https://awesome-repositories.com/f/software-engineering-architecture/architectural-design-patterns/object-oriented-foundations/object-oriented-programming/structure-definitions/document-object-interfaces/interface-virtualizers.md) — Replicates browser window and document interfaces within a worker environment to provide a consistent execution context.
- [Background Thread Dispatchers](https://awesome-repositories.com/f/software-engineering-architecture/background-thread-dispatchers.md) — Replicates main thread interfaces in a background worker using proxies and serialization to allow scripts to interact with the document structure. ([source](https://partytown.qwik.dev/google-tag-manager/))
- [DOM Synchronization](https://awesome-repositories.com/f/software-engineering-architecture/background-thread-dispatchers/dom-synchronization.md) — Coordinates read and write tasks between background threads and the main interface thread to ensure consistent data updates without blocking user interactions. ([source](https://partytown.qwik.dev))

### Web Development

- [Background Processing Workers](https://awesome-repositories.com/f/web-development/background-processing-workers.md) — Executes resource-intensive third-party scripts in a background thread to prevent main thread blocking and improve overall page responsiveness.
- [Worker Proxy Frameworks](https://awesome-repositories.com/f/web-development/web-worker-orchestrators/worker-proxy-frameworks.md) — Uses proxies and shared memory to synchronize browser interfaces between the main thread and background workers.
- [Performance Optimizations](https://awesome-repositories.com/f/web-development/performance-optimizations.md) — Offloads resource-intensive third-party scripts to background web workers to keep the main thread responsive and improve page load speed.
- [Web Performance Optimization Tools](https://awesome-repositories.com/f/web-development/web-performance-optimization-tools.md) — Improves page load speed by offloading heavy tracking and analytics scripts to isolated background execution environments.
- [Request Proxying Utilities](https://awesome-repositories.com/f/web-development/data-fetching-caching/data-fetching/request-proxying-utilities.md) — Routes external script requests through a local server proxy to bypass cross-origin restrictions and ensure proper header configuration. ([source](https://partytown.qwik.dev/proxying-requests/))
- [Proxy-Based Reactivity](https://awesome-repositories.com/f/web-development/proxy-based-reactivity.md) — Uses JavaScript proxies to intercept and forward property access and method calls from a background worker to the main thread.
- [Web Worker Orchestrators](https://awesome-repositories.com/f/web-development/web-worker-orchestrators.md) — Synchronizes main thread browser interfaces with background workers to allow complex scripts to run without blocking the user interface.
- [Execution Fallbacks](https://awesome-repositories.com/f/web-development/performance-optimizations/hardware-accelerated-webgl-execution/fallback-mechanisms/execution-fallbacks.md) — Runs scripts on the main thread automatically when advanced background processing features are unavailable to ensure consistent functionality. ([source](https://partytown.qwik.dev/browser-support/))
- [Script Redirectors](https://awesome-repositories.com/f/web-development/client-side-components/script-injection-mechanisms/script-redirectors.md) — Automatically redirects third-party script execution to background threads to prevent main thread blocking.

### Security & Cryptography

- [Script Isolators](https://awesome-repositories.com/f/security-cryptography/third-party-script-security/script-isolators.md) — Moves non-critical scripts into web workers to prevent them from blocking the critical rendering path.
- [Third-Party Script Controllers](https://awesome-repositories.com/f/security-cryptography/third-party-script-security/third-party-script-controllers.md) — Centralizes the loading and execution of external marketing and analytics tags to maintain control over site performance.
- [Storage Isolations](https://awesome-repositories.com/f/security-cryptography/storage-permissions/storage-access-isolations/storage-isolations.md) — Manages cookies and local storage access for scripts running in background threads while restricting access to sensitive browser features. ([source](https://partytown.qwik.dev/trade-offs))
- [Activity Auditing](https://awesome-repositories.com/f/security-cryptography/third-party-script-security/activity-auditing.md) — Logs API calls and arguments made by third-party scripts to provide visibility into their behavior and interactions with the browser environment. ([source](https://partytown.qwik.dev/sandboxing/))

### Development Tools & Productivity

- [Dynamic Script Discovery](https://awesome-repositories.com/f/development-tools-productivity/platform-script-execution/dynamic-script-execution-environments/dynamic-script-discovery.md) — Monitors the document for automatically added scripts and notifies the background worker to discover and execute them to ensure complete tracking. ([source](https://partytown.qwik.dev/shopify-os2/))
- [Execution Throttling](https://awesome-repositories.com/f/development-tools-productivity/execution-throttling.md) — Limits the execution frequency of external scripts to ensure the main thread remains available for critical user interactions. ([source](https://partytown.qwik.dev))
- [Execution Filters](https://awesome-repositories.com/f/development-tools-productivity/platform-script-execution/execution-filters.md) — Selects which scripts run within a background worker and which remain on the main thread to balance performance and compatibility. ([source](https://partytown.qwik.dev/configuration))

### Networking & Communication

- [Cross-Origin Networking](https://awesome-repositories.com/f/networking-communication/cross-origin-networking.md) — Routes external script requests through a local proxy to bypass cross-origin restrictions and improve the reliability of third-party asset delivery.
- [Cross-Thread Synchronizers](https://awesome-repositories.com/f/networking-communication/communication-platforms-services/messaging-notification-systems/messaging-reliability/synchronous-message-receivers/cross-thread-synchronizers.md) — Employs synchronous message passing between the main thread and workers to maintain the expected execution flow of legacy scripts.

### Operating Systems & Systems Programming

- [Property Proxying](https://awesome-repositories.com/f/operating-systems-systems-programming/display-windowing/window-property-setters/property-proxying.md) — Intercepts and manages access to global window properties to ensure third-party scripts correctly detect namespaces and object existence in background threads. ([source](https://partytown.qwik.dev/common-services))

### System Administration & Monitoring

- [Service Worker Request Routing](https://awesome-repositories.com/f/system-administration-monitoring/administrative-operations/linux-system-administration/networking/traffic-interception-modification/service-worker-request-routing.md) — Routes external network requests through a local service worker to bypass cross-origin restrictions and cache third-party assets.

### User Interface & Experience

- [Cross-Thread Event Forwarders](https://awesome-repositories.com/f/user-interface-experience/form-and-input-management/interaction-and-event-handling/event-handling-architectures/event-handling/dom-event-listeners/listener-forwarding/cross-thread-event-forwarders.md) — Routes specific function calls and events from the main thread to the background worker to maintain script functionality. ([source](https://partytown.qwik.dev/configuration))
