An open API service indexing awesome lists of open source software.

https://github.com/delinworks/twodrive

TwoDrive is a self-hosted OneDrive-like file manager built with Laravel. It includes a virtual filesystem with folder hierarchy, file uploads, previews, folder sharing, etc. Designed to be simple, fast, and clean โ€” ideal for personal use or internal deployment.
https://github.com/delinworks/twodrive

alpine alpinejs filesystem laravel laravel9 laravelmix php8 tailwindcss webpack

Last synced: 3 months ago
JSON representation

TwoDrive is a self-hosted OneDrive-like file manager built with Laravel. It includes a virtual filesystem with folder hierarchy, file uploads, previews, folder sharing, etc. Designed to be simple, fast, and clean โ€” ideal for personal use or internal deployment.

Awesome Lists containing this project

README

          

# ๐Ÿ“‚ TwoDrive โ€“ Laravel-Based Personal Cloud Storage

TwoDrive is a self-hosted OneDrive-like file manager built with Laravel. It includes a virtual filesystem with folder hierarchy, file uploads, previews, folder sharing, etc. Designed to be simple, fast, and clean โ€” ideal for personal use or internal deployment.

---
Try [TwoDrive](https://turky.top) Now!
## ๐Ÿš€ Features

- ๐Ÿ—‚ **Hierarchical Virtual File System** โ€“ Files and folders managed in a tree structure, not dumped flat.
- ๐Ÿ“ **Upload / Download / Preview**
- ๐Ÿ“ **Share** - Share a folder and it's contents using a link.
- ๐Ÿงพ **File Metadata** โ€“ Size, type, last updated info shown inline.
- ๐Ÿง  **Built with Laravel** โ€“ Clean structure, Eloquent-based models, SQLite-powered.

---

## ๐Ÿ›  Tech Stack

- **Backend**: Laravel 9
- **Database**: SQLite
- **Frontend**: Alpine.js, TailwindCSS

---

## ๐Ÿ“ฆ Requirements

- PHP 8.1+
- Composer
- SQLite
- Node.js + npm

---

## ๐Ÿงฐ Getting Started

### 1. Clone the Repo

```bash
git clone https://github.com/your-username/twodrive.git
cd twodrive
````

---

### 2. Install Dependencies

```bash
composer install --optimize-autoloader --no-dev
```

If you're using frontend tooling:

```bash
npm install && npm run build
```

---

### 3. Setup Environment

Copy `.env.example` to `.env` and configure it:

```bash
cp .env.example .env
php artisan key:generate
```

Basic `.env` values:

```env
APP_NAME=TwoDrive
APP_ENV=production
APP_DEBUG=false
APP_URL=https://yourdomain.com

FILESYSTEM_DRIVER=local
DB_CONNECTION=sqlite
DB_DATABASE=/absolute/path/to/database.sqlite
```

> **Note**: Create an empty SQLite file:

```bash
touch database/database.sqlite
```

---

### 4. Run Migrations

```bash
php artisan migrate --force
php artisan storage:link
```

---

### 5. Run the App (Local Dev)

```bash
php artisan serve
```

Visit `http://localhost:8000`

---

## โš™๏ธ Recommended Production Setup

> You **must not** use `php artisan serve` in production.

Instead:

* Deploy via **Nginx** + **PHP-FPM**
* Use **Cloudflare Tunnel** to secure access or manually host it on your VPS
* Point Cloudflare to your internal server (localhost:80)

Example Nginx config:

```nginx
server {
listen 80;
server_name yourdomain.com;
root /var/www/twodrive/public;

index index.php index.html;

location / {
try_files $uri $uri/ /index.php?$query_string;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
```
---

## ๐Ÿ“ File Structure (Brief Overview)

```
.
โ”œโ”€โ”€ app/
โ”‚ โ”œโ”€โ”€ Models/ # File, Folder models with hierarchy logic
โ”‚ โ”œโ”€โ”€ Http/Controllers/ # Upload, Download, Browse logic
โ”œโ”€โ”€ database/
โ”‚ โ””โ”€โ”€ migrations/
โ”œโ”€โ”€ public/ # Entry point (index.php)
โ”œโ”€โ”€ resources/
โ”‚ โ””โ”€โ”€ views/ # Blade templates
โ”œโ”€โ”€ routes/
โ”‚ โ””โ”€โ”€ web.php # Main routes
โ””โ”€โ”€ .env # Your config
```

---

## ๐Ÿ‘ทโ€โ™‚๏ธ To-Do / Improvements

* [X] Public sharing links
* [ ] File thumbnails for images/videos
* [ ] Expiring/signed download links
* [ ] Folder-level permissions (future multi-user)
* [ ] Chunked large file uploads

---

## ๐Ÿ“ License

This project is open source and MIT licensed.

---

## ๐Ÿค Credits

Built with โค๏ธ using Laravel, Tailwind, and Alpine. Inspired by the usability of OneDrive and the self-hosting of Nextcloud.