惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
The GitHub Blog
The GitHub Blog
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
S
Security @ Cisco Blogs
N
News and Events Feed by Topic
H
Hacker News: Front Page
Attack and Defense Labs
Attack and Defense Labs
S
Secure Thoughts
Microsoft Security Blog
Microsoft Security Blog
N
Netflix TechBlog - Medium
U
Unit 42
Stack Overflow Blog
Stack Overflow Blog
T
Threat Research - Cisco Blogs
Google Online Security Blog
Google Online Security Blog
Spread Privacy
Spread Privacy
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
L
LINUX DO - 热门话题
T
Tenable Blog
博客园 - 叶小钗
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
人人都是产品经理
人人都是产品经理
aimingoo的专栏
aimingoo的专栏
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
量子位
P
Proofpoint News Feed
H
Help Net Security
Blog — PlanetScale
Blog — PlanetScale
宝玉的分享
宝玉的分享
Recorded Future
Recorded Future
The Register - Security
The Register - Security
F
Fortinet All Blogs
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
S
Schneier on Security
V
Vulnerabilities – Threatpost
雷峰网
雷峰网
Microsoft Azure Blog
Microsoft Azure Blog
G
GRAHAM CLULEY
G
Google Developers Blog
月光博客
月光博客
V
V2EX
T
Troy Hunt's Blog
A
Arctic Wolf

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
How I Built a Fully-Custom Blog with MDX and Next.js
Malek Shawah · 2026-04-24 · via DEV Community

This project is closed source, but you can find the blog at https://malekd5.com/articles

I always wanted to build my own blog and start posting things I find interesting. However, I kept delaying this task for so long that I ended up not doing it. I finally decided to give it a try and I'm happy to say that it's been a great experience (to some degree).

When building this blog, I only had one thing in mind: I wanted a markdown style blog. In this post, I will go over the journey and the challenges I faced along the way.

A Little Back Story..

Posting my thoughts and ideas on the internet was something I wanted to do: things I learned, topics that interests me, learned lessons, educational content, goofy random shit I did.. you get the idea. But, I've told myself if I ever was going to do that, I wanted to publish it in my own blog.

Why you must ask? Current platforms are highly limited in terms of customization and features, other platforms might require a subscription to access certain features (or to even read an article...)

If I wanted to publish my thoughts, I want to publish it in a way that I can easily control how the content is delivered to the reader. I want to be able to customize the design, the layout, the font, the color scheme, etc..

Day Job

I've also recently graduated from college and was lucky to get hired right out of college. I've been working for a few months now and it took some adjusting for the demanding nature of my role, especially after my probation period ended and the requirement of understanding highly complex parts of the system.

So this pushed the blog idea even more to the back of my mind as I couldn't really focus on anything other than the job. Now, after understanding my role and becoming more comfortable with my job, and being able to deal with the stress and pressure better than before, all of this allowed me to come back to the unfinished ideas, though I'm starting simple, which is creating my own blog (that can't be that hard, right?).

Additionally, There are a lot of cool things I did in my job that I want to share with you, but I'm not going to do that now.

I still haven't reached the level of 'customization' yet with this application. I had a lot of ideas but because I kept delaying building this app for so long, I lost sight of what I wanted to do with it. After building a simple version, I can finally focus on regaining my vision of what this should look like.

Transitioning from being a student to a full-time job needs it own post, but I'll leave that to another day.

Now, let us get a bit technical.

Tech Stack

Image

This blog application is a part of a monorepo that is currently hosting both the portfolio and the blog (too much I know). This website is written in Next.js and uses MDX for the blog posts. The blog posts are written in markdown and compiled to React components using remark.

for styling I used Tailwind CSS and @tailwindcss/typography plugin to style things like headings, paragraphs, lists, etc..

MDX is the most critical part of this entire system so without it this would've required a lot of work to get this blog up and running. So, much appreciation for the hard work of the people behind this beautiful piece of wonder.

Finally, I used Vercel to deploy this website.

Database

I DID NOT use a database to store information about the blog posts (Definetly not because I didn't want to pay for it).

Some would argue that I should've used sqlite or a free database but honestly I did not want to overcomplicate this project because I wanted to get this project out of 'wishlist' bucket.

SOO... I used a much simpler system to store information about the blog posts, which is a custom script that loops over the mdx files and collects necessary info (extracted by gray-matter) into an object. This object is then saved to a typescript file that is used by the application to render the blog post information like title, date, etc..

The main rational behind this is that I did not want my app to do any sort of heavy processing (like reading files) in runtime, so I I moved all of this processing to compile time because the data doesn't really change until the next time I build the app. so it made sense to do it that way.

Here is a small snippet of the JSON object that is generated:

// THIS FILES IS AUTO GENERATED BY compile-mdx-data SCRIPT, DO NOT EDIT

export const blogPostsObject: Record<string, BlogPost> = {
  "mdx-nextjs-blog-setup": {
    "title": "My MDX + Next.js Blog Setup",
    "description": "This is a description",
    "tags": [
      "nextjs",
      "mdx",
      "tailwind"
    ],
    "date": "2025-11-21",
    "readingTime": "5 min"
  },
};

Enter fullscreen mode Exit fullscreen mode

This script always runs before the build script.

Blog Main Page

The blog main page which contains all the blog posts also uses the blogPostsObject that was auto generated by the script to render the posts.

This allows me to keep things consistent and avoid having to manually update the blog posts information in multiple places.

Image

Code Snippets

I used a code snippet to highlight the code blocks. I'm using Expressive Code to do this. this is a very cool plugin that allows you to add syntax highlighting to your code blocks, but there is much more to it than that.

as an example, you can add a file tab to the code block like this:

File Tab Code Snippet Example

there is also a show line numbers option that you can use to show the line numbers of the code block, as an example I want to highlight the line that contains the port variable:

Show Line Number Code Snippet Example

even cooler than that, you can display a code diff like this, highlighting what has been added and removed:
Line Diff Code Snippet Example

If you would like to see more examples of code snippets, you can check out the Expressive Code website.

TOC (Table of Contents)

This one was pretty hard to figure out as the documentation wasn't very clear (or because I was working on this after my day j*b..)

Either way, I ended up using rehype-extract-toc to generate the table of contents.

The plugin is pretty simple to use and it generates a table of contents based on the headings in the blog post. the withTocExport function is what is triggers exporting the toc data.

import withToc from "@stefanprobst/rehype-extract-toc";
import withTocExport from "@stefanprobst/rehype-extract-toc/mdx";

const withMdx = nextMdx({
  options: {
    ...
    rehypePlugins: [
      withToc,
      [withTocExport, { name: 'toc' }],
    ]
  }
})

Enter fullscreen mode Exit fullscreen mode

The toc variable is then exported from the mdx import itself that we are currently passing to the Toc component to render the table of contents tree:

const { default: Post, toc } = await import(`@/app/(blog)/mdx/${slug}.mdx`);

return (
    <div> 
        <Toc toc={toc} />;
        <Post />
    </div>
);

Enter fullscreen mode Exit fullscreen mode

Post is the component that will be rendered and toc is the variable that contains the table of contents. toc is then passed to the TOC component which is responsible for rendering the table of contents.

Closing Thoughts

I'm really happy with how this blog turned out. Even though there is still much work to be done, what I have finished deserves to stop a bit and appreciate the hard work that went into it.

I'm really excited for what comes next into this little project, and I hope you enjoyed reading this post! sorry for any mistakes or typos, I'm still learning how to write this kind of stuff 😅