Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.replyke.com/llms.txt

Use this file to discover all available pages before exploring further.

Quick Start Guide

This guide will have you up and running with Replyke comment components in under 5 minutes.

Before You Begin

  • ✅ Node.js 18+ installed
  • ✅ A React, React Native, or Expo project
  • ✅ A Replyke project created

Step 1: Initialize the CLI

Run the init command in your project directory:
cd your-project
npx @replyke/cli init

Answer the prompts:

1

Select Platform

? Which platform are you using?
❯ React (Web)
  React Native
  Expo
2

Choose Styling

? Which styling approach do you prefer?
❯ Tailwind CSS
  Inline Styles
  • Select Tailwind CSS if you use Tailwind
  • Select Inline Styles otherwise
3

Set Component Path

? Where should components be installed? (src/components)
Press Enter to use the default, or type a custom path.
The CLI creates a replyke.json configuration file and checks for required dependencies.

Step 2: Install Dependencies (if needed)

npm install @replyke/react-js
The CLI will prompt you to install these automatically if they’re missing.

Step 3: Add a Component

npx @replyke/cli add comments-threaded
Reddit-style discussions with unlimited nesting, upvote/downvote, threading lines, and collapsible threads.
The CLI copies ~25 source files into your project and shows a usage example.

Step 4: Set Up ReplykeProvider

Wrap your app (or the relevant section) with ReplykeProvider:
// App.tsx
import { ReplykeProvider } from '@replyke/react-js';

function App() {
  return (
    <ReplykeProvider
      projectId="your-project-id"
      signedToken={yourAuthToken}
    >
      {/* Your app content */}
    </ReplykeProvider>
  );
}
For authentication setup and obtaining signedToken, see the Authentication guide.

Step 5: Use the Component

// BlogPost.tsx
import { ThreadedCommentSection } from './components/comments-threaded';

function BlogPost({ post }) {
  return (
    <div>
      <h1>{post.title}</h1>
      <p>{post.content}</p>
      <ThreadedCommentSection entityId={post.id} />
    </div>
  );
}
That’s it! You now have a fully functional comment system.

Complete Example

import { useEffect, useState } from 'react';
import { ReplykeProvider, useSignTestingJwt } from '@replyke/react-js';
import { ThreadedCommentSection } from './components/comments-threaded';

const PROJECT_ID = import.meta.env.VITE_PUBLIC_REPLYKE_PROJECT_ID;
const PRIVATE_KEY = import.meta.env.VITE_PUBLIC_REPLYKE_SECRET_KEY;

const DUMMY_USER = { id: 'user1', username: 'tech_developer' };

function App() {
  const signTestingJwt = useSignTestingJwt();
  const [signedToken, setSignedToken] = useState<string>();

  useEffect(() => {
    const handleSignJwt = async () => {
      const token = await signTestingJwt({
        projectId: PROJECT_ID,
        privateKey: PRIVATE_KEY,
        payload: DUMMY_USER,
      });
      setSignedToken(token);
    };
    handleSignJwt();
  }, []);

  return (
    <ReplykeProvider projectId={PROJECT_ID} signedToken={signedToken}>
      <div className="max-w-4xl mx-auto p-8">
        <h1>My Blog Post</h1>
        <p>This is my awesome blog post content...</p>
        <ThreadedCommentSection entityId="blog-post-123" />
      </div>
    </ReplykeProvider>
  );
}

export default App;

What Gets Installed

src/components/comments-threaded/
├── index.ts
├── components/          # ~20 UI component files
│   ├── threaded-comment-section.tsx
│   ├── new-comment-form.tsx
│   ├── comments-feed/
│   └── modals/
├── hooks/
├── utils/
└── context/
All files are editable TypeScript/TSX, documented with inline comments, and committed to your repo.

Troubleshooting

Make sure the import path matches your paths.components in replyke.json:
// paths.components = "src/components"
import { ThreadedCommentSection } from './components/comments-threaded';

// paths.components = "app/ui"
import { ThreadedCommentSection } from './ui/comments-threaded';
  1. Check that <ReplykeProvider> wraps the component
  2. Verify projectId and signedToken are correctly set
  3. Check the browser console for errors
Ensure your tsconfig.json includes the components directory:
{ "include": ["src/**/*"] }
Set darkMode: 'class' in tailwind.config.js and add a dark class to a parent element:
<html className={isDark ? 'dark' : ''}>

Next Steps

Props API

Learn about available props and options

File Structure

Understand the installed file organization

Customization

Customize colors, layout, and functionality

Styling Variants

Inline styles vs Tailwind CSS