Arang.dev
Search

Building a Tech Blog with AI Pair Programming (Antigravity + MCP)

A chronicle of building a Next.js 15-based tech blog using the Gemini-based AI coding assistant Antigravity and MCP tools. Includes development tips for using AI and real-world troubleshooting examples.

#AI#Antigravity#MCP#Next.js#κ°œλ°œκ²½ν—˜
🌐 Translated

This post was machine-translated from Korean by AI. Some expressions may differ from the original.

Read the original (Korean)

Introduction

The recent advancements in AI coding assistants have been remarkable. While various tools like GitHub Copilot, Cursor, Cody, and Continue have emerged, this time I tried something a bit special.

It is Antigravityβ€”an "Agentic AI" coding assistant created by the Google DeepMind team. Going beyond simple code autocompletion, it can actually create files, execute terminal commands, manipulate the browser, and even commit/push to GitHub.

In this post, I will share my experience of building this blog from scratch using Antigravity and MCP (Model Context Protocol).

μ™„μ„±λœ λΈ”λ‘œκ·Έ ν™ˆνŽ˜μ΄μ§€


Tech Stack

Technologies used in this blog:

Category Technology Description
Framework Next.js 15 App Router, React Server Components
Content Velite Type-safe handling of MDX/Markdown
Styling Tailwind CSS + shadcn/ui Dark minimal design system
DB SQLite (better-sqlite3) Storage for comments, translations, and honeypot logs
Auth Auth.js (NextAuth v5) GitHub OAuth admin authentication
Translation Gemini API AI-based automatic translation
Deployment Ubuntu Server + PM2 Nginx reverse proxy
CI/CD GitHub Actions Automated SSH deployment
Highlighting rehype-pretty-code tokyo-night theme

Blog Structure

arang-blog/
β”œβ”€β”€ content/           # μ½˜ν…μΈ  (Velite)
β”‚   β”œβ”€β”€ posts/        # λΈ”λ‘œκ·Έ κΈ€ (.md)
β”‚   └── writeups/     # CTF Writeup (.md)
β”œβ”€β”€ data/
β”‚   └── blog.db       # SQLite (λŒ“κΈ€, λ²ˆμ—­, 둜그)
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ images/       # 이미지 파일
β”‚   └── uploads/      # μ—…λ‘œλ“œλœ 파일
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/          # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ admin/    # κ΄€λ¦¬μž νŽ˜μ΄μ§€
β”‚   β”‚   β”œβ”€β”€ api/      # API 라우트
β”‚   β”‚   β”œβ”€β”€ posts/    # λΈ”λ‘œκ·Έ κΈ€ νŽ˜μ΄μ§€
β”‚   β”‚   └── writeups/ # Writeup νŽ˜μ΄μ§€
β”‚   β”œβ”€β”€ components/   # React μ»΄ν¬λ„ŒνŠΈ
β”‚   β”œβ”€β”€ hooks/        # Custom Hooks
β”‚   └── lib/          # μœ ν‹Έλ¦¬ν‹° (DB, Auth, i18n)
β”œβ”€β”€ velite.config.ts  # Velite μ„€μ •
└── next.config.ts    # Next.js μ„€μ •

Start: Project Kickoff with a Single Prompt

The development of this blog started with a single prompt:

# Project Kickoff: Arang Tech Blog (Deep Dark & Aesthetic)
 
**λͺ©ν‘œ:** Next.js 15 + Velite + Shadcn/uiλ₯Ό μ‚¬μš©ν•œ CTF/기술 λΈ”λ‘œκ·Έ ꡬ좕.
**ν˜„μž¬ 상황:** 둜컬 ν΄λ”λ§Œ 생성됨. Git μ΄ˆκΈ°ν™” μ•ˆ 됨.
**Target Repo:** `https://github.com/JaewookYou/arang-blog`
 
---
 
## 🚨 Phase 0: Git Initialization (Handshake)
1. **μƒνƒœ 확인:** `filesystem`으둜 ν˜„μž¬ 폴더가 λΉ„μ–΄μžˆλŠ”μ§€ 확인
2. **λͺ…λ Ήμ–΄ 제곡:** Git μ΄ˆκΈ°ν™” 및 원격 μ—°κ²° λͺ…λ Ήμ–΄ μ„ΈνŠΈ μž‘μ„±
3. **λŒ€κΈ°:** μ‹€ν–‰ ν›„ "μ—°κ²° μ™„λ£Œ"라고 μ‘λ‹΅ν•˜λ©΄ Phase 1 μ‹œμž‘
 
## 🧠 Phase 1: Architecture & Setup (After Git Init)
Git 연결이 ν™•μΈλ˜λ©΄, `sequential-thinking`을 μ‚¬μš©ν•˜μ—¬:
1. **Stack Strategy (Context7 ν•„μˆ˜):** Next.js 15, Velite μ„€μ •
2. **Project Management (GitHub MCP):** Issue μƒμ„±μœΌλ‘œ λ‘œλ“œλ§΅ 정리
3. **Implementation Start:** κΈ°λ³Έ μŠ€μΊν΄λ”© 파일 생성

