Skip to content

Instantly share code, notes, and snippets.

@kentcdodds
Last active June 2, 2025 17:03
Show Gist options
  • Save kentcdodds/c3aaa5141f591cdbb0e6bfcacd361f39 to your computer and use it in GitHub Desktop.
Save kentcdodds/c3aaa5141f591cdbb0e6bfcacd361f39 to your computer and use it in GitHub Desktop.
epicshop notifications

Epicshop Notifications

This gist provides notifications for the Epicshop platform. Notifications are loaded on demand and shown to users based on specific criteria.

How Notifications Work

Notifications are defined in the notifications.json5 file. Each notification is an object with the following properties:

  • id: A unique string identifier for the notification.
  • title: The notification title.
  • message: The notification message.
  • type: The notification type (info, warning, or danger).
  • link (optional): A URL for users to learn more.
  • expiresAt (optional): A date after which the notification will no longer be shown.
  • products (optional): An array of product filters (see below).

Product Filtering

The products field allows you to target notifications to specific products or product slugs. If the products field is omitted, the notification will be shown to all users. If present, it should be an array of objects with the following structure:

products: [
  {
    host: 'www.epicai.pro',      // required: the product host
    slug: 'mcp-fundamentals',    // optional: the product slug
  },
  // ...more product filters
]

How filtering works:

  • If products is not specified, the notification is shown to all users.
  • If products is specified, the notification is only shown if the current product's host matches one of the host values in the array.
  • If a slug is provided in a product filter, the notification is only shown if both the host and slug match the current product.
  • If a product filter only specifies host (no slug), the notification is shown to all users of that host, regardless of slug.

Example:

{
	id: 'new-feature',
	title: 'Check out our new feature!',
	message: 'We just launched something awesome.',
	type: 'info',
	products: [
		{ host: 'www.epicai.pro' }, // All users on epicai.pro
		{ host: 'another.host.com', slug: 'special-course' }, // Only users on another.host.com/special-course
	],
	expiresAt: null, // never expire
}

Notification Lifecycle

  • Notifications are fetched from this gist and parsed as JSON5.
  • Expired notifications (where expiresAt is in the past) are filtered out.
  • Product filtering is applied as described above.
  • Users can mute notifications, which hides them in the future.
[
{
id: 'introducing-mcp-server-2025-06-02',
title: 'Introducing the epicshop MCP Server',
message: 'Use natural language to interact with this workshop and enhance your learning experience.',
type: 'info',
link: 'https://www.epicai.pro/your-ai-assistant-instructor-the-epicshop-mcp-server-0eazr',
expiresAt: null,
},
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment