Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

yikZero/Rav

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

151 Commits

Repository files navigation

Rav

Rav is a modern personal blog built with Next.js 16, featuring MDX content management, internationalization support, AI-powered translation, and interactive features.

Tech Stack

  • Framework: Next.js 16 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS 4
  • Animation: Motion (Framer Motion)
  • Content: MDX with Shiki syntax highlighting
  • Internationalization: next-intl v4 (zh-CN, en)
  • AI Integration:
    • @ai-sdk/xai for chat
    • @ai-sdk/google for automated translation
  • Package Manager: pnpm 10.6.5+
  • Code Quality: ESLint + Prettier
  • Deployment: Docker support (standalone mode)

Key Features

  • πŸš€ Next.js 16 App Router - Fully static site generation with generateStaticParams()
  • πŸ“ Enhanced MDX - Syntax highlighting (Shiki), auto-linked headings, GFM support
  • 🌍 Bilingual Support - Chinese (default) and English with automatic translation
  • πŸ€– AI-Powered Translation - Automated zh-CN β†’ en translation using Google Generative AI
  • 🎨 Modern Styling - Tailwind CSS 4 with custom design tokens
  • ✨ Smooth Animations - Motion library with stagger effects
  • πŸ“± Responsive Design - Mobile-first approach
  • πŸ” SEO Optimized - Dynamic OG images, RSS feed, sitemap
  • 🐳 Docker Ready - Standalone output mode for easy deployment
  • πŸ“¦ SVG Optimization - Auto-generated React components from SVG assets

Getting Started

Prerequisites

  • Node.js 18+
  • pnpm 10.6.5
  • Docker (optional, for containerized deployment)

Installation

# Clone the repository
git clone https://github.com/yikZero/Rav.git
# Install dependencies
pnpm install

Development

# Start development server
pnpm dev

The development server will start at http://localhost:11300.

Build and Production

# Build for production
pnpm build
# Start production server
pnpm start

Docker Deployment

# Build Docker image
docker build -t rav .
# Run Docker container
docker run -p 11300:11300 rav

Project Structure

rav/
β”œβ”€β”€ app/
β”‚ β”œβ”€β”€ [locale]/ # Localized routes (zh-CN, en)
β”‚ β”‚ β”œβ”€β”€ blog/ # Blog listing and posts
β”‚ β”‚ β”‚ └── [slug]/ # Individual blog post pages
β”‚ β”‚ β”œβ”€β”€ talk/ # AI chat page
β”‚ β”‚ └── page.tsx # Homepage
β”‚ β”œβ”€β”€ api/
β”‚ β”‚ └── og/ # Open Graph image generation
β”‚ └── rss.xml/ # RSS feed generation
β”œβ”€β”€ components/ # React components
β”‚ β”œβ”€β”€ icons/ # Auto-generated SVG components
β”‚ └── ... # UI components
β”œβ”€β”€ content/ # MDX content
β”‚ β”œβ”€β”€ posts/
β”‚ β”‚ β”œβ”€β”€ zh-CN/ # Chinese posts (source)
β”‚ β”‚ └── en/ # English posts (auto-translated)
β”‚ β”œβ”€β”€ changelogs/
β”‚ └── projects/
β”œβ”€β”€ lib/ # Core utilities
β”‚ β”œβ”€β”€ mdx.utils.ts # MDX loading logic
β”‚ β”œβ”€β”€ post.utils.ts # Post metadata parsing
β”‚ └── utils.ts # Helper functions
β”œβ”€β”€ scripts/ # Build and translation scripts
β”‚ β”œβ”€β”€ translate.ts # AI translation automation
β”‚ └── utils/ # Translation utilities
β”œβ”€β”€ i18n/ # i18n configuration
β”œβ”€β”€ messages/ # Translation messages (UI)
β”‚ β”œβ”€β”€ zh-CN.json
β”‚ └── en.json
β”œβ”€β”€ public/ # Static assets
β”œβ”€β”€ fonts/ # Custom fonts
β”œβ”€β”€ rav.config.ts # Site configuration
└── next.config.ts # Next.js configuration

Development Guide

Code Style

  • ESLint for code linting
  • Prettier for code formatting
  • TypeScript strict mode
  • Import sorting with @trivago/prettier-plugin-sort-imports

Content Management

Creating a New Post

  1. Create a new MDX file in content/posts/zh-CN/ with frontmatter:
---
title: "Your Post Title"
publishedAt: "2024εΉ΄01月01ζ—₯"
description: "Post description"
image: "https://cdn.yikzero.com/your-image.jpg"
category: "Tech"
state: "published"
---
  1. Write your content in MDX format (supports GFM, code blocks, images, etc.)

Automated Translation

Translate Chinese posts to English automatically using AI:

# Translate only changed files
pnpm translate
# Force translate all files (ignore cache)
pnpm translate:force
# Translate a specific file
pnpm translate your-post-name

Requirements: Set GOOGLE_GENERATIVE_AI_API_KEY in your .env file.

How it works:

  • Reads posts from content/posts/zh-CN/
  • Only processes posts with state: published (skips drafts)
  • Uses file hash to detect changes (incremental translation)
  • Generates English versions in content/posts/en/
  • Tracks translation state in scripts/translate-state.json

SVG Optimization

# Generate optimized React components from SVG files in assets/
pnpm svg

Components will be created in components/icons/.

License

MIT

About

Blog

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /