Skip to content

friza13/cloud_drive_mini

Repository files navigation

Cloud Drive Mini - MySQL Version

A modern full-stack file storage application built with Next.js 15, Prisma, and MySQL.

🚀 Setup Instructions

1. Install Dependencies

```bash npm install ```

2. Setup MySQL Database

Option A: Local MySQL

  1. Install MySQL on your system
  2. Create a database: ```sql CREATE DATABASE cloud_drive_mini; ```

Option B: Docker MySQL

```bash docker run --name mysql-cloud-drive
-e MYSQL_ROOT_PASSWORD=rootpassword
-e MYSQL_DATABASE=cloud_drive_mini
-e MYSQL_USER=cloud_user
-e MYSQL_PASSWORD=cloud_password
-p 3306:3306
-d mysql:8.0 ```

3. Environment Variables

Create a .env file: ```env DATABASE_URL="mysql://username:password@localhost:3306/cloud_drive_mini" JWT_SECRET="your-super-secret-jwt-key-here" ```

4. Database Migration

```bash

Generate Prisma client

npm run db:generate

Push schema to database

npm run db:push

Or run migrations (recommended for production)

npm run db:migrate ```

5. Run Development Server

```bash npm run dev ```

📊 Database Schema

Users Table

  • id - Unique identifier (CUID)
  • email - User email (unique)
  • name - User full name
  • password - Hashed password
  • createdAt - Account creation timestamp
  • updatedAt - Last update timestamp

Files Table

  • id - Unique identifier (CUID)
  • name - File/folder name
  • type - FILE or FOLDER enum
  • size - File size in bytes (nullable for folders)
  • folder - Parent folder path
  • path - Full file path
  • userId - Reference to user
  • createdAt - Creation timestamp
  • updatedAt - Last update timestamp

🛠 Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run start - Start production server
  • npm run db:generate - Generate Prisma client
  • npm run db:push - Push schema to database
  • npm run db:migrate - Run database migrations
  • npm run db:studio - Open Prisma Studio

🔧 Features

MySQL Database IntegrationUser Authentication & AuthorizationFile Upload & DownloadFolder ManagementResponsive DesignReal-time NotificationsSecure File Storage

🔒 Security Features

  • Password hashing with bcrypt
  • Session-based authentication
  • SQL injection protection via Prisma
  • File access control per user
  • Secure file uploads with validation

📱 Tech Stack

  • Frontend: Next.js 15, React 18, Tailwind CSS
  • Backend: Next.js API Routes, Server Actions
  • Database: MySQL with Prisma ORM
  • Authentication: Custom session-based auth
  • UI Components: shadcn/ui + Radix UI
  • Icons: Lucide React

cloud_drive_mini

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors