Simple React example showing how to integrate Docsie documentation, secured docs with JWT, and in-app help widgets. Built with Vite and React Router.
Clone and run:
git clone https://github.com/PhilippeTrounev/react-docsie-sample.git
cd react-docsie-sample
npm install
npm run devThree complete examples included:
- Public Documentation (
/) - Embed documentation without authentication - Secured Documentation (
/secure) - JWT-authenticated access with fallback login - In-App Help (
/inapp-help) - Interactive help widget with search and tours
src/pages/PublicDocs.jsx:
import { useEffect } from 'react';
export default function PublicDocs() {
useEffect(() => {
const link = document.createElement('link');
link.rel = 'stylesheet';
link.href = 'https://lib.docsie.io/current/styles/docsie.css';
document.head.appendChild(link);
const script = document.createElement('script');
script.async = true;
script.src = 'https://lib.docsie.io/current/service.js';
script.setAttribute('data-docsie', 'docsie_pk_key:deployment_YOUR_ID');
document.body.appendChild(script);
return () => {
if (link.parentNode) link.parentNode.removeChild(link);
if (script.parentNode) script.parentNode.removeChild(script);
};
}, []);
return <div data-ddsroot></div>;
}Generate JWT tokens on your backend (Node.js example):
import jwt from 'jsonwebtoken';
app.get('/api/docsie-token', (req, res) => {
const token = jwt.sign(
{},
process.env.DOCSIE_MASTER_KEY,
{ algorithm: 'HS256', expiresIn: '1h' }
);
res.json({ token });
});Then use in React:
const response = await fetch('/api/docsie-token');
const { token } = await response.json();
script.setAttribute('data-docsie',
`docsie_pk_key:deployment_ID,authorizationToken:${token}`
);Add contextual help to your React application:
useEffect(() => {
const script = document.createElement('script');
script.src = 'https://lib.docsie.io/inapp/current/service.js';
script.setAttribute('data-docsie-inapp',
'deploykey:help_center_ID,selfInit:true,search:true,tours:true'
);
document.body.appendChild(script);
return () => {
if (script.parentNode) script.parentNode.removeChild(script);
};
}, []);Features:
- Contextual search within your app
- Knowledge base access
- Smart tagging for relevant content
- Interactive onboarding tours
- Multi-language support
src/
├── pages/
│ ├── PublicDocs.jsx # Public documentation
│ ├── SecureDocs.jsx # JWT-secured documentation
│ └── InAppHelp.jsx # In-app help widget
├── App.jsx # Router and navigation
└── App.css # Styling
Embed product documentation directly in your React app. Users get contextual help without leaving your application. Supports versioning to match your software releases.
Create interactive API documentation portals. Include code examples, request/response samples, and authentication guides. Version your API docs alongside your API releases.
Build self-service knowledge bases for customer support. Reduce support tickets by providing searchable documentation. Track which articles users read most.
Add contextual help tooltips and guides within your application. Improve user onboarding and feature discovery. Update help content without redeploying your app.
Host developer documentation, architecture guides, and internal wikis. Keep technical docs version-controlled and synced with your codebase.
Build customer-facing help centers within your SaaS application. Secure documentation per customer using multi-tenant authentication. Brand documentation to match your company style.
- Node.js 18+
- React 18+
- Modern web browser
- Docsie account
Documentation not loading?
- Check browser console for errors
- Verify deployment ID is correct
- Ensure script URL is
service.jsnotstyles.js
JWT authentication failing?
- Verify master key matches your deployment
- Check token hasn't expired (1 hour default)
- Validate token format at jwt.io
In-app help not appearing?
- Check that help center ID is correct
- Verify script loaded without errors
- Ensure no conflicting z-index CSS
- Blazor WebAssembly - Client-side Blazor
- Razor Pages - ASP.NET server-side
- Vue.js integration (coming soon)
- Next.js integration (coming soon)
- Angular integration (coming soon)
- Discord: https://discord.gg/rptfXQnq
- Email: hello@docsie.io
- Issues: GitHub Issues
MIT