A full-stack cloud storage application built with Next.js, Express, TypeScript, and Supabase, offering file management, sharing, and real-time collaboration features.
🚀 Frontend: https://onedrive-frontend.vercel.app
🔧 Backend API: https://onedrive-backend.vercel.app
- File Management: Upload, download, delete, and organize files in folders
- File Sharing: Share files with other users with customizable permissions
- Real-time Updates: Live notifications for file changes and sharing activities
- Version Control: Track file versions and restore previous versions
- Comments: Add comments to files for collaboration
- Search: Full-text search across all files and folders
- Favorites: Mark important files as favorites for quick access
- Trash: Recover deleted files from trash
- Admin Dashboard: Monitor system usage and manage users
- Responsive Design: Works seamlessly on desktop and mobile devices
- Next.js 14 with App Router
- TypeScript
- Tailwind CSS
- Shadcn/ui Components
- TanStack Query for data fetching
- Socket.io Client for real-time updates
- Express.js
- TypeScript
- Supabase for authentication and database
- Socket.io for WebSocket connections
- Multer for file uploads
- Sharp for image processing
- PostgreSQL (via Supabase)
- Supabase Storage for file storage
- Docker support for containerization
- Vercel for deployment
- Node.js 20 or higher
- npm or yarn
- Supabase account
- Docker (optional)
Create .env files in both frontend and backend directories:
PORT=5001
NODE_ENV=development
SUPABASE_URL=your_supabase_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
FRONTEND_URL=http://localhost:3000
CORS_ORIGINS=http://localhost:3000
MAX_FILE_SIZE=5368709120
ALLOWED_FILE_TYPES=image/*,application/pdf,text/*,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/zip,application/x-zip-compressed,video/*,audio/*
NEXT_PUBLIC_API_URL=http://localhost:5001/api
NEXT_PUBLIC_SOCKET_URL=http://localhost:5001
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
- Clone the repository
git clone https://github.com/Algoace1403/OneDrive-clone.git
cd OneDrive-clone- Install backend dependencies
cd backend
npm install- Install frontend dependencies
cd ../frontend
npm install-
Set up Supabase
- Create a new Supabase project
- Run the SQL migrations in
backend/supabase/migrations - Update environment variables with your Supabase credentials
-
Build the backend
cd backend
npm run build- Start the backend
npm start- Start the frontend (in a new terminal)
cd frontend
npm run dev- Clone the repository and create
.envfile from.env.example
cp .env.example .env-
Update the
.envfile with your Supabase credentials -
Build and run with Docker Compose
docker-compose up --buildThe application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:5001
POST /api/auth/register- Register new userPOST /api/auth/login- Login userPOST /api/auth/logout- Logout userGET /api/auth/me- Get current userPUT /api/auth/profile- Update profilePOST /api/auth/refresh- Refresh tokenPOST /api/auth/reset-password- Reset password
GET /api/files- List files and foldersPOST /api/files/upload- Upload fileGET /api/files/:id- Get file detailsPUT /api/files/:id- Update fileDELETE /api/files/:id- Delete filePATCH /api/files/:id/favorite- Toggle favoriteGET /api/files/:id/download- Download fileGET /api/files/recent- Get recent filesGET /api/files/favorites- Get favoritesGET /api/files/trash- Get trash itemsPOST /api/files/:id/restore- Restore from trashGET /api/files/search- Search files
POST /api/folders- Create folderPUT /api/folders/:id- Update folderDELETE /api/folders/:id- Delete folder
POST /api/share/:fileId- Share fileGET /api/files/:id/shares- Get file sharesDELETE /api/files/shares/:shareId- Remove sharePATCH /api/share/:fileId/:shareId- Update permissions
GET /api/files/:id/comments- Get commentsPOST /api/files/:id/comments- Add commentPUT /api/files/:id/comments/:commentId- Update commentDELETE /api/files/:id/comments/:commentId- Delete comment
Both frontend and backend are configured for Vercel deployment.
- Install Vercel CLI:
npm i -g vercel - Run
vercelin the backend directory - Configure environment variables in Vercel dashboard
- Run
vercelin the frontend directory - Update
NEXT_PUBLIC_API_URLto your backend URL - Configure environment variables in Vercel dashboard
Build production images:
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -dcd backend
npm test- ESLint and Prettier are configured
- Run
npm run lintto check code style - Run
npm run formatto format code
- Migrations are in
backend/supabase/migrations - Apply migrations through Supabase dashboard
onedrive-clone/
├── frontend/ # Next.js frontend application
│ ├── app/ # App router pages
│ ├── components/ # React components
│ ├── lib/ # Utilities and hooks
│ └── public/ # Static assets
├── backend/ # Express backend application
│ ├── src/
│ │ ├── controllers/ # Route controllers
│ │ ├── services/ # Business logic
│ │ ├── routes/ # API routes
│ │ ├── middleware/ # Express middleware
│ │ └── config/ # Configuration files
│ └── dist/ # Compiled JavaScript
└── docker-compose.yml # Docker configuration
- JWT-based authentication
- Role-based access control
- File type validation
- Size limit enforcement
- CORS configuration
- Input validation and sanitization
- Image optimization with Sharp
- Lazy loading for file lists
- Pagination for large datasets
- Caching with React Query
- Optimized database queries
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
MIT License
For issues and questions, please open a GitHub issue or contact support.
