This project integrates Google Drive with our system, allowing us to read the contents of shared folders, obtain object IDs and parent folder IDs, and store this information in our PostgreSQL database. It also captures user permissions on each object and stores this in a permission_history
table. Webhooks are configured to notify us of any changes, with an endpoint to receive these notifications.
- Node.js
- Prisma
- TypeScript
- NestJS
- PostgreSQL
- Read contents of shared folders in Google Drive
- Store object IDs and parent folder IDs in PostgreSQL
- Capture and store user permissions in the
permission_history
table - Configure webhooks for real-time notifications
- Endpoint to receive webhook requests
- Node.js v14.x or higher
- PostgreSQL database
- Google Cloud Platform project with Drive API enabled
- Service Account with appropriate permissions
git clone https://github.com/ArfatAli99/google-drive-integration.git
cd google-drive-integration
npm install
Create a .env
file in the root directory with the following variables:
DATABASE_URL="postgresql database url"
GOOGLE_CLIENT_EMAIL=""
GOOGLE_PRIVATE_KEY=""
GOOGLE_PROJECT_ID=""
WEBHOOK_ENDPOINT="/webhook-endpoint"
Run the following commands to generate Prisma client and migrate the database:
npx prisma generate
npx prisma migrate dev --name init
npm run start:dev
- Use the Google Drive API to list contents of shared folders.
- Extract object IDs and parent folder IDs.
- Store the extracted data in the PostgreSQL database.
- For each object, retrieve the list of users and their permissions.
- Store this information in the
permission_history
table.
- Set up webhooks in Google Drive to notify of any changes.
- Implement an endpoint to receive and process these webhook notifications.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
For any inquiries or support regarding this project, feel free to reach out:
- Email: [email protected]