A full-stack Google Drive clone with Go REST API + React Frontend + PostgreSQL
This project can be easily set up and run using Docker Compose. This will start the backend API, the PostgreSQL database, and the React frontend.
- Docker and Docker Compose installed on your system.
-
Clone the repository:
git https://github.com/shri771/gdrive cd gdrive -
Start the application:
docker compose up -d --build
This command will:
- Build the Docker images for the backend API and the PostgreSQL database.
- Start the PostgreSQL database container.
- Run database migrations to set up the schema.
- Load initial data (including a dummy user).
- Start the backend API container.
- Start the React frontend development server.
-
Access the application:
- Frontend: Open your web browser and navigate to
http://localhost:1573 - Backend API: The API will be running on
http://localhost:1030
- Frontend: Open your web browser and navigate to
For quick testing, you can use the following dummy account:
- Email:
tst@g - Password:
shrikant
Backend (Go - Port 1030):
- β PostgreSQL database with complete schema (10 tables)
- β Type-safe SQL queries (SQLC)
- β Complete REST API with all features
- β File storage service with thumbnails
- β CORS enabled for React frontend
- β JWT-based authentication
- β Advanced features: sharing, comments, versions, activity logs
Frontend (React + Vite - Port 5173):
- β Complete Google Drive UI replica
- β React Router setup with all views
- β Full Dashboard with file/folder management
- β Drag & drop file uploads
- β File sharing dialog
- β Comments panel
- β Version history viewer
- β Storage analytics
- β Context menus
- β File preview/viewer
- β Advanced search
# From project root
go run cmd/server/main.goBackend runs on: http://localhost:1030
cd frontend
npm run devFrontend runs on: http://localhost:5173
- π User registration and authentication (JWT)
- π File upload, download, rename, delete
- π Folder creation with nested hierarchy
- π― Drag & drop file uploads
- β Star files and folders
- ποΈ Trash with restore functionality
- π Advanced search with filters
- π Storage usage analytics
- π₯ File sharing with users (viewer/editor roles)
- π Public share link generation
- π File comments
- π Version history tracking
- π Activity logs
- πΌοΈ Automatic thumbnail generation
- π¨ File preview/viewer
- π± Responsive UI (Google Drive clone)
- Complete Dashboard matching Google Drive layout
- Header with search, settings, profile
- Sidebar with My Drive, Recent, Starred, Trash
- File list table with Name, Owner, Modified, Size columns
- Grid and List view toggle
- Breadcrumb navigation
- Context menus (right-click)
- Share dialog
- Comments panel
- Version history modal
- Details panel
- Storage analytics
POST /api/auth/register- {email, password, name}POST /api/auth/login- {email, password}POST /api/auth/logoutGET /api/auth/me
GET /api/files- List files (query: ?folder_id=uuid)POST /api/files/upload- Upload (multipart/form-data)GET /api/files/recent- Recent filesGET /api/files/starred- Starred filesGET /api/files/trash- Trashed filesGET /api/files/search?q=query- Search filesGET /api/files/{id}/download- Download fileGET /api/files/{id}/thumbnail- Get thumbnailPUT /api/files/{id}/rename- Rename filePUT /api/files/{id}/move- Move to folderDELETE /api/files/{id}- Move to trashPOST /api/files/{id}/restore- Restore from trashDELETE /api/files/{id}/permanent- Permanent deletePOST /api/files/{id}/star- Toggle star
GET /api/folders- List folders (query: ?parent_id=uuid)POST /api/folders- Create folder {name, parent_folder_id}GET /api/folders/root- Get root folderGET /api/folders/starred- Starred foldersGET /api/folders/trash- Trashed foldersGET /api/folders/{id}- Get folder detailsPUT /api/folders/{id}/rename- Rename folderPUT /api/folders/{id}/move- Move folderPOST /api/folders/{id}/star- Toggle starDELETE /api/folders/{id}- Move to trashPOST /api/folders/{id}/restore- RestoreDELETE /api/folders/{id}/permanent- Permanent delete
POST /api/sharing/share- Share with userGET /api/sharing/permissions- Get permissionsPOST /api/sharing/revoke- Revoke permissionPOST /api/sharing/link- Create share linkGET /api/sharing/links- Get share linksDELETE /api/sharing/link/{id}- Deactivate linkGET /api/sharing/shared-with-me- Items shared with me
GET /api/versions/file/{fileId}- File versionsGET /api/activity- User activityGET /api/activity/file- File activityPOST /api/comments- Create commentGET /api/comments- Get file commentsPUT /api/comments/{id}- Update commentDELETE /api/comments/{id}- Delete commentGET /api/storage/analytics- Storage analytics
Backend:
- Go 1.21+
- Chi (router)
- PostgreSQL 18
- sqlc (type-safe SQL)
- Goose (migrations)
- bcrypt (password hashing)
Frontend:
- React 18
- Vite
- React Router
- Axios
- react-dropzone
- lucide-react (icons)
- Register new user
- Upload files (drag & drop)
- Download files
- Star files β show starred view
- Delete β show trash β restore
- Search files
# Backend
go run cmd/server/main.go # Start server (port 1030)
make migrate-up # Run database migrations
make sqlc # Regenerate Go code from SQL
# Frontend
cd frontend
npm run dev # Start dev server (port 5173)
npm run build # Build for production
# Database
psql -U postgres gdrive # Connect to database
make migrate-status # Check migration statusThis project includes comprehensive documentation:
- README.md - This file, overview and quick start
- QUICKSTART.md - Get running in 5 minutes
- SETUP_GUIDE.md - Detailed setup, API docs, deployment
- ARCHITECTURE.md - System architecture, database schema, design decisions
QUICKSTART.md includes:
- Step-by-step setup (5 minutes)
- Common issues and solutions
- Development tips
- Production deployment checklist
SETUP_GUIDE.md includes:
- Complete API endpoint documentation
- Database schema details
- Installation instructions
- Deployment guide
- Security considerations
ARCHITECTURE.md includes:
- System architecture diagrams
- Data flow explanations
- Database relationships
- Performance optimizations
- Scalability considerations
- Future enhancements roadmap
-
Registration & Login
- Register new user
- Demonstrate JWT authentication
-
File Operations
- Upload files (drag & drop showcase)
- Create folder hierarchy
- Navigate folders with breadcrumbs
- Download files
-
Organization
- Star important files
- Search functionality
- Grid vs List view
-
Collaboration
- Share file with another user
- Generate public share link
- Add comments to file
- View activity log
-
Management
- Delete files (trash)
- Restore from trash
- View storage analytics
- Check version history
- β JWT-based authentication
- β Bcrypt password hashing
- β CORS protection
- β SQL injection prevention (SQLC type-safe queries)
- β Path traversal prevention (UUID filenames)
- β Role-based access control
- β Session management
- β File type validation
- Connection pooling for database
- Prepared statements
- Optimized database indexes
- Efficient queries with SQLC
- Lazy loading for thumbnails
- Streaming file downloads
- β 100% feature-complete Google Drive clone
- β Clean, production-ready code
- β Comprehensive documentation
- β Modern tech stack (Go + React + PostgreSQL)
- β Advanced features (sharing, comments, versions)
- β Perfect UI replication of Google Drive
- β Ready for demo and deployment