Skip to content

How to Work on Documentation

Follow these guidelines for setting up a development environment for the freeCodeCamp documentation site. This is highly recommended if you want to contribute regularly to our contributing guidelines.

You will need to fork the contribute repository on GitHub to get your own copy of the codebase. This will allow you to follow a Git-based workflow to contribute to freeCodeCamp’s documentation.

Follow these steps to fork the repository:

  1. Click the button below to fork the contribute repository on GitHub.

    Fork “freeCodeCamp/contribute”

  2. On the create new fork page, check the details and click the Create fork button.

  3. You should automatically be redirected to your fork, the URL should be something like https://github.com/YOUR_USER_NAME/contribute.

That’s it! You have successfully forked the contribute repository.

Next, you need to choose between setting up a cloud IDE or your own machine.

If you’re looking to make a one-time contribution or want the fastest setup, use GitHub Codespaces which provides a ready-to-code environment in your web browser using devcontainers. For long-term contributions where you prefer local development, you can set up the documentation site on your local machine.

FeatureGitHub Codespaces RecommendedYour own machine
Hardware requirementsNo minimum hardware requirementsMinimum hardware requirements (Node.js, pnpm)
Software installationNo need to install any softwareAdditional software needed
Repository statusAlways up-to-date repositoryManual updates required
Setup complexityEasy setup with devcontainers, works in any browserLarger download and setup time
Internet dependencyRequires an internet connection to workMinimal internet connection required once set up
PerformanceConsistent cloud-based performanceDepends on your machine capabilities
Usage limits60 hours free per month for personal accountsNo usage limits
Environment consistencyIdentical setup for all contributors via devcontainersMay vary between different machines and OS

Once you have decided, follow the relevant tab below to continue with the setup.

We have automated the development environment setup using devcontainers. With GitHub Codespaces, you get a consistent, ready-to-code environment that runs in your browser with all dependencies pre-installed.

Launch a Codespace from your fork:

  1. Go to your fork at https://github.com/YOUR_USER_NAME/contribute

  2. Click the green Code button

  3. Select the Codespaces tab

  4. Click Create codespace on main

    Your codespace will automatically set up the development environment using our devcontainer configuration. This includes:

    • Installing Node.js, pnpm, and all dependencies
    • Configuring VS Code extensions
    • Preparing the environment
  5. Wait for the setup to complete (usually 1-2 minutes)

Start the development server:

Once your Codespace is ready, the development server should start automatically. If not, you can start it manually:

Terminal window
pnpm develop

Once ready, you will see a notification to open the site. Click on the notification to open the client application in a new browser tab.

Before making any changes, it’s important to create a new branch for your work. This keeps your changes organized and separate from the main codebase.

  1. Create and switch to a new branch, replacing feature/your-feature-name with a descriptive name for your changes:

    Terminal window
    git checkout -b feature/your-feature-name
  2. Ensure you are on your new branch:

    Terminal window
    git branch

    You should see your new branch name with an asterisk (*) next to it, indicating it’s the active branch.

You can edit or add files in the src/content/docs directory available here. When your changes are merged, they will be made available automatically at the documentation site.

If you want to create a link targeting a different section of the contributing guidelines, follow this format:

[Link text](/target-file-name#target-section-heading-id)
// If the target section is within the same page, you can omit the file name
[Link text](#target-section-heading-id)

This is necessary to make these links work for the translated version of the document. Otherwise, they will redirect to the English version of the page regardless of the language.

The site is generated using Astro and served using Cloudflare Workers. Here’s how it works:

Key Architecture

  • All documentation content is stored in src/content/docs/ as MDX files
  • The sidebar navigation is configured in src/sidebar.ts
  • Site configuration is managed in astro.config.ts
  • The site is automatically built and deployed via Cloudflare Workers

The site is deployed on Cloudflare Workers. Please check the wrangler config for deployment details.

Handy Scripts for Local Development

CommandDescription
pnpm installInstall all dependencies
pnpm developStart the Astro development server (localhost:4321)
pnpm buildBuild the site for production
pnpm previewBuild and preview locally using Cloudflare Workers
pnpm testRun all tests
pnpm test:updateUpdate test snapshots
pnpm lintCheck formatting and linting
pnpm formatAuto-fix formatting and linting issues
pnpm check:astroRun Astro type checking
pnpm check:linksValidate internal and external links
npx vitest run tests/filename.test.tsRun a specific test file

After you’ve committed your changes, check here for how to open a Pull Request.