Contentful Apps

repository·master·Indexed 41 days ago

https://github.com/contentful/apps

A collection of source code for Contentful Marketplace apps and foundational packages for building custom apps. Includes tools for app migration, bootstrapping via create-contentful-app, and documentation for specific apps such as the Audit Log Viewer and Adobe Experience Manager Asset Selector.

Tokens
154.4K
Snippets
516
Records
755
Agent score
51%

What's inside Contentful Apps

  1. Overview of Phosphor Icon App

    master

    Phosphor Icon is a Contentful field app that enables editors to search the Phosphor icon library directly within the Contentful interface. When an icon is selected, the app stores a lightweight JSON payload containing the following information:

    • name: The selected icon name.
    • componentName: The React component name.
    • weight: The icon weight (e.g., regular, bold, etc.).
    • position: The icon position (e.g., start or end).
  2. Overview of Audit Log Viewer

    master

    The Audit Log Viewer is a Contentful App that allows you to view and filter your organization's audit logs directly within the Contentful web interface. It retrieves logs delivered to your own cloud storage (AWS S3, Azure Blob, or Google Cloud Storage) and renders them in tables and charts.

    Security Model: To ensure security, the browser never sees your cloud credentials. Instead, a Contentful-hosted App Action Function (the auditLogBroker) uses your secret credentials to generate short-lived (15-minute) time-limited GET URLs (S3 presigned, Azure SAS, or GCS V4-signed). The browser then uses these URLs to fetch and parse the log files directly from your storage provider.

  3. Overview of Contentful Link Checker

    master

    Contentful Link Checker is an app that runs in the entry sidebar. It automates the process of finding and validating URLs within an entry's Symbol and Text fields.

    Key Features

    • URL Extraction: Automatically reads sdk.entry.fields and extracts URLs from Symbol and Text fields using a standard regex. It normalizes www. links to https://... to ensure they are treated as external web URLs.
    • Server-side Link Checking: To avoid CORS issues and support static hosting, link checking is performed via a Contentful App Function (Premium/Partners) invoked as an App Action. There is no browser-based fetch fallback.
    • Allow/Deny Lists:
      • Allow List: A comma-separated list of hostnames. Any URL whose hostname does not match or fall under these is flagged as invalid before a network request is made.
      • Deny List: A comma-separated list of hostnames. Any URL matching these is immediately marked invalid without an HTTP check.
    • UI: Provides a "Check links" button, progress indicators, and a results list that distinguishes between allow-list failures, deny-list failures, and HTTP/network errors.
  4. Understand the contentful/apps monorepo structure

    master

    The contentful/apps repository is a Lerna + Nx monorepo containing first-party Contentful Marketplace apps and shared base libraries.

    Repository Layout

    • apps/: Contains individual Contentful apps (e.g., ai-content-generator, jira).
    • packages/: Contains shared libraries published to npm, such as @contentful/dam-app-base and @contentful/ecommerce-app-base.
    • examples/: Example apps for external developers.
    • function-examples/: Examples for App Functions.
    • scripts/: Repository-level tooling scripts.

    Monorepo Tooling

    • Lerna 6: Orchestrates lifecycle commands like bootstrap, build, test, and publish. It uses independent versioning, meaning each package has its own version.
    • Nx: Provides build caching for build, test, and lint operations.
    • CircleCI: Handles CI/CD pipelines.

    Critical Commands

    • lerna bootstrap: Must be run before building to install and link cross-package dependencies.
    • lerna run <command> --since <ref>: Use the --since flag (e.g., --since master) to run commands only against changed packages. Warning: Running lerna run build without --since will attempt to build all 56+ apps in the repository.
  5. Deep Clone entries in Contentful

    master

    The Deep Clone app allows you to perform a deep clone of an entry, including all of its referenced entries. This overcomes the default Contentful web app behavior, which only clones the top-level entry and ignores references.

    Note: Assets are currently not cloned by this application.

  6. Resources for Contentful App Development

    master

    When building apps, you can leverage the following resources:

  7. What is an App Event Handler Function?

    master

    App event handler functions are serverless functions that run on Contentful's infrastructure to perform actions in response to specific events in your Contentful space. Unlike filter functions (which only decide if an event should be processed), handlers execute logic such as:

    • Sending notifications to external systems
    • Synchronizing content with third-party services
    • Creating audit logs or analytics
    • Triggering external workflows
  8. What is an App Action Function?

    master

    App Action functions are serverless workloads running on Contentful's infrastructure. Unlike event-based functions that react to system events, App Action functions are explicitly invoked by an app or external system with specific parameters to perform an operation.

    Common use cases:

    • Bulk content operations
    • Data synchronization between environments or spaces
    • Integration with external services and APIs
    • Content transformation and migration
    • Custom content validation or enrichment
  9. What is the Kitchen Sink Function Template?

    master

    The Kitchen Sink Function Template is a unified codebase that allows you to manage multiple Contentful Management function types within a single function bundle. It uses a main handler to route incoming requests to specific sub-handlers based on the event.type.

    Supported function types:

    • App Action: Invoked directly by apps to perform operations.
    • App Event Handler: Reacts to Contentful events (e.g., entry publishing).
    • App Event Filter: Determines if an event should be processed.
    • App Event Transformation: Modifies event payloads before delivery.