How josueluna/linkedin_to_sheets works
1. Overall shape
- This is a Chrome Extension (Manifest V3) built with React + Vite.
- The product flow is “read data from a LinkedIn profile page, then write it into Google Sheets.”
- The architecture is split into three main runtimes: the LinkedIn page content script, the extension popup UI, and the background script that coordinates privileged browser/API work.
2. User-facing entry point: popup UI
- src/App.tsx, src/main.tsx, and src/components/ExtensionPopup.tsx make up the popup experience the user opens from the extension icon.
- SpreadsheetSelector.tsx suggests the popup lets the user choose a target Google Spreadsheet and tab before saving.
- This UI is the control plane for the workflow, not the data source itself.
3. Page-level data extraction
- src/content.ts is the content script injected into LinkedIn pages.
- Its job is to inspect the current LinkedIn profile DOM and extract structured profile fields such as name, company, title, location, and profile URL.
- This creates the boundary between the public webpage environment and the extension’s trusted logic.
4. Background orchestration
- src/background.ts is the central service worker for extension-side coordination.
- It likely receives messages from the popup and content script, handles auth state, and performs actions that require extension privileges.
- This is the main integration point between UI, extracted profile data, and Google APIs.
5. Google integration boundary
- src/lib/google.ts encapsulates Google OAuth and API interaction.
- Based on the README, it likely covers both Google Sheets API writes and Google Drive API listing/discovery of spreadsheets.
- This module is the external-service boundary for all Google-related behavior.
6. Persistence and local state
- src/lib/storage.ts is the local persistence layer, likely backed by extension storage.
- It probably stores things like the selected spreadsheet/tab, auth tokens or session markers, and possibly deduplication metadata.
- The repo emphasizes “no data stored externally,” so persistence appears to be local to the browser extension.
7. Data flow: LinkedIn → Sheets
- The intended flow is: user opens a LinkedIn profile, the content script extracts profile data, the popup UI lets the user choose where to send it, and the background script + Google lib append the row to Sheets.
- The README’s “Paste Current Profile” action maps directly to this pipeline.
- The data shape is intentionally small and structured, which keeps the write path simple.
8. Spreadsheet and tab selection
- The presence of SpreadsheetSelector.tsx implies the extension supports selecting both a workbook and a specific worksheet tab.
- That selection is part of the user workflow before insertion, which means the extension is not hardcoded to a single destination.
- This is an important architectural boundary: destination selection happens in the UI, while actual listing/writing happens in the Google integration layer.
9. Duplicate avoidance
- The README explicitly says duplicate entries are avoided.
- That suggests the extension compares the current LinkedIn profile URL or another stable identifier against existing local or sheet state before writing.
- Architecturally, deduplication likely lives near the Sheets write path or in the local storage layer, not in the content script.
10. Build and runtime tooling
- vite.config.ts, tailwind.config.ts, postcss.config.js, and src/index.css indicate a Vite-based frontend build with Tailwind styling.
- public/manifest.json is the extension manifest that defines MV3 entry points and permissions.
- index.html is the popup/page shell used by Vite to bundle the React app for the extension UI.
11. Static pages and documentation surfaces
- privacy.html and wiki.html are separate static pages, likely for policy/documentation rather than runtime extension behavior.
- These are outside the main data path, but they matter for the repository’s deployment surface and compliance/documentation story.
12. Architecture summary for diagramming
- Draw three zones: LinkedIn page context, Extension UI/background, and Google services.
- Show the content script extracting profile data from LinkedIn, the popup collecting user destination choices, and the background script invoking Google OAuth/Sheets/Drive operations.
- Keep storage as a local supporting boundary, not a primary system of record.
Main entry points: background.ts Background worker · google.ts Google client · manifest.json Manifest · content.ts Content script
Components 17
LinkedIn page
The untrusted page context where profile data is read from the DOM.
- Content script · Injected into LinkedIn pages to extract profile fields from the DOM.
src/content.ts - Profile data · Structured LinkedIn profile details passed from the page context.
Extension runtime
Popup UI, background worker, and local state that coordinate the workflow.
- Popup app · Top-level popup shell shown when the extension icon is opened.
src/App.tsx - UI mount · Bootstraps the popup React app into the extension page.
src/main.tsx - Extension popup · User-facing control plane for choosing destinations and triggering saves.
src/components/ExtensionPopup.tsx - Spreadsheet selector · Lets the user choose a spreadsheet and worksheet tab.
src/components/SpreadsheetSelector.tsx - Background worker · Coordinates messages, privileged browser actions, and save orchestration.
src/background.ts - Local storage · Extension-local state for selections, session markers, and dedupe support.
src/lib/storage.ts - UI utils · Shared utility helpers used by the React UI components.
src/lib/utils.ts
Google services
External OAuth and API boundary for spreadsheets and drive discovery.
- Google client · Encapsulates Google OAuth plus Sheets and Drive API interactions.
src/lib/google.ts - Sheets write · Appends profile rows into the selected Google Sheet tab.
- Drive lookup · Lists or discovers available spreadsheets for selection.
- Google OAuth · Handles user authorization for Google APIs.
Build & docs
Bundle configuration, manifest, and standalone documentation pages.
- Manifest · Defines extension permissions, entry points, and runtime wiring.
public/manifest.json - Vite config · Build configuration for the extension UI bundle.
vite.config.ts - Tailwind styles · Styling pipeline for the popup and related UI.
tailwind.config.ts - Docs pages · Standalone privacy and wiki pages outside the main extension flow.
privacy.html
Connections 18
- UI mount → Extension popup: mounts · Bootstraps the popup experience into the UI shell.
- Popup app → Spreadsheet selector: uses · Renders destination selection inside the popup workflow.
- Extension popup → Background worker: sends actions · Requests auth, selection, and save operations.
- Content script → Profile data: extracts · Reads the LinkedIn profile DOM and builds structured data.
- Content script → Background worker: posts data · Hands extracted profile data to extension-side logic.
- Background worker → Local storage: reads/writes · Persists selections and local state needed for dedupe and resume.
- Background worker → Google client: delegates · Routes privileged Google operations through the API adapter.
- Google client → Google OAuth: authenticates · Obtains or refreshes Google authorization.
- Google client → Drive lookup: lists · Discovers spreadsheets available to the user.
- Google client → Sheets write: writes · Appends selected profile data into Sheets.
- Spreadsheet selector → Local storage: persists choice · Stores selected spreadsheet and tab locally.
- Background worker → Sheets write: dedupes before write · Uses local or remote state to avoid duplicate entries.
- Manifest → Content script: registers · Declares the content script entry point.
- Manifest → Background worker: registers · Declares the MV3 background service worker.
- Manifest → UI mount: registers · Wires the popup UI entry into the extension package.
- Vite config → Popup app: bundles · Builds the React popup application.
- Tailwind styles → Extension popup: styles · Provides the UI styling system for the popup.
- Docs pages → Manifest: separate surface · Documentation and policy pages live outside the runtime path.