Skip to content

youssef509/Platinum-Drive

Repository files navigation

☁️ Platinum Drive

Modern Cloud Storage Platform with Enterprise-Grade Security

Next.js TypeScript Prisma PostgreSQL License: MIT

A feature-rich, self-hosted cloud storage solution with advanced security, user management, and comprehensive admin controls.

Features β€’ Screenshots β€’ Installation β€’ Documentation β€’ License


🌟 Overview

Platinum Drive is an open-source cloud storage platform built with modern technologies, offering enterprise-level features for individuals and organizations. With a beautiful RTL interface, robust security features, and comprehensive admin controls, it's perfect for teams looking for a self-hosted storage solution.

⚠️ Language Notice: This project is currently available only in Arabic language with full RTL (Right-to-Left) support and Hijri calendar integration. ⚠️ For Demo: Email: user@platinum-app.com Password: 123456, I have Disabled some of the Settings in the user side, for the ADmin Side and FULLY FUNCATIONAL Version Contact me to Send the Deatils to you.

πŸ“Έ Screenshots

Home Dashboard Admin Panel File Upload
Home Admin Upload

View Full Screenshots Gallery β†’

✨ Key Features

πŸ” Security & Authentication

  • Two-Factor Authentication (2FA) with time-based OTP
  • Email Verification with 6-digit codes
  • Password Policies: History tracking, expiry, complexity rules
  • Account Protection: Login attempt tracking & lockout
  • Session Management with NextAuth.js
  • Bcrypt Password Hashing

πŸ“ File Management

  • Drag & Drop Upload with progress tracking
  • File Type Policies with size limits per type
  • Folder Organization with nested structures
  • Favorites System for quick access
  • Trash/Recycle Bin with 30-day retention
  • File Sharing with password protection & expiry

πŸ‘₯ User Management

  • Role-Based Access Control (Admin/User/Guest)
  • Storage Quotas per user
  • Login History tracking
  • Profile Customization with avatar upload
  • User Analytics and activity monitoring

πŸŽ›οΈ Admin Panel

  • Dashboard Analytics with visual charts
  • System Settings: 8 configuration tabs
  • User Management: Status, roles, quotas
  • File Type Policies: 16 default types
  • Email Configuration: SMTP settings
  • Security Controls: Global 2FA enforcement

🎨 Modern UI/UX

  • βœ… RTL Support for Arabic language
  • βœ… Dark Mode with system preference detection
  • βœ… Responsive Design for all devices
  • βœ… Live Arabic Clock with Hijri calendar
  • βœ… Toast Notifications for user feedback
  • βœ… Tab Navigation with active indicators

πŸ› οΈ Technology Stack

Frontend

  • Next.js 15.5.5 (App Router)
  • React 19
  • TypeScript 5.0
  • Tailwind CSS
  • Shadcn/ui Components
  • Lucide React Icons

Backend

  • Next.js API Routes
  • NextAuth.js Authentication
  • Prisma ORM
  • PostgreSQL Database
  • Bcryptjs Hashing
  • Nodemailer SMTP

DevOps

  • Docker Support
  • Google Cloud Run Ready
  • Environment-based Config
  • Database Migrations
  • Automated Seeding

πŸš€ Quick Start

Prerequisites

  • Node.js 20.x or higher
  • PostgreSQL 14.x or higher
  • npm or yarn package manager

Installation

# 1. Clone the repository
git clone https://github.com/youssef509/Platinum-Drive.git
cd Platinum-Drive

# 2. Install dependencies
npm install

# 3. Set up environment variables
cp .env.example .env
# Edit .env with your configuration

# 4. Set up the database
npx prisma migrate dev
npx prisma db seed

# 5. Run the development server
npm run dev

Visit http://localhost:3000 πŸŽ‰

Default Admin Account

After seeding the database, you can log in with:

  • Email: (check your seed file)
  • Password: (check your seed file)

βš™οΈ Configuration

Environment Variables

Create a .env file in the root directory:

# Database
DATABASE_URL="postgresql://user:password@localhost:5432/platinum_drive"

# NextAuth
NEXTAUTH_SECRET="your-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"
AUTH_TRUST_HOST="true"

