A modern, full-stack portfolio website with integrated blog, admin panel, and multilingual support. Built with Next.js 14, TypeScript, MongoDB, and Tailwind CSS.
π Live Preview: https://www.markrahimi.com
- Features
- Tech Stack
- Project Structure
- Getting Started
- Database Architecture
- Type System
- Admin Panel
- API Documentation
- Deployment
- Contributing
- Multilingual Support - Full English/French localization with seamless language switching
- Admin Panel - Complete content management system with authentication
- Blog Platform - Create, edit, and publish blog posts with rich content
- Project Showcase - Detailed project pages with features, challenges, and metrics
- Contact System - Form submissions stored in database with admin notifications
- Analytics Dashboard - Track page views, engagement, and site statistics
- Type-Safe - 100% TypeScript coverage with strict type checking
- Responsive Design - Optimized for mobile, tablet, and desktop
- Dark Theme - Modern UI with glassmorphism effects
- Smooth Animations - Framer Motion powered transitions and micro-interactions
- SEO Optimized - Meta tags, Open Graph, and structured data
- Performance - Optimized images, lazy loading, and code splitting
- Framework: Next.js 14 (App Router)
- Language: TypeScript 5.0
- Styling: Tailwind CSS 3.4
- UI Library: shadcn/ui - Beautiful components built on Radix UI
- Animations: Framer Motion
- Icons: Lucide React
- Notifications: Sonner - Toast notifications
- Database: MongoDB with Mongoose ODM
- Authentication: NextAuth.js with credentials provider
- API: Next.js API Routes (RESTful)
- Validation: Zod schema validation
- Session Management: JWT-based sessions
- Package Manager: npm
- Code Quality: ESLint, Prettier
- Version Control: Git
- Deployment: Vercel (recommended)
markrahimi-v5/
βββ src/
β βββ app/ # Next.js App Router
β β βββ api/ # API Routes
β β β βββ about/route.ts # About section API
β β β βββ auth/[...nextauth]/ # NextAuth configuration
β β β βββ blogs/ # Blog CRUD operations
β β β βββ certificates/ # Certificates management
β β β βββ contact/route.ts # Contact form handler
β β β βββ education/ # Education CRUD
β β β βββ experiences/ # Experience CRUD
β β β βββ projects/ # Projects CRUD
β β β βββ settings/route.ts # Site settings API
β β β βββ skills/ # Skills management
β β β βββ stats/route.ts # Analytics API
β β β βββ views/route.ts # Page view tracking
β β β
β β βββ admin/ # Admin Panel Pages
β β β βββ about/page.tsx # Manage about section
β β β βββ blogs/ # Blog management
β β β βββ certificates/ # Certificates management
β β β βββ dashboard/page.tsx # Admin dashboard
β β β βββ education/ # Education management
β β β βββ experiences/ # Experience management
β β β βββ login/page.tsx # Admin login
β β β βββ messages/page.tsx # Contact messages
β β β βββ projects/ # Projects management
β β β βββ settings/page.tsx # Site settings
β β β βββ skills/ # Skills management
β β β βββ layout.tsx # Admin layout
β β β
β β βββ blog/ # Public Blog Pages
β β β βββ [id]/page.tsx # Blog post detail
β β β βββ page.tsx # Blog listing
β β β
β β βββ contact/page.tsx # Contact page
β β βββ projects/ # Public Project Pages
β β β βββ [id]/page.tsx # Project detail
β β β βββ page.tsx # Projects listing
β β β
β β βββ globals.css # Global styles
β β βββ layout.tsx # Root layout
β β βββ page.tsx # Home page
β β
β βββ components/ # React Components
β β βββ about-section.tsx # About section
β β βββ certifications-section.tsx # Certifications display
β β βββ education-section.tsx # Education timeline
β β βββ experience-section.tsx # Work experience
β β βββ footer.tsx # Site footer
β β βββ hero-section.tsx # Hero/landing section
β β βββ language-switcher.tsx # Language toggle
β β βββ navbar.tsx # Navigation bar
β β βββ page-loading.tsx # Loading component
β β βββ skills-section.tsx # Skills display
β β
β βββ hooks/ # Custom React Hooks
β β βββ useLanguage.ts # Language context hook
β β
β βββ lib/ # Utility Functions
β β βββ auth.ts # NextAuth configuration & options
β β βββ auth-helper.ts # Authentication utilities
β β βββ get-localized-data.ts # Data fetching helpers
β β βββ mongodb.ts # MongoDB connection
β β βββ utils.ts # General utilities (cn)
β β
β βββ locale/ # Translation Files
β β βββ en.json # English translations
β β βββ fr.json # French translations
β β
β βββ models/ # Mongoose Model Instances
β β βββ About.ts # About section model (imports from schemas)
β β βββ Blog.ts # Blog post model
β β βββ Certificate.ts # Certificate model
β β βββ ContactMessage.ts # Contact message model
β β βββ Education.ts # Education model
β β βββ Experience.ts # Experience model
β β βββ Project.ts # Project model
β β βββ Settings.ts # Site settings model
β β βββ Skill.ts # Skill model
β β βββ User.ts # User/admin model
β β βββ View.ts # Page view analytics model
β β
β βββ providers/ # Context Providers
β β βββ language-provider.tsx # Language context provider
β β βββ session-provider.tsx # NextAuth session provider
β β
β βββ schemas/ # Mongoose Schema Definitions
β β βββ index.ts # Central schema exports
β β βββ about.schema.ts # About section schema
β β βββ blog.schema.ts # Blog post schema
β β βββ certificate.schema.ts # Certificate schema
β β βββ contact-message.schema.ts # Contact message schema
β β βββ education.schema.ts # Education schema
β β βββ experience.schema.ts # Experience schema
β β βββ project.schema.ts # Project schema
β β βββ settings.schema.ts # Site settings schema
β β βββ skill.schema.ts # Skill schema
β β βββ user.schema.ts # User/admin schema (with password hashing)
β β βββ view.schema.ts # Page view analytics schema
β β
β βββ types/ # TypeScript Type Definitions
β βββ index.ts # Central type exports
β βββ about.ts # About section types
β βββ analytics.ts # Analytics types (PageView, Stats)
β βββ blog.ts # Blog types (BlogPost, Blog)
β βββ certificate.ts # Certificate types
β βββ challenge.ts # Project challenge types
β βββ contact.ts # Contact types (ContactInfo, ContactMessage)
β βββ education.ts # Education types (Education, EducationDB)
β βββ experience.ts # Experience types (Experience, ExperienceDB)
β βββ forms.ts # Form data types for admin
β βββ language.ts # Language types
β βββ metric.ts # Project metric types
β βββ project.ts # Project types (Project, ProjectDB, ProjectDetail)
β βββ settings.ts # Settings types
β βββ skill.ts # Skill types (SkillCategory, Skill)
β βββ social.ts # Social link types
β βββ stat.ts # Stat types
β
βββ public/ # Static Assets
β βββ cv.pdf # Resume/CV file
β βββ logo.png # Site logo
β βββ profile.jpg # Profile image
β
βββ scripts/ # Utility Scripts
β βββ create-admin.js # Admin user creation script
β
βββ .env.sample # Environment variables template
βββ .env.local # Environment variables (not in repo)
βββ .gitignore # Git ignore rules
βββ next.config.mjs # Next.js configuration
βββ package.json # Dependencies
βββ postcss.config.mjs # PostCSS configuration
βββ tailwind.config.ts # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
- Node.js 18.x or higher
- npm or yarn
- MongoDB (local installation or MongoDB Atlas account)
-
Clone the repository
git clone https://github.com/markrahimi/markrahimi-v5.git cd markrahimi-v5 -
Install dependencies
npm install
-
Set up environment variables
Copy the sample environment file and fill in your values:
cp .env.sample .env.local
Then edit
.env.localwith your configuration:Variable Description Example MONGODB_URIMongoDB connection string mongodb://localhost:27017/markrahimiNEXTAUTH_SECRETSecret key for NextAuth (generate with openssl rand -base64 32)your-secret-keyNEXTAUTH_URLBase URL of your application http://localhost:3000ADMIN_EMAILAdmin user email admin@example.comADMIN_PASSWORDAdmin user password your-secure-passwordADMIN_NAMEAdmin user display name Admin -
Create admin user
npm run create-admin
-
Run development server
npm run dev
-
Open your browser
Navigate to http://localhost:3000
npm run dev # Start development server
npm run build # Build for production
npm start # Start production server
npm run lint # Run ESLint
npm run create-admin # Create admin userThe project follows a clean separation between Schemas and Models for better maintainability and reusability.
src/
βββ schemas/ # Mongoose Schema definitions
β βββ project.schema.ts # Schema + TypeScript interface
β βββ blog.schema.ts
β βββ ...
β
βββ models/ # Mongoose Model instances
βββ Project.ts # Imports schema, exports model
βββ Blog.ts
βββ ...
Each schema file exports:
- Interface (
IProject,IBlog, etc.) - TypeScript type for the document - Schema (
projectSchema,blogSchema, etc.) - Mongoose schema definition
// src/schemas/project.schema.ts
import { Schema } from "mongoose";
export interface IProject {
id: string;
title: { en: string; fr: string };
description: { en: string; fr: string };
// ... other fields
published: boolean;
createdAt: Date;
updatedAt: Date;
}
export const projectSchema = new Schema<IProject>({
id: { type: String, required: true, unique: true },
title: { en: String, fr: String },
// ... schema definition
}, { timestamps: true });Each model file imports the schema and creates the model:
// src/models/Project.ts
import mongoose, { Model } from "mongoose";
import { IProject, projectSchema } from "@/schemas/project.schema";
const Project = (mongoose.models.Project as Model<IProject>)
|| mongoose.model<IProject>("Project", projectSchema);
export type { IProject };
export default Project;- Separation of Concerns - Schemas define structure, models handle database operations
- Reusability - Schemas can be imported independently for validation or testing
- Type Safety - Interfaces are co-located with their schemas
- Hot Reload Friendly - Prevents "model already defined" errors in development
| Schema | Interface | Description |
|---|---|---|
| project.schema.ts | IProject |
Portfolio projects with multilingual support |
| blog.schema.ts | IBlog |
Blog posts with categories and tags |
| experience.schema.ts | IExperience |
Work experience entries |
| education.schema.ts | IEducation |
Education history |
| skill.schema.ts | ISkill |
Skills organized by category |
| certificate.schema.ts | ICertificate |
Certifications and awards |
| user.schema.ts | IUser |
Admin users with password hashing |
| settings.schema.ts | ISettings |
Site-wide settings |
| about.schema.ts | IAbout |
About section content |
| contact-message.schema.ts | IContactMessage |
Contact form submissions |
| view.schema.ts | IView |
Page view analytics |
The project uses a comprehensive type system with clear separation:
- Schema Interfaces (
IProject,IBlog) β Located insrc/schemas/- Used with Mongoose models - Public Types (
Project,BlogPost) β Located insrc/types/- Used in frontend components - Database Types (
ProjectDB,Blog) β Located insrc/types/- Used in admin panel - Form Types (
ProjectFormData) β Located insrc/types/forms.ts- Used in admin forms
// Public Types (for frontend display)
export interface Project {
id: string;
title: string; // Localized
description: string; // Localized
// ... other localized fields
}
// Database Types (for admin panel)
export interface ProjectDB {
_id: string;
title: { en: string; fr: string };
description: { en: string; fr: string };
// ... multilingual fields
published: boolean;
createdAt: Date;
updatedAt: Date;
}
// Form Data Types (for admin forms)
export interface ProjectFormData {
// Same structure as ProjectDB but optimized for form state
}- types/index.ts - Central export point for all types
- types/blog.ts - BlogPost (public) and Blog (database)
- types/project.ts - Project, ProjectDB, ProjectDetail
- types/forms.ts - All admin form data types
- types/analytics.ts - Stats, PageView, ViewsData
- Navigate to
/admin/login - Enter your admin credentials
- Access the dashboard at
/admin/dashboard
- Overview of site statistics
- Quick access to all management sections
- Total counts for projects, blogs, messages, views
- Projects (
/admin/projects) - Create, edit, delete, and publish projects - Blog (
/admin/blogs) - Manage blog posts with rich content editor - Experience (
/admin/experiences) - Add work experience entries - Education (
/admin/education) - Manage education history - Skills (
/admin/skills) - Organize skills by categories - Certificates (
/admin/certificates) - Add certifications and awards
- Site Settings (
/admin/settings) - Configure site-wide settings - About Section (
/admin/about) - Edit about page content - Messages (
/admin/messages) - View and manage contact form submissions
The admin panel uses NextAuth.js with:
- Credentials-based authentication
- Session-based authorization
- Role-based access control
- Protected API routes with middleware
http://localhost:3000/api
GET /api/projects // Get all published projects
GET /api/projects/:id // Get single project
POST /api/projects // Create project (admin only)
PUT /api/projects/:id // Update project (admin only)
DELETE /api/projects/:id // Delete project (admin only)GET /api/blogs // Get all published blogs
GET /api/blogs/:id // Get single blog post
POST /api/blogs // Create blog (admin only)
PUT /api/blogs/:id // Update blog (admin only)
DELETE /api/blogs/:id // Delete blog (admin only)GET / api / about; // Get about section
PUT / api / about; // Update about (admin only)
GET / api / skills; // Get all skills
POST / api / skills; // Create skill (admin only)
GET / api / experiences; // Get all experiences
GET / api / education; // Get all education entries
GET / api / certificates; // Get all certificates
POST / api / contact; // Submit contact form
GET / api / messages; // Get messages (admin only)
GET / api / settings; // Get site settings
PUT / api / settings; // Update settings (admin only)
GET / api / stats; // Get site statistics (admin only)
POST / api / views; // Track page view// Language parameter for localized content
?lang=en | fr
// Example:
GET /api/projects?lang=en
GET /api/blogs?lang=fr-
Push to GitHub
git push origin main
-
Import to Vercel
- Go to vercel.com
- Import your repository
- Configure environment variables
- Deploy
-
Environment Variables
Add these in Vercel dashboard:
MONGODB_URI NEXTAUTH_SECRET NEXTAUTH_URL ADMIN_EMAIL ADMIN_PASSWORD
# Build for production
npm run build
# Start production server
npm start- Create MongoDB Model in
src/models/ - Define TypeScript Types in
src/types/ - Create API Routes in
src/app/api/ - Build Admin Pages in
src/app/admin/ - Create Public Display in
src/components/
- No inline interfaces - All types in
src/types/ - Centralized exports - Use
src/types/index.ts - Separated concerns - Public types vs Database types vs Form types
- Consistent naming - Public types (e.g.,
Project), DB types (e.g.,ProjectDB), Form types (e.g.,ProjectFormData)
- Light/Dark Theme Toggle - System preference detection with manual override
- Reading Progress Indicator - Show reading progress on blog posts
- Table of Contents - Auto-generated TOC for long blog posts
- Smooth Page Transitions - Enhanced animations between pages
- Skeleton Loading States - Better loading experience with content placeholders
- Custom 404/500 Pages - Branded error pages with helpful navigation
- Print-Friendly Styles - Optimized print layouts for blog posts and resume
- Full-Text Search - Search across blogs, projects, and content
- Project Filtering - Filter by technology, category, or year
- Blog Categories & Tags Pages - Dedicated pages for each category/tag
- Related Posts - AI-powered related content suggestions
- Popular Posts Widget - Show most viewed content
- Archive Page - Chronological listing of all content
- Rich Text Editor - TipTap or Slate.js for better content editing
- MDX Support - Write blog posts with JSX components
- Code Syntax Highlighting - Prism.js with copy-to-clipboard
- Blog Comments - Giscus (GitHub Discussions) integration
- Newsletter Subscription - Email capture with Mailchimp/ConvertKit
- RSS Feed - Auto-generated RSS for blog posts
- Reading Time Estimation - Accurate reading time calculation
- Social Share Buttons - Share to Twitter, LinkedIn, Facebook
- Draft/Preview Mode - Preview unpublished content
- Image Optimization - Next.js Image component with blur placeholders
- ISR (Incremental Static Regeneration) - Faster page loads with caching
- Dynamic Sitemap - Auto-generated sitemap.xml
- Structured Data (JSON-LD) - Rich snippets for Google
- Open Graph Images - Auto-generated OG images for social sharing
- Lazy Loading - Defer loading of off-screen content
- Bundle Analysis - Optimize JavaScript bundle size
- Edge Functions - Deploy API routes to edge for faster response
- Google Analytics 4 - GA4 integration with events tracking
- Custom Analytics Dashboard - Detailed view analytics in admin
- Heatmaps - Track user interactions with Hotjar/Clarity
- A/B Testing - Test different versions of content
- Performance Monitoring - Real-time performance metrics
- Error Tracking - Sentry integration for error monitoring
- Two-Factor Authentication - TOTP-based 2FA for admin
- Rate Limiting - Protect API routes from abuse
- CAPTCHA - reCAPTCHA or hCaptcha for forms
- Content Security Policy - Strict CSP headers
- Audit Logs - Track admin actions
- Session Management - View and manage active sessions
- Image Upload & Gallery - Media library with drag-and-drop
- Scheduled Publishing - Schedule content for future dates
- Content Versioning - Track changes with version history
- Bulk Operations - Select and edit multiple items
- Import/Export - Backup and restore content as JSON
- Keyboard Shortcuts - Power user shortcuts in admin
- Activity Dashboard - Recent changes and activity feed
- Email Notifications - Send emails for new messages
- Email Templates - Beautiful HTML email templates
- Webhook Integration - Send data to external services
- Slack/Discord Bot - Notifications to team channels
- Auto-Reply - Automatic response for contact forms
- More Languages - Add Spanish, German, Arabic, Persian
- RTL Support - Right-to-left layout for Arabic/Persian
- Auto Language Detection - Detect browser language
- URL-Based Routing -
/en/,/fr/URL prefixes - Translation Management - Admin UI for translations
- GitHub Integration - Show latest repositories and contributions
- Twitter/X Feed - Display recent tweets
- LinkedIn Integration - Import profile data
- Spotify Now Playing - Show currently playing track
- Discord Presence - Show online status
- Cal.com Integration - Meeting scheduling
- Stripe Integration - Accept donations/payments
- Service Worker - Offline support with caching
- Web App Manifest - Install as native app
- Push Notifications - Notify users of new content
- App-like Navigation - Bottom navigation on mobile
- Gesture Support - Swipe gestures for navigation
- WCAG 2.1 Compliance - Full accessibility audit
- Screen Reader Optimization - Proper ARIA labels
- Keyboard Navigation - Full keyboard support
- High Contrast Mode - Accessibility theme option
- Font Size Controls - User-adjustable text size
- Reduced Motion - Respect prefers-reduced-motion
- Unit Tests - Jest + React Testing Library
- E2E Tests - Playwright or Cypress
- Visual Regression - Percy or Chromatic
- API Tests - Supertest for API routes
- CI/CD Pipeline - GitHub Actions workflow
- Code Coverage - Track test coverage
- Lighthouse CI - Automated performance testing
- AI Content Suggestions - GPT-powered writing assistant
- Automatic Image Alt Text - AI-generated descriptions
- Content Recommendations - ML-based personalization
- Voice Search - Search with voice commands
- Command Palette - Cmd+K quick navigation
- Changelog - Public changelog for site updates
- Status Page - System status and uptime monitoring
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Mark Rahimi
- Email: imarkrahimi@gmail.com
- GitHub: @markrahimi
- LinkedIn: markrahimi
- Website: markrahimi.com
- Built with Next.js
- Styled with Tailwind CSS
- Animated with Framer Motion
- Icons from Lucide
Made with β€οΈ by Mark Rahimi