270

omarafify.com

The website you are currently on: A Modern Portfolio.

omarafify.com

Modern Portfolio Engine with Custom MDX Pipeline & Edge Analytics

Next.js TypeScript React Tailwind CSS Vercel

A high-performance portfolio platform built with Next.js 13 App Router, featuring a custom MDX content pipeline, privacy-preserving edge analytics, and interactive UI components.

Live Demo • View Projects

Overview

This portfolio platform is designed to showcase engineering projects and technical skills through an optimized, modern web experience. Built on Next.js 13's App Router with React Server Components, it combines:

  • Custom MDX Content Pipeline using Contentlayer with semantic processing
  • Edge-based Analytics with Upstash Redis for privacy-preserving view tracking
  • Interactive Visualizations including Mermaid diagrams and particle animations
  • End-to-end Type Safety via TypeScript and validated content schemas

The platform prioritizes performance, privacy, and developer experience while maintaining a visually stunning interface.

Architecture

System Architecture

Loading diagram...

Content Processing Pipeline

Loading diagram...

Analytics Pipeline

Loading diagram...

Component Architecture

Loading diagram...

Key Features

šŸš€ Next.js 13 App Router

Full utilization of React Server Components for optimal initial load performance and automatic code splitting.

šŸ“ Custom MDX Engine

Semantic content processing with extensible plugin architecture:

  • Syntax Highlighting: rehype-pretty-code with GitHub Dark theme
  • Auto-linked Headings: Automatic anchor generation with rehype-slug and rehype-autolink-headings
  • GFM Support: Tables, task lists, and strikethrough via remark-gfm
  • Custom Mermaid Plugin: lib/rehype-mermaid.js intercepts diagram code blocks before syntax highlighting

šŸ“Š Edge Analytics

Privacy-preserving view tracking system:

  • Edge Runtime: Runs on Vercel Edge Network for global low-latency
  • IP Hashing: SHA-256 hashing ensures no PII storage (pages/api/incr.ts)
  • Deduplication: 24-hour Redis key expiration prevents double-counting
  • Atomic Operations: Redis INCR ensures accurate concurrent updates

šŸŽØ Interactive Diagrams

Integrated Mermaid.js support with zoom/pan controls:

  • Diagrams defined in markdown code blocks
  • Client-side rendering with mermaid.tsx
  • Powered by react-zoom-pan-pinch for interactive exploration

🌈 Dynamic UI

Premium visual experience:

  • Particle System: WebGL-accelerated canvas with mouse magnetism (particles.tsx)
  • Spotlight Buttons: Proximity-based hover effects (spotlight-button.tsx)
  • Smooth Animations: Framer Motion for declarative transitions
  • Responsive Design: Tailwind CSS with mobile-first approach

šŸ”’ Type Safety

End-to-end type safety for content:

  • Schema Validation: Contentlayer validates frontmatter against TypeScript schemas
  • Generated Types: Automatic type generation for content files
  • TypeScript Strict Mode: Prevents runtime errors during development

Tech Stack

Core Framework

Content Management

Data & Infrastructure

Styling & UI

Visualization

Quick Start

Prerequisites

  • Node.js 18+
  • pnpm

Installation

  1. Clone the repository:

    git clone https://github.com/omarafify/omarafify.com.git
    cd omarafify.com
  2. Install dependencies:

    pnpm install
  3. Configure environment variables:

    Create a .env file in the root directory:

    UPSTASH_REDIS_REST_URL=your-upstash-url
    UPSTASH_REDIS_REST_TOKEN=your-upstash-token
    NEXT_PUBLIC_BEAM_TOKEN=optional-analytics-token
  4. Run the development server:

    pnpm dev

    Open http://localhost:3000 in your browser.

Development

Project Structure

omarafify.com/
ā”œā”€ā”€ app/                      # Next.js App Router
│   ā”œā”€ā”€ components/           # React components
│   │   ā”œā”€ā”€ particles.tsx    # Canvas particle system
│   │   ā”œā”€ā”€ mermaid.tsx      # Mermaid diagram renderer
│   │   ā”œā”€ā”€ mdx.tsx          # MDX component mappings
│   │   └── ...
│   ā”œā”€ā”€ projects/            # Projects section
│   │   ā”œā”€ā”€ [slug]/          # Dynamic project pages
│   │   └── page.tsx         # Projects listing
│   ā”œā”€ā”€ layout.tsx           # Root layout
│   └── page.tsx             # Home page
ā”œā”€ā”€ content/                 # MDX content files
│   └── projects/            # Project markdown files
ā”œā”€ā”€ lib/                     # Utilities and plugins
│   └── rehype-mermaid.js   # Custom rehype plugin
ā”œā”€ā”€ pages/api/               # API routes
│   └── incr.ts             # Analytics endpoint
ā”œā”€ā”€ public/                  # Static assets
ā”œā”€ā”€ util/                    # Helper functions
ā”œā”€ā”€ contentlayer.config.js  # Content schema & config
└── tailwind.config.js      # Tailwind configuration

What I Learned

Edge Computing Constraints

Adapting API routes to the Vercel Edge Runtime required fundamental changes:

  • No Node.js APIs: Switched from native crypto to Web Crypto API
  • No TCP Connections: Used Upstash's REST API instead of Redis protocol
  • Stateless Functions: Designed for instant cold starts and global distribution

AST Transformations

Building the custom Mermaid plugin (lib/rehype-mermaid.js) taught me:

  • How markdown parsers create Abstract Syntax Trees (ASTs)
  • Plugin execution order matters (must run before syntax highlighting)
  • Transforming nodes while preserving document structure

React Server Components

Learned the new paradigm of data fetching and rendering:

  • Server Components: Fetch data, access databases, render static content
  • Client Components: Handle interactivity, use hooks, access browser APIs
  • Boundaries: Strategic "use client" directives for minimal client JavaScript

Future Improvements

Migration from Contentlayer

Contentlayer is deprecated. Plan to migrate to:

  • Option 1: Next.js built-in MDX support with custom loader
  • Option 2: Velite as a direct replacement
  • Option 3: Custom build-time processor

Search Functionality

Implement client-side fuzzy search:

  • Index project metadata (title, description, tech stack)
  • Use Fuse.js for fuzzy matching
  • Filter and sort projects dynamically

Testing Suite

Add comprehensive testing:

  • Unit Tests: Jest for utilities and components
  • Integration Tests: Test MDX pipeline and content processing
  • E2E Tests: Playwright for user flows and analytics verification

Performance Optimizations

  • Implement incremental static regeneration (ISR) for projects
  • Add image optimization with Next.js Image component
  • Optimize particle system with WebGL shaders