With this one prompt, the AI:

  • Checked the folder status
  • Provided Git initialization commands
  • Created an "Initial Setup & Roadmap" issue on GitHub
  • Created basic files like package.json, next.config.ts, etc.

It took about 10 minutes to go from an empty folder to a complete project structure.


Global Rule: Defining AI's Persona

One of Antigravity's powerful features is the Global Rule. You can set rules that apply to every conversation:

# πŸš€ Global Persona & Identity
- You are a **Senior Full-Stack Engineer** and **Security Researcher (CTF Player)**.
- **Core Values:** "Security-First", "Modular Design", "Hacker Aesthetic (Dark/Minimal)".
- **Language Protocol:** All explanations MUST be in **Korean (ν•œκ΅­μ–΄)**.
 
# πŸ›‘οΈ Security-First Mindset (Critical)
- **Defensive Coding:** Always assume inputs are malicious. Validate everything.
- **Secrets:** Never hardcode API keys. Always use `.env`.
 
# πŸ› οΈ MCP Toolchain Protocol (Adaptive)
1. **🧠 Sequential Thinking:** REQUIRED for Architecture, Debugging, or Complex Logic.
2. **πŸ” Context7:** ALWAYS fetch latest docs for libraries.
3. **πŸ™ GitHub (API):** Create Issues for planning, PRs for features.
4. **πŸ“‚ Filesystem:** Direct code manipulation.
5. **🦁 Brave Search:** For error solutions and design references.
 
# ⚑ Autonomous Execution Protocol
- **Do NOT ask the user** to run commands. Execute directly.
- **Trial & Error:** If a command fails, READ the error, PLAN a fix, EXECUTE.
- **Verification:** After running a command, verify before reporting back.

Thanks to these rules:

  • The AI always explains in Korean (including code comments)
  • Automatically considers security perspectives (input validation, use of .env)
  • Proceeds autonomously with command execution without asking for permission every time
  • Attempts to resolve errors on its own before reporting

Utilizing MCP (Model Context Protocol)

What is MCP?

MCP is a standard protocol that connects AI systems with external tools and data sources. Antigravity expands its capabilities through various MCP servers.

The MCP tools I actually used:

MCP Server Usage Benefit
sequential-thinking Breaking down complex problems into steps Essential for architecture design and debugging
filesystem File reading/writing, directory navigation Direct code modification
github-mcp-server PR creation, issue management, commits Automated project management
brave-search-mcp-server Web search (error resolution, finding docs) Retrieving latest information
context7 Library documentation lookup (latest APIs) Prevention of hallucinations

Sequential Thinking: The Key to Solving Complex Problems

For complex tasks like architecture design or debugging, sequential-thinking proved invaluable. Here is the approach used when adding 4-language support to the blog:

// Sequential Thinking으둜 문제 λΆ„ν•΄
thought: "λ‹€κ΅­μ–΄ 지원 μ•„ν‚€ν…μ²˜ 섀계"
steps: [
  "1. ν˜„μž¬ locale μƒνƒœ 관리 방법 νŒŒμ•…",
  "2. μ„œλ²„/ν΄λΌμ΄μ–ΈνŠΈ μ»΄ν¬λ„ŒνŠΈ ꡬ뢄", 
  "3. μΏ ν‚€ 기반 μ–Έμ–΄ μ €μž₯",
  "4. t() ν•¨μˆ˜λ‘œ λ²ˆμ—­ ν…μŠ€νŠΈ 쑰회",
  "5. λ‚ μ§œ 포맷 λ‘œμΌ€μΌν™”",
  "6. κ²Œμ‹œκΈ€ λ²ˆμ—­μ€ DB에 μ €μž₯ν•˜μ—¬ 관리"
]

Browser Subagent: Automating Visual Verification

The most impressive feature is the Browser Subagent. The AI directly opens the browser to check pages, take screenshots, and identify issues.

// AIκ°€ μ‹€μ œλ‘œ μ‹€ν–‰ν•œ λΈŒλΌμš°μ € 검증
browser_subagent({
  Task: `
    1. Navigate to https://blog.arang.kr/posts
    2. Wait 3 seconds for page load
    3. Scroll down to check all post cards
    4. Capture screenshot of the page
    5. Switch language to English using the globe icon
    6. Verify content changed to English
  `,
  RecordingName: "i18n_verification"
});

Thanks to this feature, instead of saying "Please check it yourself after deployment," it becomes "I've checked it, and here is the screenshot."

λ‹€κ΅­μ–΄ 지원 - μ˜μ–΄ λͺ¨λ“œ


Completed Features

1. Next.js 15 Based Static Blog

  • Velite: MDX/Markdown content management + Type safety
  • App Router: Latest Next.js routing (Server Components)
  • SSG: Fast loading via static site generation
  • Code Highlighting: rehype-pretty-code (tokyo-night theme)

μ½”λ“œ ν•˜μ΄λΌμ΄νŒ…