# Email (Optional - for verification & 2FA)
SMTP_HOST="smtp.gmail.com"
SMTP_PORT="587"
SMTP_USER="your-email@gmail.com"
SMTP_PASSWORD="your-app-password"
SMTP_FROM="noreply@platinumdrive.com"

System Settings

After installation, navigate to Admin Panel β†’ System Settings to configure:

  • General: Site name, maintenance mode, language
  • Security: 2FA enforcement, password policies, login limits
  • Email: SMTP server configuration
  • Upload: File size limits, virus scanning
  • Storage: User quotas, auto-cleanup policies
  • Appearance: Theme, logo, branding
  • Notifications: Alert preferences
  • Advanced: System-level configurations

πŸ“š Documentation

Database Schema

Core Tables:

  • Users - User accounts with roles and quotas
  • Files - Uploaded files with metadata
  • Folders - Folder hierarchy
  • Shares - Secure file sharing
  • SystemSettings - Application config
  • FileTypePolicy - File validation rules
  • Notifications - User notifications
  • LoginHistory - Login tracking
  • PasswordHistory - Password changes
  • VerificationCode - Email codes
  • TwoFactorCode - 2FA OTP codes

See prisma/schema.prisma for the complete schema.

API Endpoints

Click to expand API documentation

Authentication

POST /api/auth/register           - Register new user
POST /api/auth/verify-credentials - Verify login credentials
POST /api/auth/verify             - Verify email code
POST /api/auth/request-2fa        - Request 2FA code
POST /api/auth/verify-2fa         - Verify 2FA code

Files

POST   /api/files/upload              - Upload files
GET    /api/files                     - List user files
GET    /api/files/[id]/download       - Download file
DELETE /api/files/[id]                - Delete file
POST   /api/files/[id]/favorite       - Toggle favorite

Sharing

POST /api/share                    - Create share link
GET  /api/share/public/[token]     - Access shared file
GET  /api/share/download/[token]   - Download shared file

Admin

GET  /api/admin/users              - List all users
PUT  /api/admin/users/[id]/status  - Update user status
PUT  /api/admin/users/[id]/quota   - Update storage quota
GET  /api/admin/settings           - Get system settings
PUT  /api/admin/settings/[key]     - Update setting
GET  /api/admin/file-types         - List file type policies
POST /api/admin/file-types         - Create file type policy

File Type Policies

The system includes 16 default file types out of the box:

Category Types Max Size
Images jpg, png, gif, webp 10 MB
Documents pdf, doc, docx, xls, xlsx, txt 50 MB
Audio mp3, wav 50-100 MB
Video mp4, mpeg 500 MB
Archives zip, rar 500 MB

Admins can customize these limits or add new types via the admin panel.

πŸ”’ Security Features

Authentication & Access Control

  • βœ… Strong password requirements (8+ chars, mixed case, numbers, symbols)
  • βœ… Account lockout after failed login attempts
  • βœ… Session management with HTTP-only cookies
  • βœ… Role-based access control (RBAC)

Two-Factor Authentication

  • βœ… Admin-controlled global enforcement
  • βœ… Time-based OTP codes (10-minute expiry)
  • βœ… Email delivery with resend functionality
  • βœ… Visual countdown timer

Email Verification

  • βœ… 6-digit verification codes
  • βœ… 15-minute code expiry
  • βœ… Required for account activation

Password Security

  • βœ… Password history (prevents reuse)
  • βœ… Configurable expiry policies
  • βœ… Bcrypt hashing algorithm
  • βœ… Complexity enforcement

File Security

  • βœ… File type validation
  • βœ… Size limit enforcement
  • βœ… Virus scanning capability (configurable)
  • βœ… Access control per file
  • βœ… Secure share tokens

🚒 Deployment

Docker Deployment

# Build the image
docker build -t platinum-drive .

# Run the container
docker run -p 3000:3000 \
  -e DATABASE_URL="your-db-url" \
  -e NEXTAUTH_SECRET="your-secret" \
  platinum-drive

Google Cloud Run

# Set your project
gcloud config set project YOUR_PROJECT_ID

# Enable required APIs
gcloud services enable cloudbuild.googleapis.com run.googleapis.com

