Developer Setup
Relevant source files
The following files were used as context for generating this wiki page:This document provides a comprehensive guide for setting up the development environment for the Read Frog browser extension. It covers the project's tech stack, installation, available commands, build system, and configuration. The project is a modern browser extension built with WXT, React, and TypeScript, utilizing Nx for task running and caching.
The setup is designed to be straightforward, with a focus on developer productivity through fast builds, automated testing, and linting. Following this guide will ensure a consistent and efficient development workflow.
1. Prerequisites & Installation
Before starting, ensure you have Node.js and pnpm installed. The project specifies the required Node.js runtime version.
- Node.js:
^24.9.1 - Package Manager:
pnpm@10.16.1
Sources: package.json:148-154, package.json:6
To install project dependencies, run the following command in the root directory:
pnpm install
This command installs all necessary dependencies and runs the wxt prepare command to set up the WXT development environment.
Sources: package.json:12
2. Tech Stack & Architecture
The project is built on a modern tech stack designed for browser extension development.
| Category | Technology | Description |
|---|---|---|
| Framework | WXT | A modern browser extension framework with Manifest V3 support. |
| UI | React 19, TailwindCSS 4, Radix UI, shadcn/ui | For building the user interface components. |
| Language | TypeScript | Provides static typing for the entire codebase. |
| State | Jotai | A primitive and flexible state management library for React. |
| Database | Dexie (IndexedDB wrapper) | For local data persistence in the browser. |
| Build Tool | Vite (via WXT) | A fast, Vite-based bundler for development and production builds. |
| Testing | Vitest, Istanbul | For unit testing and code coverage analysis. |
| Internationalization | @wxt-dev/i18n | Manages translations using YML files located in src/locales/. |
Sources: CLAUDE.md:88-96, package.json:10-145
Extension Architecture
The extension's structure is organized around WXT's entrypoints pattern, which separates different parts of the extension into distinct modules.
This diagram illustrates the main entrypoints of the extension and their roles.
Sources: CLAUDE.md:100-113
3. Development Workflow
The project provides a set of pnpm scripts to streamline common development tasks like running the dev server, testing, and linting.
Core Development Commands
The primary command to start the development server is pnpm dev.
This sequence shows how the pnpm dev command initiates the development environment.
Sources: CLAUDE.md:98-103, wxt.config.ts:47-51
The following table summarizes the main scripts available in package.json.
| Command | Description |
|---|---|
pnpm dev | Starts development mode for Chrome. |
pnpm dev:edge | Starts development mode for Edge. |
pnpm dev:firefox | Starts development mode for Firefox. |
pnpm dev:local | Starts development with local monorepo packages. |
pnpm build | Creates a production build of the extension. |
pnpm test | Runs all tests once. |
pnpm test:watch | Runs tests in watch mode. |
pnpm test:cov | Runs tests and generates a coverage report. |
pnpm lint | Lints the codebase for style and errors. |
pnpm lint:fix | Lints and automatically fixes issues. |
pnpm type-check | Performs a static type check using TypeScript. |
pnpm zip | Creates a zip file of the production build for distribution. |
Sources: package.json:7-22, CLAUDE.md:98-113
Local Package Development
The project supports development against local versions of its monorepo packages. By setting the WXT_USE_LOCAL_PACKAGES environment variable to true, Vite's aliasing is configured to point to local source directories instead of installed node_modules packages.
// File: wxt.config.ts:11-16
alias: process.env.WXT_USE_LOCAL_PACKAGES === 'true'
? {
'@read-frog/definitions': path.resolve(__dirname, '../read-frog-monorepo/packages/definitions/src'),
'@read-frog/api-contract': path.resolve(__dirname, '../read-frog-monorepo/packages/api-contract/src'),
}
: {},
This is triggered by running the pnpm dev:local script.
Sources: wxt.config.ts:11-16, package.json:10
4. Build System & Caching with Nx
The repository uses Nx as a smart task runner to manage and cache build, test, and lint operations. This significantly speeds up repeated tasks by restoring outputs from a cache when inputs have not changed.
Nx Target Defaults
Configuration in nx.json defines the default behavior for various targets (tasks).
This diagram shows how Nx decides whether to run a task or restore it from cache based on its defined inputs and outputs.
Sources: nx.json
The targetDefaults in nx.json specify which files and directories are considered inputs and what outputs are generated for each task.
| Target | Cachable | Key Inputs | Outputs |
|---|---|---|---|
build | true | {projectRoot}/src/**/*, {projectRoot}/wxt.config.ts, {projectRoot}/package.json | {projectRoot}/.output, {projectRoot}/.wxt |
test | true | {projectRoot}/src/**/*, {projectRoot}/vitest.*.ts | (none) |
test:cov | true | {projectRoot}/src/**/*, {projectRoot}/vitest.*.ts | {projectRoot}/coverage |
lint | true | {projectRoot}/src/**/*, {projectRoot}/eslint.config.* | (none) |
type-check | true | {projectRoot}/src/**/*, {projectRoot}/tsconfig.json | (none) |
Sources: nx.json:3-56
The scripts in package.json do not directly invoke nx, but Nx is configured to wrap these commands, as seen in the nx.targets section of package.json.
// File: package.json:157-199
"nx": {
"targets": {
"build": {
"executor": "nx:run-commands",
"options": {
"command": "wxt build"
}
},
"test": {
"executor": "nx:run-commands",
"options": {
"command": "vitest run"
}
},
"lint": {
"executor": "nx:run-commands",
"options": {
"command": "eslint"
}
},
"type-check": {
"executor": "nx:run-commands",
"options": {
"command": "tsc --noEmit"
}
}
}
}
This configuration maps npm scripts to Nx targets, enabling caching and other Nx features.
Sources: package.json:156-201
5. Contribution
The project follows standard contribution guidelines, including commit message conventions and a pull request process.
Commit Conventions
Commits must follow the Conventional Commits specification. This is enforced by commitlint and husky pre-commit hooks.
- Standard types:
feat,fix,docs,style,refactor,perf,test,build,ci,chore,revert - Custom types:
i18n,ai
Sources: CLAUDE.md:143-154, package.json:23
Summary
The developer setup for Read Frog is built around a modern and efficient toolchain. By leveraging WXT for the extension framework, Vite for fast builds, and Nx for intelligent task caching, developers can quickly get started and maintain a high-velocity workflow. The clear project structure, comprehensive scripts, and enforced conventions ensure code quality and consistency across the team.