Get Started with React + Fit.js Extensions
The Node + React.js + Fit.js template builds an extension with a React frontend, an Express-based Node.js backend, and Fit.js — the standard library for conventions shared across Fynd Node.js applications. Unlike the SQLite-backed templates, this one stores data in MongoDB and Redis, so both must be running before you preview the extension.
This page covers:
- Install and start MongoDB and Redis
- Generate the extension
- Configure the environment
- Preview the extension
Prerequisites
- Git↗ and Node.js v18↗ or later
- FDK CLI
- Account in Fynd Partners↗ and a Development Company
- MongoDB and Redis running locally — see step 1
- Azure DevOps read access to both projects below, plus an SSH key registered with Azure DevOps
| Repository | Azure DevOps project | Why it is needed |
|---|---|---|
fit.js | CommonLibraries | The Fit.js library |
fdk-extension-javascript | JCPLibraries | Extension helper library |
fdk-client-javascript | JCPLibraries | Platform API client |
fit.js lives in the CommonLibraries project, not JCPLibraries. Read access to JCPLibraries alone is not enough — npm install fails on the fit dependency without access to CommonLibraries as well.
1. Install and start MongoDB and Redis
The template will not boot without both services. Installing them is not enough — they must also be started, and most package managers do not start them for you.
Pick the tab for your setup:
- Docker (any OS)
- macOS (Homebrew)
- Linux (systemd)
- Windows
Works identically on macOS, Linux, and Windows, and keeps the two containers isolated from any other MongoDB or Redis you have installed.
docker run -d --name fynd-mongo -p 27017:27017 mongo:7
docker run -d --name fynd-redis -p 6379:6379 redis:7
Both containers restart with docker start fynd-mongo fynd-redis after a reboot.
brew tap mongodb/brew
brew install mongodb-community redis
brew services start mongodb-community
brew services start redis
brew install does not start a service. Confirm both report started:
brew services list
Install Redis from your distribution's repository, and MongoDB from the official MongoDB apt/yum repository↗ — recent Ubuntu and Debian releases no longer ship a mongodb package.
sudo systemctl enable --now mongod
sudo systemctl enable --now redis-server
Use the Docker tab, or run the Linux (systemd) steps inside WSL2↗. Services started inside WSL2 are reachable on localhost from Windows.
Verify both are running
nc -z localhost 27017 && echo "mongo up" || echo "mongo DOWN"
nc -z localhost 6379 && echo "redis up" || echo "redis DOWN"
You should see mongo up and redis up. Anything else — including no output at all — means that service is not listening; go back and start it before continuing.
If nc is not installed, the database clients give an equivalent check:
redis-cli ping # → PONG
mongosh --quiet --eval 'db.runCommand({ ping: 1 })' # → { ok: 1 }
The template's .env.example expects MongoDB on localhost:27017 and Redis on localhost:6379. If yours run elsewhere, adjust the connection strings in step 3.
2. Generate the extension
-
Log in to your Fynd Partner account:
fdk login --host <HOST_URL> -
Initialize the extension from the React + Fit.js template:
fdk extension init --template node-react-fit -
Enter a name for your extension and select the extension type.
The --template node-react-fit flag selects Node + React.js + Fit.js(Redis + Mongo) directly, skipping the interactive stack picker. Omit the flag to choose from the full template list.
The frontend is a Git submodule. If the frontend directory is empty after initialization, populate it manually:
git submodule update --init --recursive
3. Configure the environment
-
Copy the example environment file:
cp .env.example .env -
Set the database connection strings in
.env:MONGO_TEMP_EXAMPLE_READ_WRITE=mongodb://localhost:27017/temp-example
REDIS_TEMP_EXAMPLE_READ_WRITE=redis://localhost:6379
REDIS_TEMP_EXAMPLE_READ_ONLY=redis://localhost:6379
Leave EXTENSION_API_KEY, EXTENSION_API_SECRET, and EXTENSION_BASE_URL commented out. The FDK CLI sets these for you during fdk extension preview.
4. Preview the extension
-
Start the preview:
fdk extension preview -
Copy the preview URL from your terminal into the browser and click Accept and Continue.
fdk populate is optional. Run it if you want sample products, orders, and other test data in your development company — it is not required to preview the extension.
fdk populate
To run the server directly instead, use npm start (which runs nodemon index.js).
Template dependencies
The template pins each Fynd library to a specific tag:
| Dependency | Pinned version | Source |
|---|---|---|
fdk-extension-javascript | v1.4.0 | JCPLibraries |
fdk-client-javascript | v1.10.7-24 | JCPLibraries |
fit | v3.3.0 | CommonLibraries/fit.js |
Do not replace these Git dependencies with public npm packages. The @gofynd/* packages on the public npm registry are separate release lines and are not compatible with JCP.
Update the client and extension libraries
The tags above are whatever the template shipped with. They are not necessarily the right versions for the Fynd Commerce version your development company runs on, so check the compatibility matrix before you start building.
1. Look up the compatible versions
Compatible SDKs lists every FDK Extension Library release alongside the Fynd Commerce version and the fdk-client-javascript version it is built against. Open the FDK Extension Libraries section and read the row for JavaScript.
Log in to Azure DevOps first — the version links on that page point into JCPLibraries and will not resolve otherwise.
2. Pin the versions
Install both libraries at the tags you found, replacing the versions below:
npm install "git+ssh://git@ssh.dev.azure.com:v3/GoFynd/JCPLibraries/fdk-extension-javascript#v1.4.0" --save
npm install "git+ssh://git@ssh.dev.azure.com:v3/GoFynd/JCPLibraries/fdk-client-javascript#v1.10.7-24" --save
To list what tags actually exist on either repository:
git ls-remote --tags git@ssh.dev.azure.com:v3/GoFynd/JCPLibraries/fdk-extension-javascript
Always pin a tag. Installing without #vX.Y.Z resolves to the repository's default branch, which trails the release tags.
3. Verify
npm ls @gofynd/fdk-extension-javascript fdk-client-javascript
The reported versions should match the pair from the compatibility matrix. For more on installing this library on its own — including the express requirement and the package rename at v1.3.0 — see Install FDK Extension Library for JavaScript.
Keep the two versions in step. A fdk-client-javascript that is newer or older than the extension library expects fails at call time — typically as a missing method on a platform client, or a 4xx from an API path that no longer exists on your Fynd Commerce version.
Run with Docker
docker build -t extension .
docker run -p 8080:8080 extension
Docker reads configuration from .env, so complete step 3 first. When running in a container, localhost in the Mongo and Redis URLs refers to the container itself — point them at your host or a linked service instead.
Troubleshooting
| Symptom | Cause |
|---|---|
npm install fails on the fit dependency | No read access to the CommonLibraries project, which is separate from JCPLibraries. |
The frontend directory is empty | The Git submodule was not initialized. Run git submodule update --init --recursive. |
| Submodule clone prompts for credentials | The submodule uses an SSH URL. Register an SSH key with Azure DevOps. |
nc -z localhost 6379 prints nothing, or prints redis DOWN | Redis is installed but was never started. brew install and apt install do not start a service. Run brew services list (macOS) or systemctl status redis-server (Linux) — if it shows none, stopped, or inactive, start it as shown in step 1. |
nc: command not found | netcat is not installed. Use the redis-cli ping and mongosh checks in step 1 instead. |
| Connection refused on startup | MongoDB or Redis is not running, or the URLs in .env point to the wrong host or port. |
EXTENSION_API_KEY is undefined | The extension was started directly rather than through fdk extension preview, which injects these values. |
A platform client method is missing, or an API call returns 4xx unexpectedly | fdk-extension-javascript and fdk-client-javascript are pinned to versions that do not match each other or your Fynd Commerce version. Check Compatible SDKs and re-pin both, as shown in Update the client and extension libraries. |