---
source_url: https://www.pubnub.com/docs/serverless/functions/functions-apis/functions-libraries
title: Functions Modules
updated_at: 2026-06-04T11:13:42.621Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Functions Modules

Functions modules are pre‑installed JavaScript libraries you can use inside a PubNub Function. They add common capabilities so you build faster without external dependencies.

Import a library with `require()`:

```javascript
const xhr = require('xhr'); // Example import
```

Available modules:

| Library Name | Description |
| --- | --- |
| [XHR](https://www.pubnub.com/docs/serverless/functions/functions-apis/xhr-module) | Send HTTP/HTTPS requests and load response data in a Function. Useful for third‑party auth or triggering webhooks. |
| [KV Store](https://www.pubnub.com/docs/serverless/functions/functions-apis/kvstore-module) | Persistent key‑value store shared at the Subscribe Key level. |
| [Advanced Math](https://www.pubnub.com/docs/serverless/functions/functions-apis/advanced-math-module) | Global (lat‑long) coordinate and geometry helpers. |
| [Crypto](https://www.pubnub.com/docs/serverless/functions/functions-apis/crypto-module) | Encrypt and decrypt data in a Function. |
| [Utils](https://www.pubnub.com/docs/serverless/functions/functions-apis/utilities-module) | Utility helpers for common tasks. |
| [Codec/auth](https://www.pubnub.com/docs/serverless/functions/functions-apis/codec-module#basic-auth-header) | Encode HTTP Basic Auth credentials. |
| [Codec/base64](https://www.pubnub.com/docs/serverless/functions/functions-apis/codec-module#encode-base64) | Encode and decode Base64 strings. |
| [Codec/query_string](https://www.pubnub.com/docs/serverless/functions/functions-apis/codec-module#parse-query-string) | Encode and decode URI query parameters. |
| [PubNub](https://www.pubnub.com/docs/serverless/functions/functions-apis/pubnub-module) | Access many client SDK features from a Function. |
| [Vault](https://www.pubnub.com/docs/serverless/functions/functions-apis/vault-module) | Read‑only secrets storage. |
| [UUID](https://www.pubnub.com/docs/serverless/functions/functions-apis/uuid) | Generate RFC‑compliant UUIDs. |
| [JWT](https://www.pubnub.com/docs/serverless/functions/functions-apis/jwt) | Create and verify JSON Web Tokens. |
| [JSONPath Plus](https://www.pubnub.com/docs/serverless/functions/functions-apis/jsonpath-plus) | Query and transform JSON and JavaScript objects. |
| [UGC Moderate Message](https://www.pubnub.com/docs/serverless/functions/functions-apis/ugc-module) | Moderate user‑generated content inline via `ugc.moderateMessage`. Returns actions and optional transforms. |

:::note Features not available in Functions
The Functions runtime provides a curated JavaScript environment optimized for reliability and speed.
* Native Node modules
* Access to `process` and some other globals
* Installing third‑party modules via npm
* WebSocket connections — Functions only support outbound HTTP requests (via the [XHR module](https://www.pubnub.com/docs/serverless/functions/functions-apis/xhr-module)) and PubNub API calls (via the [PubNub module](https://www.pubnub.com/docs/serverless/functions/functions-apis/pubnub-module)). WebSocket support is not currently available.
:::

## Terms in this document

* **PubNub** - PubNub is a real-time messaging platform that provides APIs and SDKs for building scalable applications. It handles the complex infrastructure of real-time communication, including: Message delivery and persistence, Presence detection, Access control, Push notifications, File sharing, Serverless processing with Functions and Events & Actions, Analytics and monitoring with BizOps Workspace, AI-powered insights with Illuminate.
