This lets you push the code to GitHub, GitLab, or Bitbucket later – useful for continuous deployment platforms like Vercel.
Configure environment variables
Copy the .env.local.example file to .env.local in the project root:
cp .env.local.example .env.local
Then fill in the required keys:
# ElmapiCMS credentialsELMAPI_PROJECT_ID=YOUR_PROJECT_IDELMAPI_API_KEY=YOUR_READ_API_KEY# Optional – enable mutations (e.g. blog comments)ELMAPI_CREATE_KEY=YOUR_CREATE_KEYELMAPI_API_URL=https://elmapicms.com/api # your ElmapiCMS API URLELMAPI_IMAGE_HOST=elmapicms.com # your ElmapiCMS image domain
ℹ️ Don’t commit secrets to version control – .env.local is ignored by default.
Running locally
# Start the Next.js dev server$ npm run dev# Open http://localhost:3000 in your browser
Any changes to components or pages hot-reload instantly.
⚠️ Local SSL note: If you’re also running ElmapiCMS on https://localhost with a self-signed certificate, Node will block requests unless you disable strict TLS verification.
Add the environment variable only for local work:
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run dev
NODE_TLS_REJECT_UNAUTHORIZED=0 npm run build
NODE_TLS_REJECT_UNAUTHORIZED=0 npm start
Or edit your package.json to prepend the flag:
{ "scripts": { "dev": "NODE_TLS_REJECT_UNAUTHORIZED=0 next dev", "build": "NODE_TLS_REJECT_UNAUTHORIZED=0 next build", "start": "NODE_TLS_REJECT_UNAUTHORIZED=0 next start" }}
🚨 Do not use this flag in production deployments – it bypasses SSL validation entirely.
Creating a new project
Log in to ElmapiCMS and click Create Project.
In the wizard choose “Choose from a template”.
Select “Blog NextJS” from the template list and check the “Include demo content” option.
Click Create Project and the project is provisioned with all collections, relations, and sample data.
Grab the Project ID and API Key from Project → Settings → API and paste them into .env.local. See API Access for more information.
Start the dev server (npm run dev) – you should see the demo posts immediately. Edit/delete entries as you like.
Production build
Before deploying, make sure the project builds:
$ npm run build$ npm start # Starts the production server locally
Deploying to Vercel (recommended)
(Optional) Push the project to GitHub/GitLab/Bitbucket if you haven’t already: