🚀 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:
Dennis Konkol
2025-09-05 21:35:54 +00:00
parent c736f860aa
commit 9835bb810d
19 changed files with 1386 additions and 45 deletions

View File

@@ -1,5 +1,6 @@
import { NextRequest, NextResponse } from 'next/server';
import { prisma } from '@/lib/prisma';
import { apiCache } from '@/lib/cache';
export async function GET(request: NextRequest) {
try {
@@ -12,6 +13,15 @@ export async function GET(request: NextRequest) {
const difficulty = searchParams.get('difficulty');
const search = searchParams.get('search');
// Create cache key based on parameters
const cacheKey = `projects:${page}:${limit}:${category || 'all'}:${featured || 'all'}:${published || 'all'}:${difficulty || 'all'}:${search || 'all'}`;
// Check cache first
const cached = await apiCache.getProjects();
if (cached && !search) { // Don't cache search results
return NextResponse.json(cached);
}
const skip = (page - 1) * limit;
const where: any = {};
@@ -40,12 +50,19 @@ export async function GET(request: NextRequest) {
prisma.project.count({ where })
]);
return NextResponse.json({
const result = {
projects,
total,
pages: Math.ceil(total / limit),
currentPage: page
});
};
// Cache the result (only for non-search queries)
if (!search) {
await apiCache.setProjects(result);
}
return NextResponse.json(result);
} catch (error) {
console.error('Error fetching projects:', error);
return NextResponse.json(
@@ -67,6 +84,9 @@ export async function POST(request: NextRequest) {
}
});
// Invalidate cache
await apiCache.invalidateAll();
return NextResponse.json(project);
} catch (error) {
console.error('Error creating project:', error);