Widget
Widget Setup
Step-by-step guide to installing and configuring the EpicContext Widget in your web application.
This guide walks you through installing the EpicContext Widget in your web application and configuring it for your team.
Prerequisites
- An EpicContext project with an API key (generate one in Settings > General)
- A web application where you want to embed the widget
Installation
Add the widget script to your HTML, just before the closing </body> tag:
<script src="https://your-epicontext-instance.com/widget.js"></script>
<script>
EpicContext.init({
projectId: 'your-project-id',
apiKey: 'your-api-key'
});
</script>
The widget loads asynchronously and won't block your page rendering.
Use proxy mode in production
The example above uses direct mode with the API key in the browser. For production, use proxy mode to keep your API key server-side. See the Proxy Mode section below.
Configuration Options
EpicContext.init({
// Required
projectId: 'your-project-id',
// Authentication (choose one)
apiKey: 'your-api-key', // Direct mode (development only)
proxyUrl: '/api/epicontext', // Proxy mode (production)
// Optional
theme: 'light', // 'light' or 'dark'
position: 'bottom-right', // Widget button position
delay: 300, // Hover delay in ms
});
| Option | Type | Default | Description |
|---|---|---|---|
projectId | string | required | Your EpicContext project ID |
apiKey | string | — | API key for direct mode (dev only) |
proxyUrl | string | — | URL of your proxy endpoint (production) |
theme | string | 'light' | Widget theme: 'light' or 'dark' |
position | string | 'bottom-right' | Button position on screen |
delay | number | 300 | Tooltip hover delay in milliseconds |
Proxy Mode Setup
In production, use a server-side proxy to keep your API key secure.
Next.js Example
Create an API route that forwards requests to EpicContext:
// app/api/epicontext/route.ts
import { NextRequest, NextResponse } from 'next/server';
export async function GET(request: NextRequest) {
const url = new URL(request.url);
const blockKey = url.searchParams.get('block');
const response = await fetch(
`https://epiccontext.com/api/v1/projects/${process.env.EPICONTEXT_PROJECT_ID}/blocks/${blockKey}`,
{
headers: {
'X-API-Key': process.env.EPICONTEXT_API_KEY!,
},
}
);
return NextResponse.json(await response.json());
}
Then initialize the widget with proxyUrl instead of apiKey:
EpicContext.init({
projectId: 'your-project-id',
proxyUrl: '/api/epicontext'
});
Express Example
app.get('/api/epicontext', async (req, res) => {
const { block } = req.query;
const response = await fetch(
`https://epiccontext.com/api/v1/projects/${process.env.EPICONTEXT_PROJECT_ID}/blocks/${block}`,
{
headers: { 'X-API-Key': process.env.EPICONTEXT_API_KEY },
}
);
res.json(await response.json());
});
Adding Context References
Attach product context to parts of your application using data-epicontext attributes:
<section data-epicontext="checkout-flow-feature">
<!-- Your checkout UI -->
</section>
<nav data-epicontext="navigation-ia-tree">
<!-- Your navigation -->
</nav>
The attribute value should match a block key in your EpicContext project. When team members activate the widget, they'll see the relevant product context for that part of the application — including the design decisions, user personas, and feature specifications behind it.
Creating User Stories
With the widget active, team members can create user stories directly from the application:
Activate the widget
Click the EpicContext widget button in the corner of your application.
Select a reference point
Click on the part of the application the user story relates to.
Write the story
Describe the desired behavior or change. The widget automatically links the story to the referenced part of the application and any attached product context.
Submit
The user story is created as a user_story block in your EpicContext project and appears in your dashboard.
User stories created through the widget reference a specific part of your application — no screenshots needed. The reference connects the story to the relevant product context automatically.
Leaving Feedback
Feedback and comments work similarly to user stories:
- Activate the widget
- Click on the relevant part of the application
- Type your feedback or comment
- Submit — it syncs to your EpicContext project
Feedback is visible in your project dashboard and can be viewed by your entire team.
Widget Settings in EpicContext
Configure additional widget settings from your project dashboard:
- Go to Settings > Widget
- Configure allowed domains (for CORS)
- Customize the widget appearance
- Copy the embed code with your settings pre-filled
Technical Details
| Property | Value |
|---|---|
| Bundle size | ~41KB uncompressed, ~10KB gzipped |
| Dependencies | Zero — built as a vanilla JS IIFE bundle |
| CSS isolation | Shadow DOM — no conflicts with your styles |
| Build tool | Vite + Terser |
| Loading | Asynchronous — won't block page rendering |
Next Steps
- Learn about team collaboration workflows with the widget
- Explore the API endpoints the widget uses
- Set up AI Coding Agents for development context
Last updated: 2026-02-22