Files
portfolio/prisma/seed.ts
Dennis Konkol 203a332306 update
2025-09-02 23:46:36 +00:00

330 lines
11 KiB
TypeScript

import { PrismaClient } from '@prisma/client';
const prisma = new PrismaClient();
async function main() {
console.log('🌱 Seeding database...');
// Clear existing data
await prisma.userInteraction.deleteMany();
await prisma.pageView.deleteMany();
await prisma.project.deleteMany();
// Create sample projects
const projects = [
{
title: "Portfolio Website 2.0",
description: "A cutting-edge portfolio website showcasing modern web development techniques with advanced features and stunning design.",
content: `# Portfolio Website 2.0
This is my personal portfolio website built with cutting-edge web technologies. The site features a dark theme with glassmorphism effects, smooth animations, and advanced interactive elements.
## 🚀 Features
- **Responsive Design**: Works perfectly on all devices
- **Dark Theme**: Modern dark mode with glassmorphism effects
- **Animations**: Smooth animations powered by Framer Motion
- **Markdown Support**: Projects are written in Markdown for easy editing
- **Performance**: Optimized for speed and SEO
- **Interactive Elements**: Advanced UI components and micro-interactions
- **Accessibility**: WCAG 2.1 AA compliant
- **Analytics**: Built-in performance and user analytics
## 🛠️ Technologies Used
- Next.js 15
- TypeScript
- Tailwind CSS
- Framer Motion
- React Markdown
- Advanced CSS (Grid, Flexbox, Custom Properties)
- Performance optimization techniques
## 📈 Development Process
The website was designed with a focus on user experience, performance, and accessibility. I used modern CSS techniques and best practices to create a responsive, fast, and beautiful layout.
## 🔮 Future Improvements
- AI-powered content suggestions
- Advanced project filtering and search
- Interactive project demos
- Real-time collaboration features
- Advanced analytics dashboard
## 🔗 Links
- [Live Demo](https://dki.one)
- [GitHub Repository](https://github.com/Denshooter/portfolio)`,
tags: ["Next.js", "TypeScript", "Tailwind CSS", "Framer Motion", "Advanced CSS", "Performance"],
featured: true,
category: "Web Development",
date: "2024",
published: true,
difficulty: "ADVANCED",
timeToComplete: "3-4 weeks",
technologies: ["Next.js 15", "TypeScript", "Tailwind CSS", "Framer Motion", "React Markdown"],
challenges: ["Complex state management", "Performance optimization", "Responsive design across devices"],
lessonsLearned: ["Advanced CSS techniques", "Performance optimization", "User experience design"],
futureImprovements: ["AI integration", "Advanced analytics", "Real-time features"],
demoVideo: "",
screenshots: [],
colorScheme: "Dark with glassmorphism",
accessibility: true,
performance: {
lighthouse: 95,
bundleSize: "45KB",
loadTime: "1.2s"
},
analytics: {
views: 1250,
likes: 89,
shares: 23
}
},
{
title: "E-Commerce Platform",
description: "A full-stack e-commerce solution with advanced features like real-time inventory, payment processing, and admin dashboard.",
content: `# E-Commerce Platform
A comprehensive e-commerce solution built with modern web technologies, featuring a robust backend, secure payment processing, and an intuitive user interface.
## 🚀 Features
- **User Authentication**: Secure login and registration
- **Product Management**: Add, edit, and delete products
- **Shopping Cart**: Persistent cart with real-time updates
- **Payment Processing**: Stripe integration for secure payments
- **Order Management**: Complete order lifecycle tracking
- **Admin Dashboard**: Comprehensive admin interface
- **Inventory Management**: Real-time stock tracking
- **Responsive Design**: Mobile-first approach
## 🛠️ Technologies Used
- Frontend: React, TypeScript, Tailwind CSS
- Backend: Node.js, Express, Prisma
- Database: PostgreSQL
- Payment: Stripe API
- Authentication: JWT, bcrypt
- Deployment: Docker, AWS
## 📈 Development Process
Built with a focus on scalability and user experience. Implemented proper error handling, input validation, and security measures throughout the development process.
## 🔮 Future Improvements
- Multi-language support
- Advanced analytics dashboard
- AI-powered product recommendations
- Mobile app development
- Advanced search and filtering`,
tags: ["React", "Node.js", "PostgreSQL", "Stripe", "E-commerce", "Full-Stack"],
featured: true,
category: "Full-Stack",
date: "2024",
published: true,
difficulty: "EXPERT",
timeToComplete: "8-10 weeks",
technologies: ["React", "Node.js", "PostgreSQL", "Stripe", "Docker", "AWS"],
challenges: ["Payment integration", "Real-time updates", "Scalability", "Security"],
lessonsLearned: ["Payment processing", "Real-time systems", "Security best practices", "Scalable architecture"],
futureImprovements: ["AI recommendations", "Mobile app", "Multi-language", "Advanced analytics"],
demoVideo: "",
screenshots: [],
colorScheme: "Professional and clean",
accessibility: true,
performance: {
lighthouse: 92,
bundleSize: "78KB",
loadTime: "1.8s"
},
analytics: {
views: 890,
likes: 67,
shares: 18
}
},
{
title: "Task Management App",
description: "A collaborative task management application with real-time updates, team collaboration, and progress tracking.",
content: `# Task Management App
A collaborative task management application designed for teams to organize, track, and complete projects efficiently.
## 🚀 Features
- **Task Creation**: Easy task creation with descriptions and deadlines
- **Team Collaboration**: Assign tasks to team members
- **Real-time Updates**: Live updates across all connected clients
- **Progress Tracking**: Visual progress indicators and analytics
- **File Attachments**: Support for documents and images
- **Notifications**: Email and push notifications for updates
- **Mobile Responsive**: Works perfectly on all devices
- **Dark/Light Theme**: User preference support
## 🛠️ Technologies Used
- Frontend: React, TypeScript, Tailwind CSS
- Backend: Node.js, Express, Socket.io
- Database: MongoDB
- Real-time: WebSockets
- Authentication: JWT
- File Storage: AWS S3
- Deployment: Heroku
## 📈 Development Process
Focused on creating an intuitive user interface and seamless real-time collaboration. Implemented proper error handling and user feedback throughout the development.
## 🔮 Future Improvements
- Advanced reporting and analytics
- Integration with external tools
- Mobile app development
- AI-powered task suggestions
- Advanced automation features`,
tags: ["React", "Node.js", "MongoDB", "WebSockets", "Collaboration", "Real-time"],
featured: false,
category: "Web Application",
date: "2024",
published: true,
difficulty: "INTERMEDIATE",
timeToComplete: "6-8 weeks",
technologies: ["React", "Node.js", "MongoDB", "Socket.io", "AWS S3", "Heroku"],
challenges: ["Real-time synchronization", "Team collaboration", "File management", "Mobile responsiveness"],
lessonsLearned: ["WebSocket implementation", "Real-time systems", "File upload handling", "Team collaboration features"],
futureImprovements: ["Advanced analytics", "Mobile app", "AI integration", "Automation"],
demoVideo: "",
screenshots: [],
colorScheme: "Modern and clean",
accessibility: true,
performance: {
lighthouse: 88,
bundleSize: "65KB",
loadTime: "1.5s"
},
analytics: {
views: 567,
likes: 34,
shares: 12
}
},
{
title: "Weather Dashboard",
description: "A beautiful weather application with real-time data, forecasts, and interactive maps.",
content: `# Weather Dashboard
A beautiful and functional weather application that provides real-time weather data, forecasts, and interactive maps.
## 🚀 Features
- **Current Weather**: Real-time weather conditions
- **Forecast**: 7-day weather predictions
- **Interactive Maps**: Visual weather maps with overlays
- **Location Search**: Find weather for any location
- **Weather Alerts**: Severe weather notifications
- **Historical Data**: Past weather information
- **Responsive Design**: Works on all devices
- **Offline Support**: Basic functionality without internet
## 🛠️ Technologies Used
- Frontend: React, TypeScript, Tailwind CSS
- Maps: Mapbox GL JS
- Weather API: OpenWeatherMap
- State Management: Zustand
- Charts: Chart.js
- Icons: Weather Icons
- Deployment: Vercel
## 📈 Development Process
Built with a focus on user experience and visual appeal. Implemented proper error handling for API failures and created an intuitive interface for weather information.
## 🔮 Future Improvements
- Weather widgets for other websites
- Advanced forecasting algorithms
- Weather-based recommendations
- Social sharing features
- Weather photography integration`,
tags: ["React", "TypeScript", "Weather API", "Maps", "Real-time", "UI/UX"],
featured: false,
category: "Web Application",
date: "2024",
published: true,
difficulty: "BEGINNER",
timeToComplete: "3-4 weeks",
technologies: ["React", "TypeScript", "Tailwind CSS", "Mapbox", "OpenWeatherMap", "Chart.js"],
challenges: ["API integration", "Map implementation", "Responsive design", "Error handling"],
lessonsLearned: ["External API integration", "Map libraries", "Responsive design", "Error handling"],
futureImprovements: ["Advanced forecasting", "Weather widgets", "Social features", "Mobile app"],
demoVideo: "",
screenshots: [],
colorScheme: "Light and colorful",
accessibility: true,
performance: {
lighthouse: 91,
bundleSize: "52KB",
loadTime: "1.3s"
},
analytics: {
views: 423,
likes: 28,
shares: 8
}
}
];
for (const project of projects) {
await prisma.project.create({
data: project
});
}
console.log(`✅ Created ${projects.length} sample projects`);
// Create some sample analytics data
for (let i = 1; i <= 4; i++) {
// Create page views
for (let j = 0; j < Math.floor(Math.random() * 100) + 50; j++) {
await prisma.pageView.create({
data: {
projectId: i,
page: `/projects/${i}`,
ip: `192.168.1.${Math.floor(Math.random() * 255)}`,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36',
referrer: 'https://google.com'
}
});
}
// Create user interactions
for (let j = 0; j < Math.floor(Math.random() * 20) + 10; j++) {
await prisma.userInteraction.create({
data: {
projectId: i,
type: Math.random() > 0.5 ? 'LIKE' : 'SHARE',
ip: `192.168.1.${Math.floor(Math.random() * 255)}`,
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
}
});
}
}
console.log('✅ Created sample analytics data');
console.log('🎉 Database seeding completed!');
}
main()
.catch((e) => {
console.error('❌ Error seeding database:', e);
process.exit(1);
})
.finally(async () => {
await prisma.$disconnect();
});