npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@beesolve/dmarc-consumer

v0.2.1

Published

DMARC consumer — persists parsed DMARC reports from EventBridge to DynamoDB

Readme

@beesolve/dmarc-consumer

DMARC consumer — persists parsed DMARC reports from EventBridge to DynamoDB and maintains per-domain aggregation counters.

Architecture

┌───────────┐       ┌─────┐       ┌────────┐       ┌──────────┐
│EventBridge│ ────► │ SQS │ ────► │ Lambda │ ────► │ DynamoDB │
└───────────┘       └─────┘       └────────┘       └──────────┘
 DmarcReportParsed    + DLQ        consumer          reports +
                                                     domain aggregates

Subscribes to DmarcReportParsed events emitted by @beesolve/dmarc-reports, persists them to DynamoDB, and maintains running domain-level counters (total messages, pass, fail).

Installation

npm install @beesolve/dmarc-consumer

CDK Usage

import { DmarcConsumer } from "@beesolve/dmarc-consumer/cdk";

const consumer = new DmarcConsumer(this, "DmarcConsumer");

// Grant read access to your dashboard Lambda (sets DMARC_TABLE_NAME and DMARC_REVERSE_INDEX env vars)
consumer.grantRead(dashboardLambda);

// Or read/write access
consumer.grantReadWrite(adminLambda);

The construct provisions:

  • DynamoDB table (on-demand, composite key pk/sk, reverse GSI, TTL)
  • Lambda consumer (Node.js 24, 256 MB, 30s timeout)
  • SQS queue with dead-letter queue
  • EventBridge rule matching source: "dmarc-reports" + detail-type: "DmarcReportParsed"

Querying Data

List all monitored domains

import { DynamoDBDocumentClient } from "@aws-sdk/lib-dynamodb";
import { DynamoDBClient } from "@aws-sdk/client-dynamodb";
import { Domains } from "@beesolve/dmarc-consumer/domain";

const dynamo = DynamoDBDocumentClient.from(new DynamoDBClient(), {
  marshallOptions: { removeUndefinedValues: true, convertEmptyValues: false },
});

const domains = new Domains({
  dynamo,
  tableName: process.env.DMARC_TABLE_NAME!,
  reverseIndexName: process.env.DMARC_REVERSE_INDEX!,
});

const allDomains = await domains.list();
// [{ domain: "example.com", totalMessages: 15420, totalPass: 15100, totalFail: 320 }, ...]

Query reports by domain

import { Reports } from "@beesolve/dmarc-consumer/report";

const reports = new Reports({
  dynamo,
  tableName: process.env.DMARC_TABLE_NAME!,
});

// Paginated, newest first
const { reports: domainReports, cursor } = await reports.queryByDomain({
  domain: "example.com",
  startTime: 1704067200, // optional: Unix timestamp
  endTime: 1706745600, // optional: Unix timestamp
  limit: 20, // default: 50
});

// Fetch next page
const nextPage = await reports.queryByDomain({
  domain: "example.com",
  cursor,
});

DynamoDB Schema

| pk | sk | Description | | -------------------- | ----------------------------------------- | ------------------------------------------------------ | | domain#example.com | domain | Domain aggregate (totalMessages, totalPass, totalFail) | | domain#example.com | report#{timestamp}#{orgName}#{reportId} | Individual report |

The reverse GSI (sk as partition key) enables listing all domains by querying sk = "domain".

Consumer Behavior

  1. Parses each SQS record against the DmarcReportParsedEvent schema
  2. Batch-persists valid reports (chunks of 25 for DynamoDB limits)
  3. Atomically increments domain aggregate counters via ADD expressions
  4. Returns failed message IDs for SQS partial batch failure (retry via DLQ)
  5. Domain upsert failures are logged but do not block report persistence

License

MIT