# Build and push the image
gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/platinum-drive

# Deploy to Cloud Run
gcloud run deploy platinum-drive \
  --image gcr.io/YOUR_PROJECT_ID/platinum-drive \
  --platform managed \
  --region europe-west1 \
  --allow-unauthenticated \
  --port 8080 \
  --set-env-vars DATABASE_URL="your-db-url",NEXTAUTH_SECRET="your-secret"

Production Environment Variables

DATABASE_URL=postgresql://user:pass@host:5432/dbname
NEXTAUTH_SECRET=your-production-secret-min-32-chars
NEXTAUTH_URL=https://your-domain.com
AUTH_TRUST_HOST=true
NODE_ENV=production
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASSWORD=your-app-password
SMTP_FROM=noreply@your-domain.com

πŸ“œ Available Scripts

# Development
npm run dev          # Start development server
npm run build        # Build for production
npm start            # Start production server

# Database
npx prisma migrate dev       # Run migrations (dev)
npx prisma migrate deploy    # Run migrations (prod)
npx prisma generate          # Generate Prisma Client
npx prisma studio            # Open Prisma Studio GUI
npx prisma db seed           # Seed database with initial data

# Type Checking & Linting
npm run type-check   # Run TypeScript compiler check
npm run lint         # Run ESLint

πŸ“ Project Structure

platinum-drive/
β”œβ”€β”€ prisma/
β”‚   β”œβ”€β”€ schema.prisma           # Database schema
β”‚   β”œβ”€β”€ seed.ts                 # Database seeding script
β”‚   └── migrations/             # Database migrations
β”œβ”€β”€ public/
β”‚   └── uploads/                # User uploaded files
β”‚       β”œβ”€β”€ avatars/            # User avatars
β”‚       └── files/              # Uploaded files
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ (auth)/             # Auth pages (login, register, verify)
β”‚   β”‚   β”œβ”€β”€ admin/              # Admin panel pages
β”‚   β”‚   β”œβ”€β”€ api/                # API routes
β”‚   β”‚   β”œβ”€β”€ files/              # File management pages
β”‚   β”‚   β”œβ”€β”€ profile/            # User profile pages
β”‚   β”‚   └── settings/           # User settings pages
β”‚   β”œβ”€β”€ components/             # React components
β”‚   β”‚   β”œβ”€β”€ ui/                 # Shadcn UI components
β”‚   β”‚   β”œβ”€β”€ shared/             # Shared components
β”‚   β”‚   └── layout/             # Layout components
β”‚   β”œβ”€β”€ hooks/                  # Custom React hooks
β”‚   β”œβ”€β”€ lib/                    # Utility libraries
β”‚   β”‚   β”œβ”€β”€ auth/               # Authentication logic
β”‚   β”‚   β”œβ”€β”€ db/                 # Database utilities
β”‚   β”‚   β”œβ”€β”€ security/           # Security utilities
β”‚   β”‚   └── utils/              # General utilities
β”‚   └── types/                  # TypeScript type definitions
β”œβ”€β”€ Dockerfile                  # Docker configuration
β”œβ”€β”€ docker-compose.yml          # Docker Compose setup
β”œβ”€β”€ .env.example                # Environment variables template
└── package.json                # Dependencies and scripts

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ› Bug Reports

If you discover a bug, please create an issue on GitHub with:

  • Description of the bug
  • Steps to reproduce
  • Expected behavior
  • Screenshots (if applicable)
  • Your environment (OS, Node version, etc.)

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2025 Youssef Ahmed

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

πŸ‘¨β€πŸ’» Author

Youssef Ahmed

πŸ™ Acknowledgments

Built with amazing open-source technologies:

⭐ Show Your Support

If you find this project useful, please consider giving it a star on GitHub! It helps others discover the project and motivates continued development.


Made with ❀️ by Youssef Ahmed

Platinum Drive - Your files, secure and accessible ☁️

⬆ Back to Top

About

Serverless file management platform built with Next.js, and PostgreSQL. Supports secure uploads, smart analytics, and real-time notifications for uploads, downloads, and link expirations. Works with AWS S3 or Google Cloud Storage for scalable and reliable file handling.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages