Strapi Local Development Guide

Run Strapi Headless CMS on localhost:1337 to manage content and REST/GraphQL APIs.


Strapi is an open-source Headless CMS built with Node.js, providing an admin panel and REST/GraphQL APIs. The default local development URL is http://localhost:1337.

Quick Start

npx create-strapi-app@latest my-project --quickstart
cd my-project
npm run develop

The --quickstart option uses SQLite; the first run will open a browser to register an admin user.

Default localhost

PurposeAddress
Admin Panelhttp://localhost:1337/admin
REST APIhttp://localhost:1337/api
GraphQL (if enabled)http://localhost:1337/graphql

Database

The quick start uses SQLite (.tmp/data.db).

For production or team development, switch to PostgreSQL:

.env:

DATABASE_CLIENT=postgres
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=strapi
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=secret

Integrating with Next.js

Frontend fetch:

GET http://localhost:1337/api/articles?populate=*

Note CORS: In the Strapi admin panel → Settings → Users & Permissions → configure CORS to allow http://localhost:3000.

Frequently Asked Questions

Port 1337 Occupied
Change port: 1338 in config/server.js.

Node Version
Refer to the Strapi documentation for the current LTS requirements (usually Node 18/20).

Summary

Strapi local development can be accessed at http://localhost:1337, with the admin panel at /admin, making it a common localhost solution for Headless CMS + API.

访客计数:------ Best viewed in Netscape Navigator · 800×600 © LocalHost Run