System Requirements
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.
Fork the contribute repository on GitHub
Section titled “Fork the contribute repository on GitHub”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:
-
Click the button below to fork the contribute repository on GitHub.
Fork “freeCodeCamp/contribute”
-
On the create new fork page, check the details and click the Create fork button.
-
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.
Cloud IDE or your own machine?
Section titled “Cloud IDE or your own machine?”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.
| Feature | GitHub Codespaces Recommended | Your own machine |
|---|---|---|
| Hardware requirements | No minimum hardware requirements | Minimum hardware requirements (Node.js, pnpm) |
| Software installation | No need to install any software | Additional software needed |
| Repository status | Always up-to-date repository | Manual updates required |
| Setup complexity | Easy setup with devcontainers, works in any browser | Larger download and setup time |
| Internet dependency | Requires an internet connection to work | Minimal internet connection required once set up |
| Performance | Consistent cloud-based performance | Depends on your machine capabilities |
| Usage limits | 60 hours free per month for personal accounts | No usage limits |
| Environment consistency | Identical setup for all contributors via devcontainers | May vary between different machines and OS |
Once you have decided, follow the relevant tab below to continue with the setup.
GitHub Codespaces
Section titled “GitHub Codespaces”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:
-
Go to your fork at
https://github.com/YOUR_USER_NAME/contribute -
Click the green Code button
-
Select the Codespaces tab
-
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
-
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:
pnpm developOnce ready, you will see a notification to open the site. Click on the notification to open the client application in a new browser tab.
Prerequisites
Section titled “Prerequisites”Run the following commands to validate the versions:
node -vpnpm -vOnce you have the prerequisites installed, you need to prepare your development environment. This is common for many development workflows, and you will only need to do this once.
Additional Prerequisites
Section titled “Additional Prerequisites”-
Install Git or your favorite Git client, if you haven’t already. Update to the latest version; the version that came bundled with your OS may be outdated.
-
(Optional but recommended) Set up an SSH Key for GitHub.
-
Install a code editor of your choice. If you aren’t sure which one to use, we recommend Visual Studio Code — it’s free and open source.
-
Set up linting for your code editor.
You should have ESLint running in your editor, and it will highlight anything that doesn’t conform to freeCodeCamp’s JavaScript Style Guide.
Clone your Fork from GitHub
Section titled “Clone your Fork from GitHub”Next, you will need to clone your fork to your local machine.
Run these commands on your local machine:
-
Open a terminal in your projects directory, for example:
/home/username/projects/ -
Clone your fork of the contribute repository, replacing
YOUR_USER_NAMEwith your GitHub UsernameTerminal window git clone --depth=1 https://github.com/YOUR_USER_NAME/contribute.gitThis will download the entire contribute repository to your projects directory.
Set up Syncing from Parent
Section titled “Set up Syncing from Parent”Now that you have downloaded a copy of your fork, you will need to set up an upstream remote to the parent repository.
As mentioned earlier, the main repository is referred to as the upstream repository. Your fork is referred to as the origin repository.
You need a reference from your local clone to the upstream repository in addition to the origin repository. This is so that you can sync changes from the main repository without the requirement of forking and cloning repeatedly.
-
Change the directory to the new contribute directory:
Terminal window cd contribute -
Add a remote reference to the main contribute repository:
Terminal window git remote add upstream https://github.com/freeCodeCamp/contribute.git -
Ensure the configuration looks correct:
Terminal window git remote -vThe output should look something like below (replacing
YOUR_USER_NAMEwith your GitHub username):origin https://github.com/YOUR_USER_NAME/contribute.git (fetch)origin https://github.com/YOUR_USER_NAME/contribute.git (push)upstream https://github.com/freeCodeCamp/contribute.git (fetch)upstream https://github.com/freeCodeCamp/contribute.git (push)
Install Dependencies
Section titled “Install Dependencies”First, ensure you have pnpm installed globally:
npm install -g pnpmThen install the project dependencies:
pnpm installThis will install all required dependencies and set up Git hooks automatically.
Start the Development Server
Section titled “Start the Development Server”You can now start up the development server:
pnpm developOnce ready, open a web browser and visit http://localhost:4321:
http://localhost:4321
Create a Working Branch
Section titled “Create a Working Branch”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.
-
Create and switch to a new branch, replacing
feature/your-feature-namewith a descriptive name for your changes:Terminal window git checkout -b feature/your-feature-name -
Ensure you are on your new branch:
Terminal window git branchYou should see your new branch name with an asterisk (*) next to it, indicating it’s the active branch.
Working on Documentation Content
Section titled “Working on Documentation Content”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.
Creating Internal Links
Section titled “Creating Internal Links”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.
Structure of the Docs Website
Section titled “Structure of the Docs Website”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
Deployment
Section titled “Deployment”The site is deployed on Cloudflare Workers. Please check the wrangler config for deployment details.
Quick Commands Reference
Section titled “Quick Commands Reference”Handy Scripts for Local Development
| Command | Description |
|---|---|
pnpm install | Install all dependencies |
pnpm develop | Start the Astro development server (localhost:4321) |
pnpm build | Build the site for production |
pnpm preview | Build and preview locally using Cloudflare Workers |
pnpm test | Run all tests |
pnpm test:update | Update test snapshots |
pnpm lint | Check formatting and linting |
pnpm format | Auto-fix formatting and linting issues |
pnpm check:astro | Run Astro type checking |
pnpm check:links | Validate internal and external links |
npx vitest run tests/filename.test.ts | Run a specific test file |
Proposing a Pull Request (PR)
Section titled “Proposing a Pull Request (PR)”After you’ve committed your changes, check here for how to open a Pull Request.