Dynamically generates an image of a hitcounter that display page views for a particular webpage. Built with NextJs and UpStash Redis.
git clone https://github.com/dasveloper/Hitcount.app.git hitcount-app
Copy the .env.local.example
file in this directory to .env.local
(which will be ignored by Git):
cp .env.local.example .env.local
Go to the Upstash Console and create a new database
UPSTASH_REDIS_REST_URL
: Find the URL in the database details page in the REST API section.UPSTASH_REDIS_REST_TOKEN
: Find the URL in the database details page in the REST API section.
⚠️ Because of an issue with Node canvas on Vercel you must add this environment variable only on Vercel, not locally
LD_LIBRARY_PATH
: /var/task/node_modules/canvas/build/Release:$LD_LIBRARY_PATH
This is also why we need the custom
vercel-build
step in package.json. See: https://github.com/jeetiss/vercel-canvas
Start your local dev server
yarn dev