live-comments
v0.1.3
Published
Drop-in comment/pin widget for Next.js apps — let external reviewers leave feedback on any page element
Readme
live-comments
Drop-in comment widget for Next.js apps. Let clients and reviewers leave feedback directly on your pages — pinned to specific elements or as general notes. No account needed for reviewers, just a name.
Features
- Element pinning — pin comments to any page element (images, text, buttons, etc.)
- General comments — leave page-level feedback
- Visual pin indicators — floating comment cards on pinned elements
- Cross-page navigation — click a comment to jump to the pinned element, even on other pages
- Admin moderation — resolve and delete comments (env-var auth)
- Email notifications — notify the site owner via SMTP when reviewers submit feedback
- Multi-project support — share one database across projects, scoped by site ID
- Zero CSS conflicts — fully styled with prefixed Tailwind
- Portuguese (PT-PT) UI
Setup
1. Install
npm install live-comments2. Configure environment variables
Add to your .env.local:
# Database (required)
LIVE_COMMENTS_DATABASE_URL=postgres://user:[email protected]/dbname
# Site ID — use a unique value per project sharing the same database
LIVE_COMMENTS_SITE_ID=my-project
# Admin credentials (for resolve/delete)
LIVE_COMMENTS_ADMIN_USERNAME=admin
LIVE_COMMENTS_ADMIN_PASSWORD=secret
# Email notifications (optional)
LIVE_COMMENTS_SMTP_HOST=smtp.gmail.com
LIVE_COMMENTS_SMTP_PORT=587
[email protected]
LIVE_COMMENTS_SMTP_PASS=app-password
[email protected]3. Run database migration
npx live-comments setup4. Add to your layout
// app/layout.tsx
import { LiveComments } from 'live-comments'
import 'live-comments/styles.css'
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
{children}
<LiveComments />
</body>
</html>
)
}5. Update next.config
// next.config.ts
const nextConfig = {
serverExternalPackages: ["pg", "nodemailer"],
}
export default nextConfigHow It Works
- A floating comment button appears in the bottom-right corner
- Click it to open the comments panel or toggle comment mode
- In comment mode, hover over elements to highlight them, click to attach a comment
- Comments persist in your Postgres database
- Admin can log in via the toolbar menu to resolve/delete comments
- "Submeter comentários" sends an email summary to
LIVE_COMMENTS_NOTIFY_EMAIL
Tech Stack
- React client components (no external state library)
- Server actions for all data operations
- PostgreSQL via
pg - Nodemailer for email
- Tailwind CSS with
lc-prefix (no style conflicts)
License
MIT
