Package Exports
- @guesttalk/core
- @guesttalk/core/adapters
- @guesttalk/core/react
- @guesttalk/core/redis
- @guesttalk/core/server
- @guesttalk/core/sql
- @guesttalk/core/styles.css
Readme
@guesttalk/core
A server-side comment system for Next.js with zero runtime dependencies. It
renders on the server and keeps comments in your own database. You bring the
database, the auth, an optional cache, and the content renderer — GuestTalk
wires them together. Markdown is a one-line opt-in via the separate
@guesttalk/markdown package.
What you get
- Zero dependencies in the core. Installing
@guesttalk/corepulls in nothing of its own. Every external piece — database, cache, auth, Markdown — is bring-your-own, so you only carry what you use. - Storage you control. One adapter,
createSqlStorage, runs on Prisma, Drizzle, or any raw SQL client, and pulls in no database dependency of its own. Prefer to wire it by hand? Implement the storage interface against anything. - Auth stays yours. Resolve the current user in
beforeHandleand GuestTalk trusts it. User data lives oncomment.metadata.user. - Rendering you choose. Bodies render as safe, escaped plain text by default
(no dependencies). Opt into sanitized Markdown with one line —
createMarkdownRenderer()from@guesttalk/markdown— or pass your ownrenderContent. - No CSS shipped. Components only emit stable class names. Use the optional
@guesttalk/core/styles.csstheme, override the--gt-*variables, or write your own rules. - Write hooks to validate, reject, or react to every create, update, and delete.
Install
bun add @guesttalk/corePeer deps: next >= 13.4, react >= 18, react-dom >= 18. @guesttalk/core
has no runtime dependencies of its own. Add whatever database client you already
use (@prisma/client, pg, mysql2, better-sqlite3, and so on); for Markdown
bodies, also bun add @guesttalk/markdown (it carries marked +
sanitize-html).
Quickstart
// app/lib/guesttalk.ts
import { createGuestTalk } from "@guesttalk/core/server"
import { createSqlStorage } from "@guesttalk/core/sql"
export const guesttalk = createGuestTalk({
storage: createSqlStorage({
dialect: "postgres", // "mysql" | "sqlite"
driver: {
query: (sql, params) => prisma.$queryRawUnsafe(sql, ...params),
execute: (sql, params) => prisma.$executeRawUnsafe(sql, ...params).then(() => {}),
},
}),
allowAnonymous: true,
})// app/api/guesttalk/[...guesttalk]/route.ts
import { createAppHandler } from "@guesttalk/core/server"
import { guesttalk } from "@/app/lib/guesttalk"
export const { GET, POST } = createAppHandler({ service: guesttalk })import { CommentSection } from "@guesttalk/core/react"
import "@guesttalk/core/styles.css" // optional default theme
<CommentSection threadId="post-slug" />Create the table once from the DDL that guestTalkSchemaSql("postgres")
returns — GuestTalk does not run migrations. Run bun run demo for a working
app.
Exports
| Entry | What it holds |
|---|---|
@guesttalk/core |
Environment-safe surface: types, errors, the ContentRenderer contract + plaintextRenderer, constants, and the framework-agnostic client. |
@guesttalk/core/server |
createGuestTalk, the App Router (createAppHandler) and Pages Router (createPagesHandler) handlers, and createServerLoader for RSC. |
@guesttalk/core/react |
CommentSection, CommentForm, the provider, and hooks (client components). |
@guesttalk/core/sql |
createSqlStorage and guestTalkSchemaSql (postgres / mysql / sqlite). |
@guesttalk/core/adapters |
The StorageHelper, CacheHelper, and receiver contracts for bring-your-own implementations. |
@guesttalk/core/redis |
createRedisCache — optional L1 + L2 Redis cache with prefix invalidation. |
@guesttalk/core/styles.css |
Optional default theme, scoped to .guesttalk* with --gt-* tokens. |
Docs
Full guides live in the repository:
- Storage adapters
- Configuration: identity, permissions, Markdown, styling, Redis caching.
- API reference: HTTP routes and the React API.
License
MIT