Skip to main content
This guide walks you through building ContextFort from source, setting up your development environment, and loading the extension locally.

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js (v18 or higher)
  • npm (comes with Node.js)
  • Git
  • Chrome browser (for testing the extension)

Clone the Repository

1

Clone from GitHub

Clone the ContextFort repository to your local machine:
2

Verify the structure

The repository contains two main components:
  • chrome-extension/ - Browser extension code
  • contextfort-dashboard/ - Next.js dashboard interface

Building the Project

The easiest way to build the entire project is using the automated build script:
The build-all.sh script automatically:
  1. Builds the Next.js dashboard
  2. Extracts inline scripts for CSP compliance
  3. Copies dashboard assets to the extension
  4. Installs extension dependencies
  5. Builds the Chrome extension with Webpack
The built extension will be available in chrome-extension/dist/

Option 2: Build Components Separately

If you need to build components individually:
If you build components separately, you must manually copy the dashboard build output to chrome-extension/dashboard/ before building the extension.

Development Setup

Dashboard Development

For local dashboard development with hot reload:
1

Navigate to dashboard directory

2

Install dependencies

3

Set up environment variables

Copy the example environment file and configure:
Edit .env with your local settings:
4

Start development server

The dashboard will be available at http://localhost:3000

Extension Development

For Chrome extension development:
1

Navigate to extension directory

2

Install dependencies

3

Configure environment (optional)

Create a .env file for PostHog analytics and API settings:
4

Run in watch mode

This watches for file changes and automatically rebuilds.

Loading the Extension in Chrome

Once you’ve built the extension, load it into Chrome for testing:
1

Open Chrome Extensions

Navigate to chrome://extensions/ in your Chrome browser
2

Enable Developer Mode

Toggle the Developer mode switch in the top-right corner
3

Load the extension

Click Load unpacked and select the chrome-extension/dist/ directory
4

Verify installation

The ContextFort icon should appear in your Chrome toolbar. Click it to access the dashboard.
If you’re running in watch mode (npm run watch), the extension will automatically rebuild when you make changes. You’ll need to click the refresh icon on the extension card in chrome://extensions/ to reload it.

Project Structure

Build Scripts Explained

Dashboard Scripts

  • npm run dev - Start development server with hot reload
  • npm run build - Create production build with Next.js
  • npm run lint - Run Biome linter
  • npm run format - Format code with Biome
  • npm run check - Run linting and formatting checks
  • npm run check:fix - Auto-fix linting and formatting issues

Extension Scripts

  • npm run build - Build extension with Webpack (production mode)
  • npm run watch - Watch mode for development with auto-rebuild

Troubleshooting

Build Failures

If the build script fails, check:
  • Node.js version (must be v18+)
  • All dependencies are installed (npm install)
  • No other processes are using port 3000 (for dashboard dev)

Extension Not Loading

If the extension doesn’t load in Chrome:
  1. Verify the build completed successfully
  2. Check that chrome-extension/dist/ contains all required files
  3. Look for errors in chrome://extensions/ (enable Developer mode)
  4. Check the Chrome DevTools console for runtime errors

Dashboard Build Issues

If the dashboard fails to build:

Missing Dependencies

If you encounter module not found errors:

Next Steps

Contributing

Learn how to contribute to ContextFort

Architecture

Understand the system architecture