Official JavaScript/TypeScript SDKs for Blar - AI-powered issue diagnostics for modern applications.
@blario/nextjs is now available on npm! π
- Version: 0.1.0-alpha.1
- Status: Alpha (expect breaking changes)
- Install:
npm install @blario/nextjs@alpha - NPM: https://www.npmjs.com/package/@blario/nextjs
| Package | Version | Status | Description |
|---|---|---|---|
@blario/nextjs |
Alpha | Next.js SDK with React components | |
@blario/react |
- | Planning | Framework-agnostic React SDK |
@blario/node |
- | Planning | Node.js server SDK |
@blario/browser |
- | Planning | Vanilla JavaScript browser SDK |
Important: @blario/nextjs requires Tailwind CSS to be installed and properly configured in your Next.js project.
# Install the package
npm install @blario/nextjs@alpha
# You also need Tailwind CSS and tailwindcss-animate
npm install -D tailwindcss tailwindcss-animate autoprefixer postcss
# Or with pnpm
pnpm add @blario/nextjs@alpha
pnpm add -D tailwindcss tailwindcss-animate autoprefixer postcssUpdate your tailwind.config.ts to include the Blario preset and scan the package files:
// tailwind.config.ts
import type { Config } from 'tailwindcss';
import preset from '@blario/nextjs/tailwind-preset';
const config: Config = {
presets: [preset],
darkMode: "class",
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
// β οΈ REQUIRED: Scan @blario/nextjs for Tailwind classes
'./node_modules/@blario/nextjs/dist/**/*.{js,ts,jsx,tsx,mjs,cjs}',
],
theme: {
extend: {
// Your custom theme extensions
},
},
};
export default config;Note: The content path for @blario/nextjs is required for the component styles to work properly.
Create a .env.local file:
NEXT_PUBLIC_BLARIO_PUBLISHABLE_KEY=your-publishable-key-hereSince BlarioProvider uses React Context, wrap it in a Client Component:
// app/providers.tsx
'use client';
import { BlarioProvider } from '@blario/nextjs';
export function Providers({ children }: { children: React.ReactNode }) {
return (
<BlarioProvider
publishableKey={process.env.NEXT_PUBLIC_BLARIO_PUBLISHABLE_KEY!}
config={{
// Optional: Configure user info
user: {
id: 'user-123',
email: '[email protected]',
name: 'John Doe',
},
// Optional: Customize theme
theme: {
position: 'bottom-right', // or 'bottom-left', 'top-right', 'top-left'
},
}}
>
{children}
</BlarioProvider>
);
}// app/layout.tsx
import './globals.css'; // Your global styles with Tailwind directives
import { Providers } from './providers';
import type { Metadata } from 'next';
export const metadata: Metadata = {
title: 'Your App',
description: 'Your app description',
};
export default function RootLayout({
children
}: {
children: React.ReactNode
}) {
return (
<html lang="en">
<body>
<Providers>{children}</Providers>
</body>
</html>
);
}Ensure your globals.css includes Tailwind directives:
/* app/globals.css */
@tailwind base;
@tailwind components;
@tailwind utilities;// app/page.tsx or any page/component
import { IssueReporterButton } from '@blario/nextjs';
export default function Page() {
return (
<div>
{/* Your page content */}
{/* Floating button (appears in corner based on theme.position) */}
<IssueReporterButton />
{/* Or inline button variant */}
<IssueReporterButton variant="inline">
Report an Issue
</IssueReporterButton>
</div>
);
}- π€ AI-Powered Diagnostics - Instant analysis and suggested fixes
- π¨ Drop-in Components - Pre-built UI with shadcn/ui
- π Auto Context Capture - Browser, console, network data
- π‘οΈ Privacy-First - Built-in PII redaction
- β‘ Lightweight - < 25KB gzipped
- π i18n Ready - Internationalization support
- βΏ Accessible - WCAG 2.1 AA compliant
- π― TypeScript - Full type safety
This monorepo uses:
- pnpm workspaces for package management
- Changesets for versioning and publishing
- Vitest for testing
- TypeScript for type safety
- ESLint & Prettier for code quality
- GitHub Actions for CI/CD
- Node.js 18+
- pnpm 8+
# Install dependencies
pnpm install
# Build all packages
pnpm build
# Run tests
pnpm test
# Run linting
pnpm lint
# Format code
pnpm format# Navigate to specific package
cd packages/nextjs
# Development mode with watch
pnpm dev
# Run package tests
pnpm test
# Build package
pnpm buildUse pnpm link to test packages in your application:
# In the package directory
cd packages/nextjs
pnpm link
# In your application
pnpm link @blario/nextjsProblem: You're getting TypeError: createContext is not a function when using BlarioProvider.
Solution: The BlarioProvider must be used in a Client Component. Make sure to:
- Create a separate
providers.tsxfile with'use client'directive - Wrap the BlarioProvider in that file
- Import the wrapper in your layout (see setup instructions above)
Problem: Getting undefined for publishableKey.
Solution:
- Ensure your env variable starts with
NEXT_PUBLIC_prefix - Restart your Next.js dev server after adding env variables
- Check that
.env.localis in your project root
Problem: Components appear unstyled or broken.
Solution:
- Ensure Tailwind CSS is installed and configured
- Add the package path to your
tailwind.config.tscontent array:
content: [
// ... your app paths
'./node_modules/@blario/nextjs/dist/**/*.{js,ts,jsx,tsx,mjs,cjs}',
]- Use the Blario Tailwind preset:
import preset from '@blario/nextjs/tailwind-preset';
const config: Config = {
presets: [preset],
// ...
};Problem: Getting type errors when importing components.
Solution: Ensure your tsconfig.json has:
{
"compilerOptions": {
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true
}
}We welcome contributions! Please see our Contributing Guide for details.
When making changes:
# Create a changeset
pnpm changeset
# Select the packages and type of change
# Write a summary of your changesWe follow Conventional Commits:
feat:New featuresfix:Bug fixesdocs:Documentation changeschore:Maintenance taskstest:Test updatesrefactor:Code refactoring
- All data transmission uses HTTPS
- Automatic PII redaction
- No tracking cookies
- SOC 2 Type II compliant infrastructure
For security issues, please email [email protected] instead of using GitHub issues.
For enterprise features including:
- SSO/SAML authentication
- Advanced analytics
- SLA support
- Custom deployment options
Contact [email protected]
MIT Β© Blar Inc.
See LICENSE for more information.
Built with:
Made with β€οΈ by the Blar team