Files
OneDriveGDrive/README.md
MUIS1436 ab10baf983 chore(docker): optimize Dockerfiles and add healthchecks for Coolify deployment
- Add build arguments and environment variables for OAuth client IDs in frontend Dockerfile
- Install wget and add HEALTHCHECK commands to frontend and backend Dockerfiles
- Create non-root user in backend Dockerfile for improved security
- Update docker-compose.yml with healthcheck configurations and dynamic port/environment variable support
- Add network configuration and restart policies to docker-compose services
- Expand .env.example with additional OAuth secrets, ports, and environment variables for Coolify
- Enhance README.md with detailed Coolify deployment instructions and required environment variables table
2026-01-31 11:06:16 +05:00

138 lines
3.9 KiB
Markdown
Raw Permalink Blame History

# OneDrive ↔ Google Drive Streamer
A secure, high-performance application to stream files bidirectionally between Microsoft OneDrive and Google Drive.
Now powered by a **Node.js Express backend** for reliable server-side streaming and token management.
## Features
- <20> **Bidirectional Transfers**: Move files from OneDrive to Google Drive AND Google Drive to OneDrive.
- 🚀 **Server-Side Streaming**: Files are piped directly between cloud providers on the server, ensuring faster and more reliable transfers for large files.
- <20> **Secure OAuth 2.0**: Implements robust Authorization Code Flow via the backend.
- 📊 **Real-time Progress**: Track transfer status with live progress updates.
- 📁 **File Management**: Browse and select files from your connected cloud storage.
## Prerequisites
- Node.js (v18 or higher)
- npm or yarn
## Setup
### 1. Clone the repository
```bash
git clone <repository-url>
cd <repository-directory>
```
### 2. Install Dependencies
You need to install dependencies for both the frontend and the backend.
**Frontend:**
```bash
npm install
```
**Backend:**
```bash
cd server
npm install
cd ..
```
### 3. Configure Environment Variables
**Frontend (`.env`):**
Create a `.env` file in the root directory:
```env
VITE_MS_CLIENT_ID=your_microsoft_client_id
VITE_GOOGLE_CLIENT_ID=your_google_client_id
```
**Backend (`server/.env`):**
Create a `.env` file in the `server` directory:
```env
PORT=3001
# Microsoft Graph Credentials
VITE_MS_CLIENT_ID=your_microsoft_client_id
MS_CLIENT_SECRET=your_microsoft_client_secret
# Google Drive Credentials
VITE_GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
REDIRECT_URI=http://localhost:5173/auth/callback
```
> **Note:** You must register applications in both Azure Portal and Google Cloud Console.
> Ensure the Redirect URI is set to `http://localhost:5173/auth/callback`.
### 4. Run the Application
You need to run both the backend server and the frontend client.
**Start Backend (Terminal 1):**
```bash
cd server
npm run dev
```
*Server runs on http://localhost:3001*
**Start Frontend (Terminal 2):**
```bash
npm run dev
```
*Frontend runs on http://localhost:5173*
## Project Structure
- **`/server`**: Node.js Express Backend
- `src/routes`: API endpoints (`/auth`, `/transfer`)
- `src/services`: Cloud provider integration (`onedrive.ts`, `googledrive.ts`)
- **`/src`**: React Frontend
- `components`: UI components (Cards, Progress, Alerts)
- `lib/api.ts`: API client for communicating with the backend
- `App.tsx`: Main application logic and state management
## Technologies
- **Frontend**: React, TypeScript, Vite, Tailwind CSS, Lucide Icons, Shadcn UI
- **Backend**: Node.js, Express, TypeScript, Axios, Microsoft Graph Client, Google APIs
## Docker & Coolify Deployment
### Local Docker
```bash
# Build and run with Docker Compose
docker-compose up --build
# Access at http://localhost
```
### Coolify Deployment
#### From Public Repository
1. In Coolify, go to **Projects → New → From Git Repository**
2. Select **GitHub/GitLab/Bitbucket** and enter the repo URL
3. Set **Build Pack** to `Docker Compose`
4. Configure environment variables in Coolify's UI
#### From Private Repository
1. In Coolify, go to **Settings → Private Keys** and add your SSH key
2. Create new project with **Private Repository** option
3. Use SSH URL: `git@github.com:username/repo.git`
4. Configure environment variables in Coolify's UI
#### Required Environment Variables (Coolify UI)
| Variable | Description |
|----------|-------------|
| `VITE_MS_CLIENT_ID` | Microsoft/Azure OAuth Client ID |
| `MS_CLIENT_SECRET` | Microsoft/Azure OAuth Secret |
| `VITE_GOOGLE_CLIENT_ID` | Google OAuth Client ID |
| `GOOGLE_CLIENT_SECRET` | Google OAuth Secret |
| `REDIRECT_URI` | `https://yourdomain.com/auth/callback` |
> **Important**: Update your OAuth app redirect URIs in Azure Portal and Google Cloud Console to match your Coolify domain.
## License
ISC