A Node.js-based Pide-piper API with features like file upload, folder management, and user authentication.
- User Authentication (Email/Password & Google Sign-in)
- Email verification with OTP
- File upload and management
- Folder creation and organization
- Storage management (15GB per user)
- File favorites system
- Recent files tracking
- File type categorization
- Node.js (v20.11 or higher)
- MongoDB
- Docker and Docker Compose (for containerized deployment)
- SMTP server credentials (for email functionality)
- Google OAuth credentials (for Google Sign-in)
Create a .env
file in the root directory with the following variables:
PORT=3000
MONGO_URI=mongodb://localhost:27017/google-drive-clone
JWT_SECRET=your_jwt_secret_key
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_email_app_password
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
- Clone the repository:
git clone <repository-url>
cd google-drive-clone
- Install dependencies:
npm install
- Create uploads directory:
mkdir -p src/uploads
- Start the application:
# Development mode
npm run dev
# Production mode
npm start
- Build and start the containers:
docker-compose up -d
- Stop the containers:
docker-compose down
- View logs:
docker-compose logs -f app
- POST
/api/auth/register
- Register new user - POST
/api/auth/verify-email
- Verify email with OTP - POST
/api/auth/login
- Login with email/password - POST
/api/auth/google-signin
- Login with Google - POST
/api/auth/forgot-password
- Request password reset - POST
/api/auth/reset-password
- Reset password with OTP
- POST
/api/files/folder
- Create new folder - POST
/api/files/upload
- Upload file - GET
/api/files/list
- Get files list - GET
/api/files/recent
- Get recent files - GET
/api/files/favorites
- Get favorite files - PUT
/api/files/:id/favorite
- Toggle file favorite - PUT
/api/files/:id/rename
- Rename file - DELETE
/api/files/:id
- Delete file - GET
/api/files/storage-info
- Get storage information
Use the following curl commands or Postman to test the API:
- Register a new user:
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"name": "Test User",
"email": "test@example.com",
"password": "password123"
}'
- Login:
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "test@example.com",
"password": "password123"
}'
- Create a folder:
curl -X POST http://localhost:3000/api/files/folder \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "My Folder"
}'
- Upload a file:
curl -X POST http://localhost:3000/api/files/upload \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@/path/to/your/file.pdf" \
-F "parentId=FOLDER_ID"
The API uses standard HTTP status codes:
- 200: Success
- 201: Created
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error