A preview service for freeCodeCamp.org news for posts on Hashnode (headless) CMS.
This uses Hashnode's GraphQL API and Nunjucks to render an approximate preview
of a post as it will appear when published live on /news.
Copy .env.sample to .env and fill in the values:
| Variable | Description |
|---|---|
PORT |
Port the server listens on (defaults to 3000). |
HASHNODE_HOST |
The publication host from the Hashnode dashboard (e.g. fcc.hashnode.dev). |
HASHNODE_TOKEN |
A Hashnode personal access token. Required to preview drafts — Hashnode's draft query is authenticated and returns UNAUTHENTICATED without it. Published posts work without a token. |
Note
A personal access token is tied to the account that created it and can expire
or be revoked. If draft previews start failing with an UNAUTHENTICATED
error, regenerate the token and update HASHNODE_TOKEN.
For the production app, the token is kept in the team password manager and set as an encrypted environment variable in the DigitalOcean App Platform settings. Update it in both places when rotating.
Warning
Please note that changes to the nunjucks templates will not be reflected in the watch mode.
pnpm install
pnpm run start-
The app is deployed on DigitalOcean App Platform, and all changes merged to the
mainbranch are deployed using thedeploy.ymlworkflow. -
Alternatively, you can run the app using the included
docker-compose.ymlfile.docker compose build docker compose up -d