This comment system uses GitHub Gists API to store comments. All comments are stored in a single gist, organized by story ID.
- Go to: https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Give it a name: "Portfolio Comments"
- Select scope:
gist(check the box) - Click "Generate token"
- Copy the token immediately (you won't see it again!)
- Go to: https://gist.github.com
- Click "Create a new gist"
- Filename:
comments.json - Initial content:
{} - Choose Public or Secret (both work)
- Click "Create public gist" or "Create secret gist"
- Copy the Gist ID from the URL:
- URL format:
https://gist.github.com/rayraycodes/{GIST_ID} - Example: If URL is
https://gist.github.com/rayraycodes/abc123def456, then Gist ID isabc123def456
- URL format:
- Open:
src/config/github.config.ts - Update these values:
gistId: 'your-gist-id-here', // Paste your Gist ID token: 'your-token-here', // Paste your Personal Access Token (optional - users can enter their own)
- Save the file
You can set a default token in the config file, or users can enter their own token when posting comments. If you set a default token:
- All users can post comments using your token
- Comments will appear under your GitHub account
- Security Note: The token will be visible in the client-side code
Better approach: Leave token empty and let users enter their own tokens (stored in localStorage).
- Reading Comments: Public - anyone can read comments without authentication
- Posting Comments: Requires GitHub token with 'gist' scope
- Storage: All comments stored in a single gist file (
comments.json) - Organization: Comments organized by story ID in JSON format:
{ "story-id-1": [ { "id": "...", "name": "...", "message": "...", "timestamp": ... } ], "story-id-2": [...] }
- Viewing Comments: Anyone can view comments without any setup
- Posting Comments:
- User enters name and message
- If no token is configured, user will be prompted to enter their GitHub token
- Token is stored in localStorage for future use
- User can post comments using their own GitHub account
- Public Gist: Comments are publicly visible
- Token Security: If you set a default token, it will be visible in client-side code
- Recommendation: Use user-provided tokens stored in localStorage, or implement a server-side proxy
"Gist ID not configured" error:
- Make sure you've set
gistIdinsrc/config/github.config.ts
"Failed to load comments" error:
- Check that the gist exists and is accessible
- Verify the gist ID is correct
"GitHub token required" error:
- User needs to provide a GitHub token with 'gist' scope
- Token can be entered when posting a comment
- Token is saved in localStorage for future use
"Failed to save comment" error:
- Check that the token has 'gist' scope
- Verify the token is valid and not expired
- Make sure the gist exists and is accessible
export const githubConfig = {
username: 'rayraycodes',
gistId: 'abc123def456', // Your gist ID
token: '', // Leave empty for user-provided tokens
filename: 'comments.json',
};