A high-performance, visually stunning personal blog and portfolio built with modern web technologies. Features a "Modern Deep Space" design theme with accessibility and performance as core requirements.
- Modern Tech Stack: Next.js 14 (App Router), TypeScript, Tailwind CSS
- Content Management: Sanity.io CMS with MDX support
- Authentication: Clerk for secure user authentication
- Database: Neon (Serverless PostgreSQL) with Prisma ORM
- Animations: Framer Motion for smooth, accessible interactions
- Design: Dark mode with animated grain textures and mesh gradients
- Accessibility: WCAG 2.1 AA compliant with keyboard navigation
- Performance: Optimized for Lighthouse score >90
- Magnetic Buttons: Cursor-following hover effects
- Spotlight Cards: Border glow tracking cursor position
- Page Transitions: Smooth fade animations between routes
- Like Button: Floating like button with confetti animation
- Navigation Dock: Glassmorphism floating navigation
- Home: Bento Grid layout with project showcases
- Blog: MDX-powered posts with view/like tracking
- Guestbook: Chat-style message board for visitors
- About: Personal information and contact links
- Node.js 18+ and npm
- PostgreSQL database (Neon recommended)
- Sanity.io account
- Clerk account
-
Clone the repository
git clone <repository-url> cd TestBlog
-
Install dependencies
npm install
-
Set up environment variables
Create a
.env.localfile in the root directory:# Database (Neon PostgreSQL) DATABASE_URL="postgresql://username:password@host/database?sslmode=require" # Clerk Authentication NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_... CLERK_SECRET_KEY=sk_test_... NEXT_PUBLIC_CLERK_SIGN_IN_URL=/sign-in NEXT_PUBLIC_CLERK_SIGN_UP_URL=/sign-up # Sanity CMS NEXT_PUBLIC_SANITY_PROJECT_ID=your_project_id NEXT_PUBLIC_SANITY_DATASET=production SANITY_API_TOKEN=your_api_token
-
Set up the database
npm run db:push
-
Run the development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
- Stores user messages in the guestbook
- Includes soft delete functionality
- Indexed by userId and createdAt
- Tracks views and likes for blog posts
- Linked to Sanity posts via slug
- Aggregates total likes count
- Individual like records per user
- Prevents duplicate likes via unique constraint
- Enables "has liked" status checking
-
Create a Sanity project
npm create sanity@latest
-
Use the schema from
sanity/schemas/post.ts -
Deploy your Sanity Studio
npx sanity deploy
-
Add your first blog post in the Sanity Studio
Posts in Sanity should include:
- Title: Post title
- Slug: URL-friendly slug
- Main Image: Featured image with alt text
- Published At: Publication date
- Excerpt: Optional preview text
- Content: Markdown content (rendered via MDX)
- Tags: Optional categorization tags
- Pages (Home, Blog, Guestbook, About)
- Data fetching from Sanity and Prisma
- Interactive elements (MagneticButton, SpotlightCard, LikeButton)
- Form submissions (GuestbookForm)
- Animations (Framer Motion components)
saveGuestbookEntry: Creates new guestbook entriestogglePostLike: Handles post like/unlikeincrementPostViews: Tracks post views
Edit app/globals.css to customize the color scheme:
:root {
--primary: 263 70% 50%; /* Purple */
--background: 222.2 84% 4.9%; /* Deep space blue */
}Modify app/layout.tsx to change fonts:
const inter = Inter({ ... })
const playfair = Playfair_Display({ ... })Update components/layout/nav-dock.tsx to add/remove navigation items.
- ISR: Blog posts revalidate every hour
- Image Optimization: next/image for automatic optimization
- Font Optimization: next/font for font loading
- Suspense Boundaries: Loading states for better UX
- Database Indexing: Optimized queries with Prisma
- WCAG 2.1 AA compliant
- Keyboard navigation support
- ARIA labels for screen readers
prefers-reduced-motionsupport- Focus visible indicators
- Semantic HTML structure
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint
npm run db:push # Push Prisma schema to database
npm run db:studio # Open Prisma StudioTestBlog/
βββ app/ # Next.js App Router
β βββ blog/ # Blog pages
β βββ guestbook/ # Guestbook page
β βββ about/ # About page
β βββ layout.tsx # Root layout
β βββ page.tsx # Home page
β βββ globals.css # Global styles
βββ components/ # React components
β βββ ui/ # UI components
β βββ mdx/ # MDX components
β βββ layout/ # Layout components
βββ lib/ # Utility functions
β βββ actions/ # Server Actions
β βββ sanity/ # Sanity client
β βββ utils/ # Helper functions
β βββ db.ts # Prisma client
βββ prisma/ # Prisma schema
βββ sanity/ # Sanity schemas
βββ public/ # Static assets
- Push your code to GitHub
- Import your repository in Vercel
- Add environment variables
- Deploy!
Ensure all environment variables from .env.example are set in your deployment platform.
MIT License - feel free to use this project for your own portfolio!
- Built with Next.js, Tailwind CSS, and Framer Motion
- UI components from shadcn/ui
- Icons from Lucide React
- CMS powered by Sanity.io
- Authentication by Clerk
- Database by Neon and Prisma
Built with β€οΈ by a Principal Full-Stack Architect