🚀 Complete Production Setup
✨ Features: - Analytics Dashboard with real-time metrics - Redis caching for performance optimization - Import/Export functionality for projects - Complete admin system with security - Production-ready Docker setup 🔧 Technical: - Removed Ghost CMS dependencies - Added Redis container with caching - Implemented API response caching - Enhanced admin interface with analytics - Optimized for dk0.dev domain 🛡️ Security: - Admin authentication with Basic Auth - Protected analytics endpoints - Secure environment configuration 📊 Analytics: - Performance metrics dashboard - Project statistics visualization - Real-time data with caching - Umami integration for GDPR compliance 🎯 Production Ready: - Multi-container Docker setup - Health checks for all services - Automatic restart policies - Resource limits configured - Ready for Nginx Proxy Manager
This commit is contained in:
58
app/api/projects/export/route.ts
Normal file
58
app/api/projects/export/route.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
import { projectService } from '@/lib/prisma';
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
try {
|
||||
// Get all projects with full data
|
||||
const projectsResult = await projectService.getAllProjects();
|
||||
const projects = projectsResult.projects || projectsResult;
|
||||
|
||||
// Format for export
|
||||
const exportData = {
|
||||
version: '1.0',
|
||||
exportDate: new Date().toISOString(),
|
||||
projects: projects.map(project => ({
|
||||
id: project.id,
|
||||
title: project.title,
|
||||
description: project.description,
|
||||
content: project.content,
|
||||
tags: project.tags,
|
||||
category: project.category,
|
||||
featured: project.featured,
|
||||
github: project.github,
|
||||
live: project.live,
|
||||
published: project.published,
|
||||
imageUrl: project.imageUrl,
|
||||
difficulty: project.difficulty,
|
||||
timeToComplete: project.timeToComplete,
|
||||
technologies: project.technologies,
|
||||
challenges: project.challenges,
|
||||
lessonsLearned: project.lessonsLearned,
|
||||
futureImprovements: project.futureImprovements,
|
||||
demoVideo: project.demoVideo,
|
||||
screenshots: project.screenshots,
|
||||
colorScheme: project.colorScheme,
|
||||
accessibility: project.accessibility,
|
||||
performance: project.performance,
|
||||
analytics: project.analytics,
|
||||
createdAt: project.createdAt,
|
||||
updatedAt: project.updatedAt
|
||||
}))
|
||||
};
|
||||
|
||||
// Return as downloadable JSON file
|
||||
return new NextResponse(JSON.stringify(exportData, null, 2), {
|
||||
status: 200,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Content-Disposition': `attachment; filename="portfolio-projects-${new Date().toISOString().split('T')[0]}.json"`
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Export error:', error);
|
||||
return NextResponse.json(
|
||||
{ error: 'Failed to export projects' },
|
||||
{ status: 500 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user