2. 4-Language Support

  • Supports Korean, English, Japanese, and Chinese
  • Automatic translation via Gemini API (Preserves code blocks/images)
  • Saves translations to SQLite DB (Converted to HTML before storage)
  • Automatic detection based on access country/browser language

λ‹€κ΅­μ–΄ 지원 - ν•œκ΅­μ–΄ λͺ¨λ“œ

3. Admin Dashboard

Admin features available after GitHub OAuth authentication:

  • Write/Edit Posts: Markdown editor (Auto-upload for clipboard images)
  • Translation Management: Generate AI translations, edit/delete saved translations
  • Comment Management: View and delete comments
  • Static Page Editing: Edit Home, About pages
  • Honeypot Logs: Track attack attempts on /wp-admin, /.env, etc.

Admin λŒ€μ‹œλ³΄λ“œ

4. GitHub Actions CI/CD

Write post in Admin β†’ GitHub Commit β†’ Trigger Actions β†’ Automatic Server Deployment

# .github/workflows/deploy.yml
on:
  push:
    branches: [main]
 
jobs:
  deploy:
    steps:
      - name: Deploy to Production
        run: |
          ssh ${{ secrets.SSH_HOST }} "
            cd /home/arang/web/blog
            git pull
            npm run build
            pm2 reload arang-blog
          "

5. Comment System

  • SQLite-based self-hosted (No dependency on external services)
  • Supports Nested Comments (1 level)
  • Anonymous nickname input
  • Admin Delete function

λŒ“κΈ€ μ‹œμŠ€ν…œ

6. Search Feature

  • Integrated Search for Posts and Writeups
  • Real-time Dropdown results
  • Multilingual UI support

검색 κΈ°λŠ₯

7. Security Features

  • Honeypot: Logging access to bot attack paths (/wp-admin, /.env, /phpmyadmin)
  • Rate Limiting: Limits on comment submission
  • XSS Prevention: HTML sanitization

Real-world Troubleshooting Cases

1. output: 'standalone' Compatibility Issue

Problem: next/dist/compiled/cookie module not found in PM2 + npm start environment

Cause: The output: 'standalone' configuration requires running via .next/standalone/server.js, but running with npm start causes conflicts.

Solution:

// next.config.ts
// output: 'standalone' 제거 - PM2 ν™˜κ²½μ—μ„œλŠ” λΆˆν•„μš”
const nextConfig: NextConfig = {
  // output: 'standalone', // 이거 제거!
};

2. MDX Comment Syntax Conflict

Problem: Build error when <!-- comment --> is included in posts written in Admin.

Solution: Auto-conversion in the Commit API

// HTML 주석 β†’ MDX 주석 μžλ™ λ³€ν™˜ (MDX 파일만)
if (ext === ".mdx") {
  content = content.replace(/<!--([\s\S]*?)-->/g, '{/*$1*/}');
}

3. pm2 not found during GitHub Actions SSH Connection

Problem: fnm environment variables were not loaded in the SSH session.

Solution:

# .github/workflows/deploy.yml
eval "$(fnm env)"
source ~/.bashrc
pm2 reload arang-blog

4. Markdown Structure Breaking during Translation

Problem: Code blocks and image paths were breaking during translation.

Solution: Replace code blocks/images with placeholders β†’ Translate β†’ Restore

// λ²ˆμ—­ μ „: μ½”λ“œλΈ”λ‘ μΆ”μΆœ
const { processed, codeBlocks } = extractCodeBlocks(content);
// λ²ˆμ—­ ν›„: 볡원
translatedContent = restoreCodeBlocks(translatedContent, codeBlocks);

Pros and Cons of AI Development

Pros

Item Description
Speed Repetitive tasks (CRUD, applying i18n) are incredibly fast
Reduced Learning Curve Can immediately utilize libraries never used before via Context7
Real-time Verification Visual confirmation before deployment via Browser Subagent
Autonomous Execution Just saying "Build and deploy it" gets the job done

Cons and Precautions

Item Description
Context Loss Forgets previously discussed content if the conversation gets too long
No Blind Trust Even if it says "It's done," you must verify it yourself
Security Caution Risk of hardcoding API keys - Prevented via Global Rule

Conclusion

The combination of Antigravity + MCP is undeniably powerful. Going beyond simple code autocompletion, it handles project management, browser verification, and automated deployment all at once.

The Global Rule setting is particularly critical. By defining the AI's persona and behavioral principles:

  • Security principles are automatically applied
  • Language/cultural consistency is maintained
  • Productivity increases through autonomous execution

However, AI is ultimately a tool. Setting the direction and verifying quality is still the human's role.

I spent about 50 hours with AI building this blog. Initially, I doubted, "Can this really work?" but now I think, "How did I ever develop without this?"

AI tools will continue to evolve. The important thing is not to fear change, but to actively experiment with new tools.


πŸ€– This post was written by AI (Antigravity).

The AI that built this blog together compiled this development experience directly. Of course, the final review and approval were done by a human πŸ˜„

Comments

Loading comments...
Building a Tech Blog with AI Pair Programming (Antigravity + MCP) | Arang