Skip to content

KUNDANIOS/CloudDrive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

25 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŒ₯️ CloudDrive - Personal Cloud Storage Solution

A full-stack cloud storage application with file management, sharing capabilities, and Google OAuth authentication.

TypeScript JavaScript CSS

✨ Features

  • πŸ“ File & Folder Management - Upload, organize, and manage your files
  • πŸ” Google OAuth Authentication - Secure login with Google
  • πŸ“€ File Upload/Download - Seamless file operations
  • πŸ”— File Sharing - Generate shareable links for your files
  • πŸ—‘οΈ Trash & Restore - Safely delete and recover files
  • ⭐ Starred Files - Mark important files for quick access
  • πŸ“Š Storage Tracking - Monitor your storage usage
  • πŸ“± Responsive Design - Works on all devices

πŸ› οΈ Tech Stack

Frontend

  • Next.js 14 - React framework with App Router
  • TypeScript - Type-safe development
  • Tailwind CSS - Utility-first styling
  • Zustand - State management
  • Lucide React - Icon library

Backend

  • Node.js - JavaScript runtime
  • Express - Web framework
  • Passport.js - Authentication middleware
  • Multer - File upload handling

Database & Storage

  • Supabase - PostgreSQL database
  • Supabase Storage - File storage solution

Authentication

  • Google OAuth 2.0 - Social authentication

πŸ“‹ Prerequisites

  • Node.js 18+ and npm
  • Supabase account
  • Google Cloud Console project (for OAuth)
  • Domain name (for production deployment)

πŸš€ Local Development Setup

1. Clone the repository

git clone https://github.com/KUNDANIOS/CloudDrive.git
cd CloudDrive

2. Install dependencies

# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

3. Configure Environment Variables

Backend (backend/.env)

Create a .env file based on .env.example:

# Database
DATABASE_URL=your_supabase_connection_string
SUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key

# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:5000/auth/google/callback

# Session
SESSION_SECRET=your_random_session_secret

# Server
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:3000

Frontend (frontend/.env.local)

Create a .env.local file:

NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_google_client_id

4. Set up Supabase

  1. Create a new project at supabase.com
  2. Run the database schema (provided in /backend/database/schema.sql)
  3. Enable Storage and create a bucket named files
  4. Copy your project URL and anon key to .env files

5. Set up Google OAuth

  1. Go to Google Cloud Console
  2. Create a new project or select existing one
  3. Enable Google+ API
  4. Create OAuth 2.0 credentials
  5. Add authorized redirect URIs:
    • http://localhost:5000/auth/google/callback (development)
    • https://api.yourdomain.com/auth/google/callback (production)
  6. Copy Client ID and Secret to .env files

6. Run the application

# Terminal 1 - Backend
cd backend
npm run dev

# Terminal 2 - Frontend
cd frontend
npm run dev

7. Open your browser

Visit http://localhost:3000

πŸ“ Project Structure

CloudDrive/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   └── google.js          # Google OAuth strategy
β”‚   β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   β”‚   └── authMiddleware.js  # Authentication middleware
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ auth.js            # Authentication routes
β”‚   β”‚   β”‚   β”œβ”€β”€ files.js           # File management routes
β”‚   β”‚   β”‚   β”œβ”€β”€ folders.js         # Folder management routes
β”‚   β”‚   β”‚   β”œβ”€β”€ shares.js          # File sharing routes
β”‚   β”‚   β”‚   └── trash.js           # Trash management routes
β”‚   β”‚   β”œβ”€β”€ index.js               # Express server entry
β”‚   β”‚   └── supabase.js            # Supabase client
β”‚   β”œβ”€β”€ .env.example
β”‚   └── package.json
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   β”œβ”€β”€ (auth)/            # Auth pages (login, register)
β”‚   β”‚   β”‚   β”œβ”€β”€ (dashboard)/       # Dashboard pages
β”‚   β”‚   β”‚   └── layout.tsx
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/         # Dashboard components
β”‚   β”‚   β”‚   └── modals/            # Modal components
β”‚   β”‚   └── lib/
β”‚   β”‚       β”œβ”€β”€ api/               # API client functions
β”‚   β”‚       β”œβ”€β”€ store/             # Zustand stores
β”‚   β”‚       └── types/             # TypeScript types
β”‚   β”œβ”€β”€ .env.example
β”‚   └── package.json
β”œβ”€β”€ .gitignore
└── README.md

πŸ”’ Security Features

  • Environment variables for sensitive data
  • Google OAuth 2.0 authentication
  • Session management with secure cookies
  • File access control per user
  • CORS configuration
  • Input validation and sanitization

🌐 Deployment

Ready to deploy? Check out the Deployment Guide for detailed instructions on deploying to:

  • Frontend: Vercel (recommended for Next.js)
  • Backend: Render.com or Railway.app
  • Database: Supabase (managed PostgreSQL)

Quick Deployment Steps

  1. Push code to GitHub βœ… (Done!)
  2. Deploy backend to Render/Railway
  3. Deploy frontend to Vercel
  4. Configure custom domain
  5. Update OAuth callback URLs
  6. Set environment variables on hosting platforms

🀝 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

πŸ“ License

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

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

KUNDANIOS

πŸ™ Acknowledgments

πŸ“§ Contact

For any queries or support, please open an issue on GitHub.


⭐ If you found this project helpful, please give it a star!

About

CloudDrive

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published