Running Decap CMS Locally
Decap CMS is a headless content management system that lets you edit your website content without touching code. This guide will show you how to run it on your computer.
What Is Decap CMS
Decap CMS (formerly Netlify CMS) is an open-source CMS that works with Git-based websites. It provides a visual admin panel where you can:
- Edit text content
- Upload images
- Create new cars or blog posts
- Manage navigation menus
- Update site settings
All changes are saved directly to your content files. No database required.
Why Two Terminals
You need two terminal windows running at the same time:
- Terminal 1 — Runs the Gatsby server (your website preview)
- Terminal 2 — Runs the Decap CMS proxy server (the admin panel authentication)
They work together but run as separate processes. If you close one, the other will not work properly.
Important: Development vs Production Mode
There is a critical difference between gatsby develop and gatsby serve when accessing the CMS admin panel:
| Command | CMS Accessible? | Why |
|---|---|---|
npm start (gatsby develop) |
No — returns 404 | Gatsby develop server does not serve static HTML files from the static/ folder |
npm run build + npm run serve |
Yes | The production server serves all files from public/, including admin/index.html |
This means: To use Decap CMS locally, you must run gatsby build and gatsby serve, not gatsby develop.
This is a known behavior of Gatsby. It is not a bug in GatsbyCar.
Prerequisites
Before starting, make sure:
- Node.js is installed (from Documentation 2)
- Dependencies are installed (
npm installalready run) - The project folder is open in VS Code
Step 1: Open Two Terminals in VS Code
- Open VS Code with your GatsbyCar project folder
- Click Terminal in the top menu
- Click New Terminal
- A terminal panel opens at the bottom
- Click the + icon in the terminal panel to create a second terminal
You will now see two terminal tabs:
- bash (or powershell) — Terminal 1
- bash (or powershell) — Terminal 2
Click each tab to switch between them.
Step 2: Build the Site in Terminal 1
Click on Terminal 1 (the first tab).
Type:
npm run buildPress Enter. Wait until you see:
success Building static HTML for pages - 4.746s - 91/91 19.17/s
info Done building in 40.459890932 secThis creates the public/ folder with all your production files, including admin/index.html.
Step 3: Serve the Site in Terminal 1
After the build completes, type:
npm run servePress Enter. Wait until you see:
You can now view gatsbycar in the browser.
http://localhost:9000/Note: The URL is localhost:9000, not localhost:8000. The serve command uses a different port.
Leave this terminal running. Do not close it.
Step 4: Start Decap CMS Proxy in Terminal 2
Click on Terminal 2 (the second tab).
Type:
npx decap-serverPress Enter. Wait until you see:
Decap CMS Proxy Server listening on port 8081Leave this terminal running too. Do not close it.
Step 5: Access the Admin Panel
Open your browser and go to:
Important: Use localhost:9000, not localhost:8000. The /admin/ path only works on the serve port.
You will see the Decap CMS login page.
In local development mode, you do not need to log in. The proxy server handles authentication automatically. You will be taken directly to the admin dashboard.
Step 6: Explore the Admin Panel
Once logged in, you will see the Decap CMS dashboard. The left sidebar shows these collections:
| Collection | Purpose |
|---|---|
| Home Page | Homepage content |
| About Page | About page content |
| Contact Page | Contact page content |
| Cars (Fleet) | Car listings |
| Blog Posts | Blog articles |
| Widget Setting | Site-wide settings |
| Navbar | Navigation menu |
| Car List (Homepage) | Homepage car display |
| Contact Widget | Footer contact menu |
Click any collection to start editing.
Step 7: Edit Your First Content
Let's change the homepage title as a test.
- Click Home Page in the left sidebar
- Click Content Home Page
- Find the Title field
- Change the text to your website name
- Click Save in the top right corner
Now open a new browser tab at http://localhost:9000 and refresh. Your new title should appear immediately.
Step 8: Upload an Image
Let's try uploading a logo.
- Click Widget Setting in the left sidebar
- Find the Logo Image field
- Click Choose an image
- Select an image file from your computer
- Wait for the upload to complete
- Click Save
The image is now saved to your project. The path is automatically updated in widget.json.
Step 9: Create a New Car Listing
Let's add a new car to your fleet.
- Click Cars (Fleet) in the left sidebar
- Click New Car at the top of the page
- Fill in the fields:
| Field | Example Value |
|---|---|
| Title | Mercedes-Benz S-Class |
| Publish Date | Today's date |
| Description | Luxury sedan for business travel |
| Cover Image | Upload a photo |
| Intro | Executive Mercedes rental |
| Brand | Mercedes-Benz |
| Car Model | S-Class |
| Transmission | Automatic |
| Capacity | 5 Seats |
| Year | 2024 |
| Color | Black |
| Price | 800 |
| Duration | Day |
| Content | Write a description here |
- Click Save
- Click Publish to make it live
The new car will appear on your fleet page immediately.
Step 10: Create a New Blog Post
Let's write a blog article.
- Click Blog Posts in the left sidebar
- Click New Post
- Fill in the fields:
| Field | Example Value |
|---|---|
| Title | How to Start a Car Rental Business |
| Publish Date | Today's date |
| Description | A practical guide for new operators |
| Cover Image | Upload a photo |
| Tags | car-rental, business, guide |
| Content | Write your article here in Markdown |
- Click Save
- Click Publish
The article will appear on your blog page immediately.
How the Workflow Works
When you save in Decap CMS, here is what happens:
- Content is updated in the JSON or Markdown file
- The Decap CMS proxy server commits the change to your local repository
- You need to rebuild the site (
npm run build) to see the change inservemode - In
developmode, changes are automatic
Note: Because CMS works best with serve mode, you need to rebuild after each content change. If you want automatic rebuilds, use gatsby develop and access the CMS at /admin/ (which returns 404 — see the "Important" section above).
The compromise: Use gatsby develop for coding and design work. Use gatsby build && gatsby serve when you need to edit content through the CMS.
Stopping the Servers
When you are done:
- Go to Terminal 1 and press
Ctrl + Cto stop the serve server - Go to Terminal 2 and press
Ctrl + Cto stop Decap CMS
You can restart both anytime by following steps 2 through 4 again.
Common Issues and Solutions
Issue: /admin/ returns 404
This is expected behavior in gatsby develop mode. Gatsby does not serve static HTML files from static/ during development.
Solution: Use npm run build && npm run serve and access http://localhost:9000/admin/.
Issue: Port 8081 is already in use
Another Decap CMS server is already running.
Solution:
- Close all terminals
- Restart VS Code
- Try again
Issue: Port 9000 is already in use
Another process is using port 9000.
Solution:
npm run serve -- --port 9001Then access http://localhost:9001/admin/.
Issue: Changes do not appear on the website
In serve mode, changes require a rebuild.
Solution: Stop the server (Ctrl + C), run npm run build, then npm run serve again.
Issue: Image upload fails
Solution:
- Check that
media_folderandpublic_folderinstatic/admin/config.ymlare correct - Make sure the
static/images/folder exists - Check that you have write permission to the folder
Issue: "Cannot find module 'decap-server'"
Solution: Install the Decap CMS server globally or use npx:
npx decap-serverIssue: Admin page shows blank screen
Solution:
- Check browser console for errors (F12)
- Check Terminal 2 for proxy server errors
- Restart both terminals
Issue: Cannot log in
In local development mode, no login is required. If you see a login page:
- Make sure Terminal 2 is running
npx decap-server - Check that
config.ymlhaslocal_backend: true - Try refreshing the page
Which Command Should I Use?
| Task | Command |
|---|---|
| Writing code, editing CSS, adding features | npm start |
| Editing content through CMS | npm run build && npm run serve |
| Preview final production build | npm run build && npm run serve |
| Quick test after content change | npm start (content only appears if you rebuild) |
Recommendation: During development, use npm start for coding. When you need to edit content via CMS, switch to npm run build && npm run serve. This is the standard workflow for Gatsby + Decap CMS projects.
Understanding the Difference
gatsby develop (npm start):
- Fast rebuilds as you edit code
- Hot module reloading
- Does not serve static HTML files
- CMS at
/admin/returns 404
gatsby build && gatsby serve (npm run build && npm run serve):
- Slow rebuilds, requires manual restart
- No hot reloading
- Serves all files from
public/ - CMS at
/admin/works
Next Step
You now know how to run and use Decap CMS. Proceed to:
Managing Content with Decap CMS
Need Help?
If you get stuck, contact us:
- Email: creativebydre@gmail.com
- Custom project: https://www.fiverr.com/creativitas/create-your-custom-website-and-app
RentCar