---
name: setup-google-drive-node-monorepo
category: devops
description: Procedure to download a Google Drive ZIP containing a Node.js pnpm monorepo, extract it, configure environment variables, and run the application.
---

## When to Use
You have a ZIP archive hosted on Google Drive that contains a Node.js monorepo (using pnpm workspace). You need to download, extract, configure environment variables, and run the application.

## Steps

1. **Download the archive**
   - Use `browser_navigate` to open the Google Drive share link.
   - Wait for the download to start (may need to click "Download" button).
   - Save the file to a temporary location (e.g., `/tmp/drive_download/`).

2. **Extract the archive**
   - In the terminal, run:
     ```bash
     unzip /tmp/drive_download/<file-name>.zip -d /tmp/drive_download/
     ```
   - Verify extraction with `ls -la /tmp/drive_download/`.

3. **Inspect the workspace**
   - Read the root `package.json` to confirm it enforces pnpm usage.
   - Read `pnpm-workspace.yaml` to understand packages and catalog dependencies.
   - List workspace libraries (`lib/`) and artifacts (`artifacts/`).

4. **Attempt dependency installation**
   - Try installing with pnpm:
     ```bash
     pnpm install
     ```
   - If you encounter errors, consult the project's documentation for compatible Node.js versions or consider using pre‑built artifacts.

5. **Check for pre‑built output**
   - Look for a `dist/` directory in the main service (e.g., `artifacts/api-server/dist/`). If present, you may be able to run the application directly without reinstalling dependencies.

6. **Locate required environment variables**
   - Search the codebase for mentions of expected env vars:
     ```bash
     grep -r "process.env." . --include="*.ts" --include="*.js" | head -20
     ```
   - Commonly required vars are documented in `replit.md` or similar files (look for a line like `- Required env: ...`).

7. **Create environment file**
   - In the project root, create a file (e.g., `.env`) with the needed key‑value pairs, following the project's conventions.

8. **Run the application**
   - If you have a `dist/` folder, start the compiled script:
     ```bash
     node artifacts/api-server/dist/index.mjs
     ```
   - If you installed dependencies and want to run in dev mode:
     ```bash
     pnpm run dev
     ```
   - Watch for error messages about missing configuration and provide them as needed.

9. **Verify the application is running**
   - Look for log output indicating the server is listening on a port or the bot has started polling.
   - If the process exits with an error, address the missing configuration and restart.

## Verification
- The app starts without throwing errors about missing required configuration.
- Logs show the application is ready to accept connections or process updates.

--- 
*End of skill.*