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.
- Host: GitHub
- URL: https://github.com/delinworks/twodrive
- Owner: DelinWorks
- Created: 2025-08-05T21:13:27.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-05T23:06:45.000Z (11 months ago)
- Last Synced: 2025-08-06T00:20:18.059Z (11 months ago)
- Topics: alpine, alpinejs, filesystem, laravel, laravel9, laravelmix, php8, tailwindcss, webpack
- Language: PHP
- Homepage: https://turky.top
- Size: 491 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.