A modern, full-stack community forum platform inspired by Reddit, built with React 18 and Go 1.25.5. GoTalk enables users to create and manage communities, share posts, engage in discussions through comments, vote on content, and discover trending posts and communities.
Note: Portions of the backend implementation were developed with the assistance of AI tools to help with JWT handling and API endpoint design. All code has been reviewed to ensure correctness.
- Overview
- Features
- Technology Stack
- Project Structure
- Getting Started
- API Documentation
- Database Schema
- Component Architecture
GoTalk is a full-stack community forum application that combines a React-based frontend with a Go backend API. The platform allows users to:
- Create and manage communities
- Post content (text, links, or discussion threads)
- Comment on posts and engage in threaded discussions
- Vote on posts and comments
- Discover popular communities and trending posts
- Manage user profiles and community memberships
The application follows modern architectural patterns with:
- Frontend: Component-based React architecture with context-based state management
- Backend: RESTful API built with Chi router, JWT authentication, and SQLite database
- Styling: TailwindCSS for responsive, utility-first design
- β User Registration: Create accounts with username and password
- β Secure Login/Logout: JWT-based token management
- β Session Persistence: HttpOnly cookie storage for secure token handling
- β Password Security: Bcrypt hashing with cost factor 12 (industry standard)
- β
Token Refresh: Automatic token refresh on
/auth/refreshendpoint - β
Current User Info:
/auth/meendpoint to fetch logged-in user details - β User Profiles: View user information (ID, username, email, creation date)
- β Create Communities: Authenticated users can establish new communities with name, description, icon URL, and rules
- β Browse All Communities: Public endpoint to list all communities
- β
Top Communities: Ranked communities by member count with configurable limit (
/communities/top/{limit}) - β Community Details: Retrieve full community info including member count and post count
- β
Join Community: Authenticated users join communities (tracked in
community_memberstable) - β Leave Community: Users can leave communities they've joined
- β Member Tracking: Real-time member count per community
- β Community Roles: Members table supports role assignment (default: 'member', extensible to 'moderator', 'admin')
- β Duplicate Prevention: Unique constraint prevents duplicate memberships (user_id, community_id)
- β Create Posts: Submit text content, external links, or discussion threads to communities
- β
Edit Posts: Authors can modify post title, content, and links (tracked via
updated_at) - β Delete Posts: Authorized deletion with validation (owner/admin only)
- β Rich Post Metadata: Each post tracks title, content, link, author, community, creation time, update time, and score
- β Post Scoring: Vote-based scoring (sum of all user votes on post)
- β
Posts by Community: Dedicated endpoint to fetch all posts in a specific community (
/communities/{id}/posts) - β Post Retrieval: Get all posts or individual post details with full metadata
- β Author Information: Posts linked to user ID for attribution
- β Create Comments: Reply to posts with threaded comments
- β Edit Comments: Modify comment content after creation
- β Delete Comments: Remove unwanted comments with authorization
- β Comment Metadata: Timestamp tracking (created_at, updated_at) for chronological sorting
- β Comment-to-Post Association: Each comment linked to parent post for threaded discussions
- β Get Post Comments: Retrieve all comments for a specific post
- β Comment Count: Track total comments per post
- β Upvote/Downvote Posts: Vote on posts with Β±1 value system
- β Vote State Management: Track existing votes per user to prevent duplicate voting
- β Vote Updates: Change vote from +1 to -1 or vice versa (stored as composite key user_id + post_id)
- β Vote Removal: Clear votes by setting value to 0 (unvote)
- β Aggregate Scoring: Post score calculated as sum of all votes (dynamic computation)
- β Database Efficiency: Primary key (user_id, post_id) ensures one vote per user per post
- β Popular Posts Feed: Dedicated page displaying trending posts (sorted by score/recency)
- β Top Communities: Browse communities ranked by member count with pagination support
- β Community Listing Page: Browse all communities with join buttons
- β Post Filtering Controls: Filter and sort posts by various criteria (planned: date, score, comments)
- β Landing Page: Home feed with community carousel and post feed
- β Search Bar: Component ready for search functionality integration
- β Responsive Sidebar: Collapsible navigation (toggles between 18.5% and 10.3% width)
- β Header Navigation: Top navigation bar with search and user menu
- β Modal Auth System: Login/Signup presented in modal overlay (non-intrusive)
- β Card-Based Layout: Posts displayed in reusable card components
- β Community Carousel: Featured communities displayed in horizontal scroll
- β Vote UI: Upvote/downvote buttons with visual state feedback
- β Comment Thread UI: Nested comment display with reply capability
- β Dropdown Menus: Context menus for post/comment actions (edit, delete)
- β Loading States: Component loading indicators during async operations
| Technology | Version | Purpose |
|---|---|---|
| Go | 1.25.5 | Core backend language |
| Chi Router | v5.2.3 | HTTP router and middleware |
| JWT (golang-jwt) | v5.3.0 | Token-based authentication |
| Bcrypt (crypto) | v0.46.0 | Password hashing |
| SQLite3 | v1.14.32 | Database |
| CORS Handler | v1.2.2 | Cross-Origin Resource Sharing |
| Technology | Version | Purpose |
|---|---|---|
| React | 18.3.1 | UI framework |
| React Router | 7.10.1 | Client-side routing |
| Vite | 5.4.21 | Build tool & dev server |
| TailwindCSS | 3.4.19 | Utility-first CSS framework |
| Lucide React | 0.561.0 | Icon library |
| React Icons | 5.5.0 | Additional icon sets |
| ESLint | 9.39.1 | Code linting |
| PostCSS | 8.5.6 | CSS preprocessing |
GoTalk/
βββ backend/ # Go backend application
β βββ cmd/
β β βββ api/
β β βββ main.go # Application entry point
β β βββ forum.db # SQLite database file
β βββ internal/
β β βββ database/
β β β βββ database.go # Database connection & initialization
β β β βββ migrate.go # Schema creation & migrations
β β βββ handlers/ # HTTP request handlers
β β β βββ auth.go # Authentication endpoints
β β β βββ posts.go # Post CRUD operations
β β β βββ comments.go # Comment management
β β β βββ communities.go # Community operations
β β β βββ members.go # Community membership
β β β βββ vote.go # Voting system
β β β βββ users.go # User endpoints
β β β βββ makecommunity.go # Community creation
β β βββ middleware/
β β β βββ auth.go # JWT authentication middleware
β β βββ models/ # Data structures
β β βββ user.go # User model
β β βββ post.go # Post model
β β βββ comment.go # Comment model
β β βββ community.go # Community model
β β βββ community_member.go # Membership model
β β βββ vote.go # Vote model
β βββ go.mod # Go module dependencies
β
βββ frontend/ # React frontend application
β βββ src/
β β βββ App.jsx # Root application component
β β βββ main.jsx # React DOM entry point
β β βββ index.css # Global styles
β β βββ App.css # Application styles
β β βββ context/
β β β βββ AuthContext.jsx # Authentication state management
β β βββ pages/ # Page-level components
β β β βββ LandingPage.jsx # Home page
β β β βββ PostPage.jsx # Individual post view
β β β βββ CreatePostPage.jsx # Post creation/editing
β β β βββ UserProfilePage.jsx # User profile view
β β β βββ CommunityPage.jsx # Community view
β β β βββ CommunityListPage.jsx# Communities listing
β β β βββ PopularPostPage.jsx # Trending posts
β β β βββ Layout.jsx # Base layout template
β β βββ components/ # Reusable UI components
β β β βββ Button/ # Button component
β β β βββ Card/ # Card & post card components
β β β βββ LoginForm/ # Login form
β β β βββ SignupForm/ # Signup form
β β β βββ LoginModal/ # Auth modal
β β β βββ SearchBar/ # Search component
β β β βββ DropdownMenu/ # Menu components
β β β βββ CommentBar/ # Comment input
β β β βββ JoinButton/ # Community join button
β β β βββ CreateCommunityModal/# Create community dialog
β β β βββ ... # Other UI components
β β βββ sections/ # Page sections/layouts
β β β βββ Header/ # Navigation header
β β β βββ SideBar/ # Sidebar navigation
β β β βββ PostSection/ # Posts display area
β β β βββ PostBar/ # Post filter controls
β β β βββ CreatePost/ # Post creation section
β β β βββ ... # Other page sections
β β βββ utils/
β β β βββ color.js # Utility functions
β β βββ assets/ # Static assets
β βββ public/ # Public static files
β βββ index.html # HTML entry point
β βββ package.json # Frontend dependencies
β βββ vite.config.js # Vite configuration
β βββ tailwind.config.js # TailwindCSS configuration
β βββ eslint.config.js # ESLint rules
β βββ postcss.config.js # PostCSS configuration
β βββ .stylelintrc.json # Style linting rules
β
βββ package.json # Root package metadata
βββ .env # Environment variables
βββ DevLog.txt # Development log
βββ LICENSE # License file
βββ README.md # This file
System Requirements:
- Node.js 16+ (frontend)
- Go 1.25.5+ (backend)
- npm or yarn (package management)
- Git
Recommended Development Tools:
- VS Code with Go and React extensions
- Postman or similar API testing tool
- SQLite browser (optional, for database inspection)
-
Navigate to backend directory:
cd backend -
Install Go dependencies:
go mod download
-
Database Configuration:
The application currently uses a specific absolute path for the SQLite database. You may need to update
backend/internal/database/database.goto match your local path if the application fails to find the database. -
Start the backend server:
cd cmd/api go run main.goThe backend API will be available at
http://localhost:8080 -
Verify backend is running:
# Test a simple endpoint curl http://localhost:8080/api/communities
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start development server:
npm run dev
The frontend will be available at
http://localhost:5173 -
Build for production:
npm run build
-
Preview production build:
npm run preview
For development, you'll need two terminal windows:
Terminal 1 - Backend:
cd backend/cmd/api
go run main.goTerminal 2 - Frontend:
cd frontend
npm run dev| Feature | Backend | Frontend | Status |
|---|---|---|---|
| User Authentication | β | β | Complete |
| Register User | β | β | Complete |
| Login/Logout | β | β | Complete |
| JWT Token Management | β | β | Complete |
| Get Current User | β | β | Complete |
| User Profiles | β | β | Complete |
| Communities | β | β | Complete |
| Create Community | β | β | Complete |
| Browse All Communities | β | β | Complete |
| Get Top Communities | β | β | Complete |
| Community Details | β | β | Complete |
| Join Community | β | β | Complete |
| Leave Community | β | β | Complete |
| Posts | β | β | Complete |
| Create Post | β | β | Complete |
| View All Posts | β | β | Complete |
| View Single Post | β | β | Complete |
| Get Posts by Community | β | β | Complete |
| Edit Post | β | β | Complete |
| Delete Post | β | β | Complete |
| Comments | β | β | Complete |
| Create Comment | β | β | Complete |
| View Post Comments | β | β | Complete |
| Edit Comment | β | β | Complete |
| Delete Comment | β | β | Complete |
| Voting | β | β | Complete |
| Vote on Post | β | β | Complete |
| Update Vote | β | β | Complete |
| Calculate Post Score | β | β | Complete |
| Discovery | β | β | Complete |
| Popular Posts Feed | β | β | Complete |
| Top Communities Ranking | β | β | Complete |
| Feature | Priority | Status | Notes |
|---|---|---|---|
| Notifications | High | π Planning | Real-time notification system |
| Direct Messaging | Medium | π Planned | Private user-to-user messages |
| Advanced Search | High | π In Progress | Full-text search across posts/comments |
| User Reputation/Karma | Medium | π Planned | Scoring based on community engagement |
| Media Upload | High | π Designing | Image/video support in posts/comments |
| Moderators & Roles | Medium | Role field exists, permissions not enforced | |
| Private Communities | Low | is_private field in DB, access control incomplete |
|
| Content Moderation | Medium | π Planned | Report/flag system for inappropriate content |
| Infinite Scroll | Low | π Designing | Pagination for large feed lists |
| Real-time Updates | High | π Planning | WebSocket for live comments/votes |
| Analytics Dashboard | Low | π Planned | Engagement metrics and trending analysis |
http://localhost:8080/api
POST /auth/register
Content-Type: application/json
Request:
{
"username": "string",
"password": "string"
}
Response: 201 Created
{
"message": "User registered successfully"
}POST /auth/login
Content-Type: application/json
Request:
{
"username": "string",
"password": "string"
}
Response: 200 OK
{
"user": {
"id": "integer",
"username": "string",
"email": "string"
}
}Note: JWT token stored in HttpOnly cookie automatically. Include credentials: "include" in fetch requests.
POST /auth/logout
(Credentials required)
Response: 200 OK
{
"message": "Logged out successfully"
}POST /auth/refresh
(Credentials required)
Response: 200 OK
{
"token": "jwt_token_string"
}GET /auth/me
(Credentials required)
Response: 200 OK
{
"user": {
"id": "integer",
"username": "string",
"email": "string",
"createdAt": "timestamp"
}
}GET /communities
Response: 200 OK
[
{
"id": "integer",
"name": "string",
"icon": "string (URL)",
"description": "string",
"rules": "string",
"members": "integer",
"postsCount": "integer",
"isPrivate": "boolean",
"createdAt": "timestamp"
}
]GET /communities/top/{limit}
Query Parameters:
- limit: Integer (required) - Number of communities to return
Response: 200 OK
[Community, ...] # Array of communities sorted by member count (DESC)GET /communities/{communityID}
Response: 200 OK
{Community}POST /communities
Content-Type: application/json
(Credentials required)
Request:
{
"name": "string",
"description": "string",
"icon": "string (URL)",
"rules": "string"
}
Response: 201 Created
{Community}PUT /communities/{communityID}
Content-Type: application/json
(Credentials required)
Request:
{
"name": "string",
"description": "string",
"icon": "string (URL)",
"rules": "string"
}
Response: 200 OK
{Community}DELETE /communities/{communityID}
(Credentials required)
Response: 200 OK
{
"message": "Community deleted successfully"
}POST /communities/{id}/join
(Credentials required)
Response: 200 OK
{
"message": "Joined community successfully"
}POST /communities/{id}/leave
(Credentials required)
Response: 200 OK
{
"message": "Left community successfully"
}GET /communities/{id}/joined
(Credentials required)
Response: 200 OK
{
"isMember": "boolean"
}GET /posts
Response: 200 OK
[
{
"id": "integer",
"title": "string",
"content": "string",
"link": "string",
"authorId": "integer",
"communityId": "integer",
"score": "integer",
"createdAt": "timestamp",
"updatedAt": "timestamp"
}
]GET /posts/{postID}
Response: 200 OK
{Post}GET /communities/{communityID}/posts
Response: 200 OK
[Post, ...]GET /users/{userID}/posts
Response: 200 OK
[Post, ...]POST /posts
Content-Type: application/json
(Credentials required)
Request:
{
"title": "string",
"content": "string",
"link": "string",
"communityId": "integer"
}
Response: 201 Created
{Post}PUT /posts/{postID}
Content-Type: application/json
(Credentials required)
Request:
{
"title": "string",
"content": "string",
"link": "string"
}
Response: 200 OK
{Post}DELETE /posts/{postID}
(Credentials required)
Response: 200 OK
{
"message": "Post deleted successfully"
}Response: 200 OK {Post}
#### Delete Post
DELETE /posts/{postID} Authorization: Bearer
Response: 200 OK { "message": "Post deleted successfully" }
### Comments Endpoints
#### Create Comment (Auth Required)
```http
POST /posts/{postID}/comments
Content-Type: application/json
(Credentials required)
Request:
{
"content": "string (required, cannot be empty)"
}
Response: 201 Created
{
"id": "integer",
"content": "string",
"authorId": "integer",
"postId": "integer",
"createdAt": "timestamp",
"updatedAt": "timestamp"
}
GET /posts/{postID}/comments
Response: 200 OK
[
{
"id": "integer",
"content": "string",
"authorId": "integer",
"postId": "integer",
"createdAt": "timestamp",
"updatedAt": "timestamp"
}
]PATCH /comments/{commentID}
Content-Type: application/json
(Credentials required)
Request:
{
"content": "string"
}
Response: 200 OK
{Comment}DELETE /comments/{commentID}
(Credentials required)
Response: 200 OK
{
"message": "Comment deleted successfully"
}GET /users/{userID}/comments
Response: 200 OK
[Comment, ...]POST /vote
Content-Type: application/json
(Credentials required)
Request:
{
"userId": "integer",
"postId": "integer",
"value": "integer (1 for upvote, -1 for downvote)"
}
Response: 200 OK
{
"postId": "integer",
"userId": "integer",
"value": "integer",
"message": "Vote recorded"
}Note: Update existing vote by posting again with same postId and different value.
DELETE /vote
Content-Type: application/json
(Credentials required)
Request:
{
"userId": "integer",
"postId": "integer"
}
Response: 200 OK
{
"message": "Vote removed"
}GET /vote/{userID}/{postID}
Response: 200 OK
{
"userId": "integer",
"postId": "integer",
"value": "integer"
}GET /users/{userID}
Response: 200 OK
{
"id": "integer",
"username": "string",
"email": "string",
"createdAt": "timestamp"
}CREATE TABLE users (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT UNIQUE NOT NULL,
email TEXT UNIQUE,
password TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE communities (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT UNIQUE NOT NULL,
icon TEXT,
description TEXT,
rules TEXT,
members INTEGER DEFAULT 0,
posts_count INTEGER DEFAULT 0,
is_private BOOLEAN DEFAULT 0,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);CREATE TABLE posts (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
content TEXT,
link TEXT,
author_id INTEGER NOT NULL,
community_id INTEGER NOT NULL,
score INTEGER DEFAULT 0, -- NEW: Vote aggregate
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (author_id) REFERENCES users(id),
FOREIGN KEY (community_id) REFERENCES communities(id)
);CREATE TABLE comments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
content TEXT NOT NULL,
author_id INTEGER NOT NULL,
post_id INTEGER NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (author_id) REFERENCES users(id),
FOREIGN KEY (post_id) REFERENCES posts(id)
);CREATE TABLE votes (
user_id INTEGER NOT NULL,
post_id INTEGER NOT NULL,
value INTEGER NOT NULL, -- 1 = upvote, -1 = downvote
PRIMARY KEY (user_id, post_id),
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (post_id) REFERENCES posts(id),
UNIQUE(user_id, post_id)
);CREATE TABLE community_members (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
community_id INTEGER NOT NULL,
role TEXT NOT NULL DEFAULT 'member', -- 'member', 'moderator', 'admin'
joined_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id),
FOREIGN KEY (community_id) REFERENCES communities(id),
UNIQUE(user_id, community_id)
);| Page | Route | Features |
|---|---|---|
| LandingPage | / |
Home feed with community carousel, post feed, popular communities sidebar |
| PostPage | /posts/:id |
Single post view with full comments thread, vote buttons, edit/delete actions |
| CreatePostPage | /create, /c/:communityId/create, /posts/:postId/edit/:communityId |
Post editor with community selector, support for create and edit modes |
| CommunityPage | /communities/:id |
Community view with header, join/leave button, all posts in community |
| CommunityListPage | /communities |
Browse all communities with member counts, join buttons |
| PopularPostPage | /popular |
Trending posts feed sorted by engagement |
| UserProfilePage | /users/:id |
User profile showing user info and their posts |
| Layout | (Template) | Base template for all pages: Header + Sidebar + Content area |
App
βββ Router (React Router v7)
β βββ LandingPage
β β βββ Layout
β β β βββ Header (Navigation, Search, User Menu)
β β β βββ SideBar (Navigation links, Community list)
β β β βββ Content
β β β βββ CardSlides (Carousel - Featured Communities)
β β β βββ PostSection
β β β β βββ PostBar (Filter/Sort controls)
β β β β βββ Post[] (Feed of PostCards)
β β β β βββ PostCard
β β β β βββ PostCardContent
β β β β βββ Vote Buttons
β β β β βββ Action Dropdown
β β β βββ PopularCommunities
β β
β βββ PostPage
β β βββ Layout
β β β βββ Header
β β β βββ SideBar
β β β βββ Post (Single with full metadata)
β β β βββ Vote Buttons
β β β βββ Author Info
β β β βββ Comments[]
β β β β βββ Comment Item
β β β β βββ CommentBar (Reply input)
β β β βββ Actions (Edit, Delete)
β β
β βββ CreatePostPage
β β βββ PostEditor
β β βββ CommunitySelector
β β βββ Submit Button
β β
β βββ CommunityPage
β β βββ Layout
β β β βββ Community Header (Name, icon, description)
β β β βββ JoinButton
β β β βββ Member Count
β β β βββ Posts in Community[]
β β
β βββ CommunityListPage
β β βββ Layout
β β β βββ Communities[] with Join Buttons
β β
β βββ PopularPostPage
β β βββ Layout
β β β βββ Popular Posts[] (sorted by engagement)
β β
β βββ UserProfilePage
β βββ Layout
β β βββ Profile Header
β β βββ User Posts[]
β
βββ LoginModal (Global)
βββ LoginForm
βββ SignupForm
AuthContext (Global State)
βββ user (current user object or null)
βββ loading (boolean)
βββ login() (async function)
βββ logout() (async function)
| Component | Location | Purpose |
|---|---|---|
| Button | components/Button/ |
Styled button with variants |
| Card | components/Card/Card.jsx |
Generic card container |
| PostCard | components/Card/PostCard.jsx |
Post display card with metadata |
| PostCardContent | components/Card/PostCardContent.jsx |
Post content rendering |
| LoginModal | components/LoginModal/ |
Auth modal (login/signup) |
| LoginForm | components/LoginForm/ |
Login form component |
| SignupForm | components/SignupForm/ |
Registration form component |
| CommentBar | components/CommentBar/ |
Comment input and submission |
| SearchBar | components/SearchBar/ |
Search input with dynamic placeholder |
| JoinButton | components/JoinButton/ |
Join/Leave community toggle |
| CreateCommunityModal | components/CreateCommunityModal/ |
Create new community dialog |
| DropdownMenu | components/DropdownMenu/ |
Reusable dropdown menu system |
| AbsoluteDropdown | components/DropdownMenu/AbsoluteDropdown.jsx |
Absolute-positioned dropdown |
| DropdownItem | components/DropdownMenu/DropdownItem.jsx |
Individual dropdown items |
| CircleButton | components/CircleButton/ |
Circular button (sidebar toggle) |
| PillButton | components/PillButton/ |
Pill-shaped button |
| Carousel | components/Carousel/ |
Community carousel display |
| VerticalMenu | components/VerticalMenu/ |
Vertical navigation menu |
| Community | components/Community/ |
Community card display |
Located in src/sections/, these are specialized layout components:
- Header/ - Top navigation bar with search and user menu
- SideBar/ - Left navigation with links and community list
- PostSection/ - Main post feed display
- PostBar/ - Filter and sort controls above posts
- CreatePost/ - Post editor with community selector
- PopularCommunities/ - Featured communities carousel
- Main/ - Central content area
- Body/ - Page body container
- UserProfile/ - User profile section
- UserBar/ - User action bar
- Content/ - Generic content wrapper