A premium developer-focused blogging platform that combines technical writing, code presentation, and storytelling into a unified, notebook-style experience.
Demo β’ Documentation β’ Report Bug β’ Request Feature
- About
- Key Features
- Tech Stack
- Architecture
- Getting Started
- Project Structure
- Block Types
- Environment Variables
- Database Schema
- Development
- Deployment
- Roadmap
- Contributing
- License
BlogTorch is a modern, full-stack blogging platform designed specifically for developers, engineers, and technical writers. It bridges the gap between traditional blogging platforms and interactive developer notebooks, enabling you to create rich, narrative-driven posts that seamlessly integrate code, outputs, visualizations, and prose.
- π§© Block-Based Architecture - Compose content with flexible, reorderable blocks
- π Notebook-Style Presentation - Familiar interface for developers showcasing code and results
- π¨ Developer-First UX - Syntax highlighting, markdown support, and code-focused design
- π€ Built-in Social Features - Engage with the community through likes, comments, and follows
- β‘ Modern Tech Stack - Built with the latest web technologies for optimal performance
- π¨βπ» Software developers sharing tutorials and insights
- π€ ML practitioners documenting experiments and results
- π Data scientists showcasing analyses and visualizations
- π Technical educators creating learning content
- π DevOps engineers documenting workflows
- π‘ Open source contributors building their portfolio
- Multiple Block Types: Markdown, Code, Output, Image, Embed, Divider, Callout
- Drag & Drop Reordering: Intuitive content organization with
@dnd-kit - Real-time Preview: See your content as you write
- Auto-save to Drafts: Never lose your work
- Syntax Highlighting: Powered by Shiki with multi-language support
- Like System: One-click appreciation for posts
- Threaded Comments: Rich discussion with parent-child relationships
- Bookmarks: Save posts for later reading
- Follow System: Build your network and stay updated
- User Profiles: Showcase your work and statistics
- Explore Page: Browse and search all published posts
- Tag-based Navigation: Find content by topics and technologies
- Language Filtering: Discover posts by programming language
- View & Like Tracking: See what's trending
- Author Profiles: Connect with content creators
- Clerk Integration: Industry-standard authentication
- Role-based Access: User and Admin roles
- Protected Routes: Middleware-based protection
- Input Validation: Zod schemas for runtime type safety
- Content Sanitization: XSS prevention with
rehype-sanitize
- Light/Dark Mode: System-aware theme switching
- Persistent Preferences: Theme saved automatically
- Smooth Transitions: Framer Motion animations
- Accessible Design: WCAG 2.1 Level AA compliance target
| Technology | Version | Purpose |
|---|---|---|
| 20+ | Server runtime | |
| Latest | NoSQL database | |
| 6.16.0 | Type-safe database ORM | |
| 6.37.5 | Authentication & user management |
| Package | Purpose |
|---|---|
react-markdown |
Markdown rendering |
remark-gfm |
GitHub Flavored Markdown support |
shiki |
Syntax highlighting |
rehype-pretty-code |
Enhanced code block styling |
rehype-sanitize |
XSS protection |
- Zustand - Lightweight state management
- @dnd-kit - Drag and drop functionality
- Sonner - Toast notifications
- Lucide React - Icon library
- next-themes - Theme management
- Zod - Schema validation
BlogTorch is built on a modern, scalable architecture leveraging Next.js 16's App Router for optimal performance.
- Server Components First - Default to server components for better initial load
- Progressive Enhancement - Works without JavaScript, enhanced with it
- Type Safety - TypeScript across the entire stack
- Block-Based Content - Extensible system for new content types
- Optimistic Updates - Immediate UI feedback for better UX
The MongoDB database uses Prisma ORM with the following core models:
User β Posts β Blocks
β β β
Follows Tags (Ordered content)
β β
Likes PostTag
β
Comments
β
Bookmarks
- β Next.js App Router - Improved performance and developer experience
- β MongoDB + Prisma - Flexible schema for block-based content
- β Clerk Authentication - Outsourced auth for security and ease
- β Server Actions - Type-safe server mutations
- β Edge Runtime - Fast, globally distributed responses
- Node.js 20.x or higher
- npm / yarn / pnpm
- MongoDB database (local or cloud)
- Clerk account for authentication
- Clone the repository
git clone https://github.com/akshitsutharr/BlogTorch.git
cd BlogTorch- Install dependencies
npm install
# or
yarn install
# or
pnpm install- Set up environment variables
Create a .env file in the root directory:
# Database
DATABASE_URL="mongodb+srv://username:password@cluster.mongodb.net/blogtorch"
# Authentication (Clerk)
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
CLERK_SECRET_KEY="sk_test_..."
CLERK_WEBHOOK_SECRET="whsec_..."
# Optional
NEXT_PUBLIC_APP_URL="http://localhost:3000"- Generate Prisma Client
npm run prisma:generate- Push database schema
npm run db:push- Run the development server
npm run dev- Open your browser
Navigate to http://localhost:3000
BlogTorch/
βββ prisma/
β βββ schema.prisma # Database schema definition
βββ public/ # Static assets
βββ src/
β βββ app/ # Next.js App Router
β β βββ (auth)/ # Authentication routes
β β β βββ sign-in/
β β β βββ sign-up/
β β βββ api/ # API routes
β β β βββ webhooks/ # Clerk webhooks
β β βββ editor/ # Post editor pages
β β β βββ [id]/
β β βββ explore/ # Discovery page
β β βββ p/ # Post view pages
β β β βββ [slug]/
β β βββ profile/ # User profiles
β β β βββ [username]/
β β βββ globals.css # Global styles
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β βββ components/ # React components
β β βββ blocks/ # Content block renderers
β β β βββ markdown-block.tsx
β β β βββ code-block.tsx
β β β βββ output-block.tsx
β β β βββ image-block.tsx
β β β βββ embed-block.tsx
β β βββ editor/ # Editor components
β β β βββ block-editor.tsx
β β β βββ add-block-menu.tsx
β β βββ layout/ # Layout components
β β β βββ navbar.tsx
β β β βββ footer.tsx
β β βββ providers/ # Context providers
β β β βββ theme-provider.tsx
β β β βββ clerk-provider.tsx
β β βββ ui/ # UI primitives (shadcn/ui)
β β βββ button.tsx
β β βββ card.tsx
β β βββ ...
β βββ lib/ # Utility functions
β β βββ utils.ts # Helper functions
β β βββ constants.ts # App constants
β βββ server/ # Server-side modules
β β βββ auth.ts # Authentication helpers
β β βββ db.ts # Prisma client
β β βββ posts.ts # Post queries
β β βββ users.ts # User queries
β βββ middleware.ts # Next.js middleware
βββ .env # Environment variables
βββ .gitignore
βββ eslint.config.mjs # ESLint configuration
βββ next.config.ts # Next.js configuration
βββ package.json
βββ postcss.config.mjs # PostCSS configuration
βββ README.md
βββ tailwind.config.ts # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
BlogTorch supports multiple content block types for rich, flexible storytelling:
Rich text formatting with GitHub Flavored Markdown support.
{
type: "MARKDOWN",
data: {
content: "# Hello World\n\nThis is **markdown** content."
}
}Features:
- Inline code, links, lists, tables, blockquotes
- GitHub Flavored Markdown extensions
- Typography optimized for technical writing
Syntax-highlighted code with multi-language support.
{
type: "CODE",
data: {
language: "typescript",
code: "const greeting = 'Hello, World!';"
}
}Features:
- 50+ programming languages
- Line numbers
- Copy-to-clipboard
- Theme-aware highlighting
- Language badges
Display code execution results and terminal outputs.
{
type: "OUTPUT",
data: {
mimeType: "text/plain",
content: "Hello, World!"
}
}Supported MIME Types:
text/plain- Plain text outputimage/png,image/jpeg,image/svg+xml- Image outputs- Base64 encoded data
Embed images with captions and alt text.
{
type: "IMAGE",
data: {
url: "https://example.com/image.png",
alt: "Description",
caption: "Optional caption"
}
}Embed external content like YouTube videos.
{
type: "EMBED",
data: {
url: "https://youtube.com/watch?v=..."
}
}Visual section separators for better content organization.
Highlighted information boxes for important notes.
{
type: "CALLOUT",
data: {
type: "info", // info, warning, tip, danger
content: "Important information here"
}
}Create a .env file with the following variables:
# Database Configuration
DATABASE_URL="mongodb+srv://username:password@cluster.mongodb.net/blogtorch?retryWrites=true&w=majority"
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_XXXXXXXXXXXXXXXX"
CLERK_SECRET_KEY="sk_test_XXXXXXXXXXXXXXXX"
CLERK_WEBHOOK_SECRET="whsec_XXXXXXXXXXXXXXXX"
# App Configuration (Optional)
NEXT_PUBLIC_APP_URL="http://localhost:3000"
NODE_ENV="development"- Sign up at Clerk.com
- Create a new application
- Copy the API keys from the dashboard
- Set up a webhook endpoint for user synchronization
model User {
id String @id @default(auto()) @map("_id") @db.ObjectId
clerkId String @unique
username String? @unique
displayName String?
bio String?
imageUrl String?
role UserRole @default(USER)
// Social links
websiteUrl String?
githubUrl String?
twitterUrl String?
// Relations
posts Post[]
comments Comment[]
likes Like[]
bookmarks Bookmark[]
followers Follow[] @relation("followers")
following Follow[] @relation("following")
}model Post {
id String @id @default(auto()) @map("_id") @db.ObjectId
slug String @unique
title String
excerpt String?
coverImageUrl String?
published Boolean @default(false)
source PostSource @default(EDITOR)
// Relations
authorId String @db.ObjectId
author User @relation(fields: [authorId], references: [id])
blocks Block[]
tags PostTag[]
// Engagement
likes Like[]
comments Comment[]
bookmarks Bookmark[]
likeCount Int @default(0)
viewCount Int @default(0)
commentCount Int @default(0)
}model Block {
id String @id @default(auto()) @map("_id") @db.ObjectId
postId String @db.ObjectId
type BlockType
order Int
data Json // Flexible JSON data for each block type
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
@@index([postId, order])
}# Development
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
# Database
npm run prisma:generate # Generate Prisma Client
npm run db:push # Push schema to database
npm run db:studio # Open Prisma Studio- ESLint - Code linting with Next.js config
- TypeScript - Strict mode enabled
- Prettier - Code formatting (recommended)
- Use Server Components by default
- Mark client components with
'use client' - Co-locate components with their usage
- Use TypeScript interfaces for props
- Follow the feature-based folder structure
Make sure to configure all environment variables in your deployment platform:
DATABASE_URLNEXT_PUBLIC_CLERK_PUBLISHABLE_KEYCLERK_SECRET_KEYCLERK_WEBHOOK_SECRETNEXT_PUBLIC_APP_URL
- User authentication with Clerk
- Block-based editor with drag & drop
- Post publishing and viewing
- Social features (likes, comments, follows)
- Tag system
- Theme switching
- Advanced search with full-text indexing
- Multi-tag filtering
- Trending posts algorithm
- Personalized recommendations
- Author pages with full stats
- Co-authoring posts
- Comment mentions (@username)
- Direct messaging
- Post sharing to social media
- Jupyter Notebook (.ipynb) import
- Automatic conversion to blocks
- Preserve code + output structure
- Post performance metrics
- Audience demographics
- Traffic sources dashboard
- Export analytics data
- Real-time collaborative editing
- Version history with rollback
- AI-assisted writing
- Math equation support (LaTeX)
- Diagram support (Mermaid)
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow the existing code style
- Write meaningful commit messages
- Add tests for new features
- Update documentation as needed
- Keep PRs focused and small
Distributed under the MIT License. See LICENSE for more information.
Akshit Suthar
- GitHub: @akshitsutharr
- Next.js - The React Framework
- Clerk - Authentication made easy
- Prisma - Next-generation ORM
- Radix UI - Accessible components
- shadcn/ui - Beautiful UI components
- Vercel - Deployment platform
If you have any questions or need help, feel free to:
- Open an issue on GitHub
- Star β this repository if you find it helpful!
Built with β€οΈ by developers, for developers