### Build and Start Production Server
Source: https://github.com/ninjazan420/f0ck_beta/wiki/Installation-Guide
Run these commands to build the production-ready application and start the server. Alternatively, use 'npm run prod'.
```bash
npm run build
npm run start
```
--------------------------------
### Build and Start Production Server
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/README.md
Commands to build the project for production and start the server. API and WebSocket configurations are similar to development.
```bash
npm install
npm run prod
```
--------------------------------
### Install Postfix on Ubuntu
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/E-Mail-Setup-Guide.md
Install the Postfix mail server on your Ubuntu VPS. Select 'Internet Site' during the installation prompts.
```bash
sudo apt update
sudo apt install postfix
```
--------------------------------
### Install Project Dependencies
Source: https://github.com/ninjazan420/f0ck_beta/wiki/Installation-Guide
Run this command in the project's root directory to install all necessary npm packages. Ensure Node.js and npm are installed.
```bash
npm install
```
--------------------------------
### Run Production Build and Start Combined
Source: https://github.com/ninjazan420/f0ck_beta/wiki/Installation-Guide
This command combines the build and start steps for production deployment.
```bash
npm run prod
```
--------------------------------
### Clone and Install Project Dependencies
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/README.md
Use these commands to clone the repository and install necessary dependencies for development.
```bash
git clone https://github.com/ninjazan420/f0ck_beta.git
cd f0ck_beta
npm install
```
--------------------------------
### Start Development Server
Source: https://github.com/ninjazan420/f0ck_beta/wiki/Installation-Guide
Execute this command to launch the development server. The application will be accessible at http://localhost:3001.
```bash
npm run dev
```
--------------------------------
### Clone f0ck_beta Repository
Source: https://github.com/ninjazan420/f0ck_beta/wiki/Installation-Guide
Use this command to clone the project repository. Ensure Git is installed.
```bash
git clone https://github.com/ninjazan420/f0ck_beta.git
cd f0ck_beta
```
--------------------------------
### Get Site Statistics
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieves overall statistics for the f0ck.org site.
```APIDOC
## Get Site Statistics
### Description
Retrieves overall statistics for the f0ck.org site.
### Method
GET
### Endpoint
/stats
### Response
#### Success Response (200)
- Site-wide statistics
```
--------------------------------
### Get Posts
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Fetches a paginated list of posts, with options to filter, sort, and search.
```APIDOC
## Get Posts
### Description
Fetches a paginated list of posts, with options to filter, sort, and search.
### Method
GET
### Endpoint
/posts
### Query Parameters
- **offset** (Number) - Optional - default: 0
- **limit** (Number) - Optional - default: 28
- **search** (String) - Optional
- **uploader** (String) - Optional
- **commenter** (String) - Optional
- **minLikes** (Number) - Optional
- **dateFrom** (Date string) - Optional
- **dateTo** (Date string) - Optional
- **sortBy** (String) - Optional - Options: 'newest' | 'oldest' | 'most_liked' | 'most_commented'
- **contentRating** (Array of String) - Optional - Options: 'safe', 'sketchy', 'unsafe'
- **tag** (Array of String) - Optional
### Response
#### Success Response (200)
- Paginated list of posts with metadata
```
--------------------------------
### Get Tags
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieves a paginated list of tags, with search and sorting capabilities.
```APIDOC
## Get Tags
### Description
Retrieves a paginated list of tags, with search and sorting capabilities.
### Method
GET
### Endpoint
/tags
### Query Parameters
- **search** (String) - Optional
- **limit** (Number) - Optional - default: 20
- **page** (Number) - Optional - default: 1
- **sortBy** (String) - Optional - Options: 'newest' | 'alphabetical' | 'trending' | 'most_used'
### Response
#### Success Response (200)
- Paginated list of tags
```
--------------------------------
### Production Environment Variables
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/E-Mail-Setup-Guide.md
Configure essential environment variables for production email setup. Ensure NEXTAUTH_URL, SMTP details, and sender address are correctly set.
```bash
NEXTAUTH_URL=https://yourdomain.com
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=apikey
SMTP_PASS=your-production-api-key
SMTP_FROM=noreply@yourdomain.com
```
--------------------------------
### Get Single Post
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieves the full details of a specific post by its ID.
```APIDOC
## Get Single Post
### Description
Retrieves the full details of a specific post by its ID.
### Method
GET
### Endpoint
/posts/{id}
### Response
#### Success Response (200)
- Complete post details including author and tags
```
--------------------------------
### DiscordButton Component Variants
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/Discord-Integration-Guide.md
Example usage of the DiscordButton component with different variants for login, registration, and account linking pages.
```tsx
// Login page
// Register page
// Account linking
```
--------------------------------
### Get Site-Wide Statistics
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Retrieves public site-wide statistics, such as active user count and recent activity metrics. This endpoint is cached for 5 minutes.
```bash
curl https://f0ck.org/api/stats
```
--------------------------------
### Get Session Data on Server-Side with NextAuth.js
Source: https://github.com/ninjazan420/f0ck_beta/wiki/Authentication
Shows how to retrieve the user's session on the server-side using `getServerSession`. Useful for rendering content or performing actions based on user role and authentication status.
```typescript
import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/auth';
async function ServerComponent() {
const session = await getServerSession(authOptions);
if (session?.user?.role === 'admin') {
// Admin-only content
return ;
}
// Regular content
return ;
}
```
--------------------------------
### Get public user profile
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Retrieves a public user profile with stats. Stats are subject to user privacy settings. Moderators and admins can bypass these restrictions. Includes examples for both public and private profiles.
```bash
curl https://f0ck.org/api/users/testuser
# Response (200)
{
"username": "testuser",
"bio": "I post cats",
"createdAt": "2023-06-01T00:00:00.000Z",
"lastSeen": "2024-01-15T09:00:00.000Z",
"role": "user",
"premium": false,
"avatar": null,
"stats": {
"uploads": 34,
"comments": 12,
"favorites": 8,
"likes": 56,
"dislikes": 3,
"tags": 5
},
"privacy": { "isProfilePrivate": false, "visibilityRestricted": false },
"isModerator": false,
"isAdmin": false
}
# Private profile (200) — non-owner/non-mod
{
"username": "privateuser",
"bio": "",
"stats": { "uploads": 0, "comments": 0, "favorites": 0, "likes": 0, "dislikes": 0, "tags": 0 },
"privacy": { "isProfilePrivate": true, "visibilityRestricted": true }
}
```
--------------------------------
### Configure Development Environment Variables
Source: https://github.com/ninjazan420/f0ck_beta/wiki/Installation-Guide
Create a .env.local file with these variables for local development. Replace placeholders with your actual credentials and URLs.
```env
MONGODB_URI=your_mongodb_uri
GIPHY_API_KEY=your_giphy_api_key
NEXTAUTH_SECRET=your_nextauth_secret
NEXTAUTH_URL=http://localhost:3001
NODE_ENV=development
PUBLIC_URL=http://localhost:3001
```
--------------------------------
### Get Moderation Statistics
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/API-Documentation.md
Retrieves comprehensive statistics related to content moderation.
```APIDOC
## GET /moderation/stats
### Description
Retrieves comprehensive statistics related to content moderation.
### Method
GET
### Endpoint
/moderation/stats
### Response
#### Success Response (200)
- **pendingComments** (number)
- **reportedPosts** (number)
- **activeUsers** (number)
- **reportedComments** (number)
- **totalModerationActions** (number)
- **recentActions** (Array)
- **action** (string)
- **targetType** (string)
- **moderator** (string)
- **timestamp** (date)
```
--------------------------------
### Configure Production Environment Variables
Source: https://github.com/ninjazan420/f0ck_beta/wiki/Installation-Guide
Create a .env.local file with these variables for production deployment. Use your production domain and secure secrets.
```env
MONGODB_URI=your_production_mongodb_uri
GIPHY_API_KEY=your_giphy_api_key
NEXTAUTH_SECRET=your_production_nextauth_secret
NEXTAUTH_URL=https://your-production-domain.com
NODE_ENV=production
PUBLIC_URL=https://your-production-domain.com
```
--------------------------------
### Get Moderation Stats
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Provides statistics related to moderation actions and performance.
```APIDOC
## Get Moderation Stats
### Description
Provides statistics related to moderation actions and performance.
### Method
GET
### Endpoint
/moderation/stats
### Response
#### Success Response (200)
- Moderation-related statistics
```
--------------------------------
### Create a pool
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Creates a new pool (album) with specified name, description, and content rating. Requires authentication. Public by default.
```bash
curl -X POST https://f0ck.org/api/pools \
-H "Content-Type: application/json" \
-H "Cookie: next-auth.session-token=YOUR_SESSION" \
-d '{
"name": "Best Cats 2024",
"description": "A collection of amazing cat posts",
"contentRating": "safe",
"isPublic": true
}'
# Response (200)
{
"message": "Pool created successfully",
"pool": {
"id": "507f1f77bcf86cd799439033",
"name": "Best Cats 2024",
"description": "A collection of amazing cat posts",
"contentRating": "safe",
"isPublic": true,
"itemCount": 0,
"stats": { "views": 0 }
}
}
```
--------------------------------
### Get User Activity
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieves the recent activities of the currently authenticated user.
```APIDOC
## Get User Activity
### Description
Retrieves the recent activities of the currently authenticated user.
### Method
GET
### Endpoint
/user/activity
### Response
#### Success Response (200)
- Current user's recent activities
```
--------------------------------
### Register New User Account
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Use this endpoint to create a new user account. Ensure the username meets the specified length and character requirements, and the password is strong. Rate limits apply.
```bash
curl -X POST https://f0ck.org/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"password": "Secure@123",
"email": "testuser@example.com"
}'
```
```json
{ "message": "Registration successful" }
```
```json
{ "error": "Username is already taken" }
```
```json
{ "error": "Password must be at least 8 characters long and include uppercase, lowercase, numbers, and special characters" }
```
--------------------------------
### Get Single Tag
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieves the full details of a specific tag by its ID.
```APIDOC
## Get Single Tag
### Description
Retrieves the full details of a specific tag by its ID.
### Method
GET
### Endpoint
/tags/{id}
### Response
#### Success Response (200)
- Complete tag details
```
--------------------------------
### Production Environment Variables for Discord OAuth
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/Discord-Integration-Guide.md
Set up Discord OAuth and NextAuth configurations for a production environment. Use strong secrets and ensure the correct domain is specified.
```bash
# Discord OAuth Configuration
AUTH_DISCORD_ID=your_production_discord_client_id
AUTH_DISCORD_SECRET=your_production_discord_client_secret
# NextAuth Configuration
NEXTAUTH_URL=https://yourdomain.com
NEXTAUTH_SECRET=your_strong_production_secret
# Database
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/yourapp
```
--------------------------------
### Create Post - Bash
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Use this endpoint to create a new post. Requires authentication and specifies JSON payload for title, content, media URL, type, and tags. Handles success (200) with post details.
```bash
curl -X POST https://f0ck.org/api/posts \
-H "Content-Type: application/json" \
-H "Cookie: next-auth.session-token=YOUR_SESSION" \
-d '{
"title": "Fluffy cat",
"content": "Look at this cute cat!",
"mediaUrl": "https://example.com/cat.jpg",
"mediaType": "image",
"tags": ["cats", "cute"],
"isNSFW": false
}'
```
```json
{ "message": "Post created successfully", "post": { "id": 43, ... } }
```
--------------------------------
### Register a new user
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Allows for the creation of new user accounts on the platform. Requires a username, password, and optionally an email address.
```APIDOC
## Register a new user
### Description
Allows for the creation of new user accounts on the platform. Requires a username, password, and optionally an email address.
### Method
POST
### Endpoint
/auth/register
### Request Body
- **username** (string) - Required - 3-16 characters, alphanumeric, _ and -
- **email** (string) - Optional
- **password** (string) - Required - min 8 chars, upper+lower+number
### Response
#### Success Response (200)
- User details with ID
```
--------------------------------
### Get Site Statistics API Endpoint
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieve overall site-wide statistics.
```HTTP
GET /stats
```
--------------------------------
### Get Moderation Activity
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieves a paginated log of moderation activities with filtering options.
```APIDOC
## Get Moderation Activity
### Description
Retrieves a paginated log of moderation activities with filtering options.
### Method
GET
### Endpoint
/moderation/activity
### Query Parameters
- **page** (Number) - Optional
- **limit** (Number) - Optional
- **type** (String) - Optional
- **action** (String) - Optional
- **moderator** (String) - Optional
### Response
#### Success Response (200)
- Paginated list of moderation activities
```
--------------------------------
### Sign In with Credentials or Discord OAuth
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
This endpoint handles user sign-in using either username and password credentials or by initiating the Discord OAuth flow. For credential sign-in, ensure the username and password are correct.
```bash
curl -X POST https://f0ck.org/api/auth/callback/credentials \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"password": "Secure@123"
}'
```
```bash
curl https://f0ck.org/api/auth/signin/discord
```
--------------------------------
### Get User Activity by Username
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieves the recent activities of a specified user by their username.
```APIDOC
## Get User Activity by Username
### Description
Retrieves the recent activities of a specified user by their username.
### Method
GET
### Endpoint
/users/{username}/activity
### Response
#### Success Response (200)
- Specified user's recent activities
```
--------------------------------
### Enable Debug Logging for NextAuth
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/Discord-Integration-Guide.md
Add these variables to your .env.local file to enable debug logging for NextAuth. This is useful for troubleshooting authentication issues.
```bash
# Add to .env.local
NEXTAUTH_DEBUG=true
NODE_ENV=development
```
--------------------------------
### Configure Email Environment Variables
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/E-Mail-Setup-Guide.md
Add these variables to your .env.local file for email configuration.
```bash
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
SMTP_FROM=your-email@gmail.com
```
--------------------------------
### Get Premium Status
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/API-Documentation.md
Retrieves the current user's premium status and associated features.
```APIDOC
## GET /user/premium
### Description
Retrieves the current user's premium status and associated features.
### Method
GET
### Endpoint
/user/premium
### Response
#### Success Response (200)
- **isPremium** (boolean) - Indicates if the user has premium status.
- **premiumUntil** (date) - The expiration date of the premium subscription.
- **features** (object)
- **uploadLimit** (number)
- **originalQuality** (boolean)
- **adFree** (boolean)
- **enhancedNotifications** (boolean)
```
--------------------------------
### Create a pool
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Creates a new pool (album). Requires authentication.
```APIDOC
## POST /api/pools — Create a pool (requires auth)
### Description
Creates a new pool (album). Name max 100 chars, description max 500 chars. Public by default.
### Method
POST
### Endpoint
/api/pools
### Parameters
#### Request Body
- **name** (string) - Required - Name of the pool (max 100 characters)
- **description** (string) - Optional - Description of the pool (max 500 characters)
- **contentRating** (string) - Optional - Content rating (`safe`, `questionable`, `explicit`). Defaults to `safe`.
- **isPublic** (boolean) - Optional - Whether the pool is public. Defaults to `true`.
### Request Example
```bash
curl -X POST https://f0ck.org/api/pools \
-H "Content-Type: application/json" \
-H "Cookie: next-auth.session-token=YOUR_SESSION" \
-d '{
"name": "Best Cats 2024",
"description": "A collection of amazing cat posts",
"contentRating": "safe",
"isPublic": true
}'
```
### Response
#### Success Response (200)
- **message** (string) - Confirmation message
- **pool** (object) - Details of the created pool
- **id** (string) - Pool ID
- **name** (string) - Pool name
- **description** (string) - Pool description
- **contentRating** (string) - Content rating
- **isPublic** (boolean) - Pool visibility
- **itemCount** (number) - Number of items in the pool
- **stats** (object) - Pool statistics
- **views** (number) - Number of views
### Response Example
```json
{
"message": "Pool created successfully",
"pool": {
"id": "507f1f77bcf86cd799439033",
"name": "Best Cats 2024",
"description": "A collection of amazing cat posts",
"contentRating": "safe",
"isPublic": true,
"itemCount": 0,
"stats": { "views": 0 }
}
}
```
```
--------------------------------
### Development Environment Variables for Discord OAuth
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/Discord-Integration-Guide.md
Configure Discord OAuth credentials and NextAuth settings for local development. Ensure these are kept secure and not committed to version control.
```bash
# Discord OAuth Configuration
AUTH_DISCORD_ID=your_discord_client_id_here
AUTH_DISCORD_SECRET=your_discord_client_secret_here
# NextAuth Configuration
NEXTAUTH_URL=http://localhost:3001
NEXTAUTH_SECRET=your_nextauth_secret_here
# Database
MONGODB_URI=mongodb://localhost:27017/yourapp
# or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/yourapp
```
--------------------------------
### Get Reported Comments
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/API-Documentation.md
Retrieves a paginated list of reported comments, with options to filter by status.
```APIDOC
## GET /moderation/reported-comments
### Description
Retrieves a paginated list of reported comments, with options to filter by status.
### Method
GET
### Endpoint
/moderation/reported-comments
### Query Parameters
- **page** (Number) - Optional - Page number for pagination (default: 1)
- **limit** (Number) - Optional - Number of comments per page (default: 20)
- **status** (string) - Optional - Filter by status: "pending" | "resolved" | "all" (default: "pending")
### Response
#### Success Response (200)
Paginated list of reported comments with context.
```
--------------------------------
### Get Comments
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Fetches a paginated list of comments for a specific post or all comments, with filtering options.
```APIDOC
## Get Comments
### Description
Fetches a paginated list of comments for a specific post or all comments, with filtering options.
### Method
GET
### Endpoint
/comments
### Query Parameters
- **postId** (String) - Optional
- **page** (Number) - Optional - default: 1
- **limit** (Number) - Optional - default: 10
- **status** (String) - Optional - Options: 'approved' | 'pending' | 'all' (default: 'approved')
### Response
#### Success Response (200)
- Paginated list of comments
```
--------------------------------
### POST /api/auth/register — Register a new user account
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Creates a new user account. Requires a username, password, and optionally an email. Username must be 3–16 characters alphanumeric with hyphens or underscores. Password must be at least 8 characters long and include uppercase, lowercase, digits, and a special character. This endpoint is rate-limited to 5 requests per minute per IP.
```APIDOC
## POST /api/auth/register — Register a new user account
### Description
Creates a new user with a username, password, and optional email. Username must be 3–16 characters (`[a-zA-Z0-9_-]`). Password must be ≥ 8 characters with uppercase, lowercase, digits, and a special character. Rate-limited to 5 requests per minute per IP.
### Method
POST
### Endpoint
/api/auth/register
### Request Body
- **username** (string) - Required - The desired username.
- **password** (string) - Required - The user's password.
- **email** (string) - Optional - The user's email address.
### Request Example
```json
{
"username": "testuser",
"password": "Secure@123",
"email": "testuser@example.com"
}
```
### Response
#### Success Response (200)
- **message** (string) - Indicates successful registration.
#### Error Response (400)
- **error** (string) - Describes the reason for failure (e.g., username taken, weak password).
#### Response Example (Success)
```json
{ "message": "Registration successful" }
```
#### Response Example (Error - username taken)
```json
{ "error": "Username is already taken" }
```
#### Response Example (Error - weak password)
```json
{ "error": "Password must be at least 8 characters long and include uppercase, lowercase, numbers, and special characters" }
```
```
--------------------------------
### Configure Local Postfix SMTP Environment Variables
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/E-Mail-Setup-Guide.md
Configure these environment variables when using a local Postfix SMTP server. User and password fields are typically left empty.
```bash
SMTP_HOST=localhost
SMTP_PORT=25
SMTP_SECURE=false
SMTP_USER=
SMTP_PASS=
SMTP_FROM=noreply@yourdomain.com
```
--------------------------------
### Get Moderation Stats API Endpoint
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Access statistics related to moderation actions and performance.
```HTTP
GET /moderation/stats
```
--------------------------------
### Create Post
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Creates a new post using a media URL. Supports validation for title, content, media type, and tags. Requires authentication.
```APIDOC
## POST /api/posts — Create a post (requires auth)
### Description
Creates a new post from a media URL. Validates title (max 200 chars), content (max 5000 chars), and `mediaType` (`image`, `video`, `gif`). Tags are sanitized, lowercased, and limited to 20.
### Method
POST
### Endpoint
/api/posts
### Parameters
#### Request Body
- **title** (string) - Required - The title of the post (max 200 characters).
- **content** (string) - Optional - The description or content of the post (max 5000 characters).
- **mediaUrl** (string) - Required - The URL of the media to be posted.
- **mediaType** (string) - Required - The type of media (`image`, `video`, `gif`).
- **tags** (array) - Optional - An array of tags for the post (max 20 tags).
- **isNSFW** (boolean) - Optional - Indicates if the post contains NSFW content.
### Request Example
```json
{
"title": "Fluffy cat",
"content": "Look at this cute cat!",
"mediaUrl": "https://example.com/cat.jpg",
"mediaType": "image",
"tags": ["cats", "cute"],
"isNSFW": false
}
```
### Response
#### Success Response (200)
- **message** (string) - "Post created successfully"
- **post** (object) - The created post object (details omitted for brevity).
```
--------------------------------
### Get User Activity API Endpoint
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Retrieve the recent activities of the currently authenticated user.
```HTTP
GET /user/activity
```
--------------------------------
### List and search tags
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Use this endpoint to retrieve paginated tags with live activity statistics. Supports various sorting modes and filters like search, creator, author, and minimum post count.
```bash
curl "https://f0ck.org/api/tags?search=cat&sortBy=trending&limit=5"
# Response (200)
{
"tags": [
{
"_id": "...",
"name": "cats",
"postsCount": 152,
"newPostsToday": 4,
"newPostsThisWeek": 18,
"creator": { "username": "admin" },
"createdAt": "2023-01-01T00:00:00.000Z"
}
],
"pagination": { "total": 1, "page": 1, "perPage": 5, "totalPages": 1 }
}
```
--------------------------------
### Configure SendGrid SMTP Environment Variables
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/E-Mail-Setup-Guide.md
Configure these environment variables to use SendGrid for sending emails. Use 'apikey' for the user and your SendGrid API key for the password.
```bash
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=apikey
SMTP_PASS=your-sendgrid-api-key
SMTP_FROM=noreply@yourdomain.com
```
--------------------------------
### Get User Notifications
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Retrieves paginated notifications for the authenticated user. Supports filtering by unread status.
```APIDOC
## GET /api/notifications — Get user notifications (requires auth)
### Description
Returns paginated notifications for the authenticated user. Supports `unreadOnly` filter.
### Method
GET
### Endpoint
/api/notifications
### Parameters
#### Query Parameters
- **page** (integer) - Optional - The page number for pagination.
- **limit** (integer) - Optional - The number of notifications per page.
- **unreadOnly** (boolean) - Optional - If true, only unread notifications are returned.
### Request Example
```bash
curl "https://f0ck.org/api/notifications?page=1&limit=10&unreadOnly=false" \
-H "Cookie: next-auth.session-token=YOUR_SESSION"
```
### Response
#### Success Response (200)
- **notifications** (array) - A list of notification objects.
- **_id** (string) - The unique identifier for the notification.
- **type** (string) - The type of notification (e.g., 'post_like').
- **read** (boolean) - Whether the notification has been read.
- **data** (object) - Additional data related to the notification.
- **postId** (string) - The ID of the related post.
- **postTitle** (string) - The title of the related post.
- **postThumbnail** (string) - The thumbnail URL of the related post.
- **likerUsername** (string) - The username of the user who liked the post.
- **createdAt** (string) - The timestamp when the notification was created.
- **unreadCount** (integer) - The total number of unread notifications.
- **hasMore** (boolean) - Indicates if there are more notifications available.
- **pagination** (object) - Pagination details.
- **page** (integer) - Current page number.
- **limit** (integer) - Items per page.
- **total** (integer) - Total number of items.
- **totalPages** (integer) - Total number of pages.
#### Response Example
```json
{
"notifications": [
{
"_id": "507f1f77bcf86cd799439055",
"type": "post_like",
"read": false,
"data": {
"postId": "42",
"postTitle": "Fluffy cat",
"postThumbnail": "/uploads/thumbnails/abc123.jpg",
"likerUsername": "user2"
},
"createdAt": "2024-01-15T14:00:00.000Z"
}
],
"unreadCount": 5,
"hasMore": false,
"pagination": { "page": 1, "limit": 10, "total": 5, "totalPages": 1 }
}
```
```
--------------------------------
### Get Site Statistics
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/API-Documentation.md
Retrieves site-wide statistics, including user metrics and premium feature usage.
```APIDOC
## GET /stats
### Description
Retrieves site-wide statistics, including user metrics and premium feature usage.
### Method
GET
### Endpoint
/stats
### Response
#### Success Response (200)
Site-wide statistics including user roles and premium metrics.
```
--------------------------------
### List Posts with Filtering and Pagination
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Retrieves a paginated list of posts, supporting various filters for tags, content rating, uploader, commenter, and date ranges. Ads are automatically interspersed. Rate-limited to 50 requests per minute per IP.
```bash
curl "https://f0ck.org/api/posts?tag=cats&contentRating=safe&sortBy=newest&limit=10"
```
--------------------------------
### Create Tag
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Allows for the creation of new tags, including optional aliases.
```APIDOC
## Create Tag
### Description
Allows for the creation of new tags, including optional aliases.
### Method
POST
### Endpoint
/tags
### Request Body
- **name** (string) - Required
- **aliases** (Array of string) - Optional
### Response
#### Success Response (200)
- Created tag details
```
--------------------------------
### Get Notifications API
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/API-Documentation.md
Retrieves a paginated list of notifications. Supports filtering by unread status and pagination.
```http
GET /notifications
```
--------------------------------
### Authentication Endpoints
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/Discord-Integration-Guide.md
These endpoints handle the initial sign-in process and the callback from Discord's OAuth flow.
```APIDOC
## GET /api/auth/signin
### Description
Displays the NextAuth sign-in page, which includes options for Discord authentication.
### Method
GET
### Endpoint
/api/auth/signin
```
```APIDOC
## GET /api/auth/callback/discord
### Description
This is the callback URL that Discord redirects to after successful user authorization. It handles the exchange of authorization codes for tokens and user information.
### Method
GET
### Endpoint
/api/auth/callback/discord
```
```APIDOC
## GET /api/auth/link-discord
### Description
Initiates the Discord account linking process by redirecting the user to Discord for authorization.
### Method
GET
### Endpoint
/api/auth/link-discord
```
--------------------------------
### Get Single Tag API Endpoint
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Fetch detailed information for a specific tag using its ID.
```HTTP
GET /tags/{id}
```
--------------------------------
### Get User Activity by Username API Endpoint
Source: https://github.com/ninjazan420/f0ck_beta/wiki/API-Documentation
Fetch the recent activities of a specific user identified by their username.
```HTTP
GET /users/{username}/activity
```
--------------------------------
### POST /api/auth/[...nextauth] — Sign in (NextAuth)
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Handles user sign-in using NextAuth. Supports both credential-based authentication (username and password) and OAuth via Discord.
```APIDOC
## POST /api/auth/[...nextauth] — Sign in (NextAuth)
### Description
Standard NextAuth credential sign-in. Supports `credentials` (username + password) and `discord` OAuth providers.
### Method
POST
### Endpoint
/api/auth/callback/credentials (for credentials)
/api/auth/signin/discord (for Discord OAuth)
### Request Body (Credentials)
- **username** (string) - Required - The user's username.
- **password** (string) - Required - The user's password.
### Request Example (Credentials)
```bash
curl -X POST https://f0ck.org/api/auth/callback/credentials \
-H "Content-Type: application/json" \
-d '{ "username": "testuser", "password": "Secure@123" }'
```
### Request Example (Discord OAuth)
```bash
curl https://f0ck.org/api/auth/signin/discord
```
```
--------------------------------
### Configure Gmail SMTP Environment Variables
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/E-Mail-Setup-Guide.md
Set these environment variables for using Gmail as your SMTP provider. Ensure you have generated an App Password.
```bash
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-gmail@gmail.com
SMTP_PASS=your-16-character-app-password
SMTP_FROM=your-gmail@gmail.com
```
--------------------------------
### Get User Notifications
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Retrieve paginated notifications for the authenticated user. Supports filtering by unread status. Requires authentication.
```bash
curl "https://f0ck.org/api/notifications?page=1&limit=10&unreadOnly=false" \
-H "Cookie: next-auth.session-token=YOUR_SESSION"
```
--------------------------------
### Upload File or Image URL - Bash
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Uploads a file via multipart/form-data or an image via URL. Supports rating and tags. Validates MIME types, video limits, and file size. Rate-limited to 10 uploads per minute. Handles success (200), unsupported types (400), and rate limits (429).
```bash
# Upload a file
curl -X POST https://f0ck.org/api/upload \
-H "Cookie: next-auth.session-token=YOUR_SESSION" \
-F "file=@/path/to/image.jpg" \
-F "rating=safe" \
-F 'tags=["cats","cute"]'
```
```bash
# Upload from URL
curl -X POST https://f0ck.org/api/upload \
-F "imageUrl=https://example.com/cat.jpg" \
-F "rating=safe" \
-F 'tags=["cats"]'
```
```json
{
"success": true,
"files": [
{
"id": 43,
"filename": "abc123.jpg",
"url": "/uploads/original/abc123.jpg",
"thumbnailUrl": "/uploads/thumbnails/abc123.jpg",
"rating": "safe",
"uploadDate": "2024-01-15T10:00:00.000Z",
"tags": ["cats", "cute"],
"uploader": "User"
}
],
"file": { ... }
}
```
```json
{ "error": "Unsupported file type: application/pdf" }
```
```json
{ "error": "Rate limit exceeded. Please try again later." }
```
--------------------------------
### Get Notifications
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/API-Documentation.md
Retrieves a paginated list of notifications for the current user, with options to filter by read status and control pagination.
```APIDOC
## GET /notifications
### Description
Retrieves a paginated list of notifications with post details.
### Method
GET
### Endpoint
/notifications
### Query Parameters
- **unread** (Boolean) - Optional - Filter for unread notifications only (default: false)
- **page** (Number) - Optional - Page number for pagination (default: 1)
- **limit** (Number) - Optional - Number of notifications per page (default: 20)
### Response
#### Success Response (200)
- **notifications** (Array) - List of notification objects.
- **id** (string)
- **type** (string) - Type of notification: "comment" | "reply" | "like" | "dislike" | "favorite" | "mention" | "system"
- **message** (string)
- **isRead** (boolean)
- **createdAt** (date)
- **postId** (string)
- **postThumbnail** (string)
- **postTitle** (string)
- **fromUser** (object)
- **username** (string)
- **avatar** (string)
- **totalCount** (number) - Total number of notifications.
- **unreadCount** (number) - Number of unread notifications.
```
--------------------------------
### Assemble File Chunks - cURL
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Assembles previously uploaded chunks into a complete file and processes it as a post upload. Must be called after all chunks are uploaded. Authentication is required.
```bash
curl -X POST https://f0ck.org/api/upload/assemble-chunks \
-H "Content-Type: application/json" \
-H "Cookie: next-auth.session-token=YOUR_SESSION" \
-d '{
"fileId": "unique-file-uuid",
"filename": "video.mp4",
"contentType": "video/mp4",
"totalChunks": 5,
"rating": "safe",
"tags": ["video", "funny"]
}'
```
--------------------------------
### Get User Information API Endpoint
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/API-Documentation.md
Retrieve the current user's information by calling this endpoint. Authentication is required.
```http
GET /auth/user
```
--------------------------------
### Get Moderation Statistics
Source: https://context7.com/ninjazan420/f0ck_beta/llms.txt
Retrieves site-wide moderation statistics, including counts of reported posts and comments. Accessible by moderators and admins.
```APIDOC
## GET /api/moderation/stats — Get moderation statistics (moderator/admin)
### Description
Returns site-wide moderation statistics including reported posts/comments counts.
### Method
GET
### Endpoint
/api/moderation/stats
### Response
#### Success Response (200)
- **reportedPosts** (integer) - The number of reported posts.
- **reportedComments** (integer) - The number of reported comments.
- **pendingComments** (integer) - The number of comments pending moderation.
- **totalModerationActions** (integer) - The total number of moderation actions taken.
#### Response Example
```json
{
"reportedPosts": 4,
"reportedComments": 2,
"pendingComments": 0,
"totalModerationActions": 48
}
```
```
--------------------------------
### Get Reported Comments API
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/API-Documentation.md
Retrieves a paginated list of reported comments. Supports filtering by status (pending, resolved, all) and pagination.
```http
GET /moderation/reported-comments
```
--------------------------------
### Configure Mailgun SMTP Environment Variables
Source: https://github.com/ninjazan420/f0ck_beta/blob/master/wiki/E-Mail-Setup-Guide.md
Set these environment variables for Mailgun integration. Use your Mailgun SMTP username and password.
```bash
SMTP_HOST=smtp.mailgun.org
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=your-mailgun-username
SMTP_PASS=your-mailgun-password
SMTP_FROM=noreply@yourdomain.com
```