项目结构
¥Project structure
Strapi 项目的结构取决于项目是使用 TypeScript(如果你在创建项目时使用了 --quickstart
选项,则这是默认设置)还是使用原始 JavaScript 创建的,如下所示:
¥The structure of a Strapi project depends on whether the project was created with TypeScript (which is the default if you used the --quickstart
option while creating the project) or with vanilla JavaScript, and looks like the following:
- TypeScript-based projects
- JavaScript-based projects
The following diagram is interactive: you can click on any file or folder name highlighted in purple to go to the corresponding documentation page.
. # root of the application
├──── .strapi # auto-generated folder — do not update manually
│ └──── client # files used by bundlers to render the application
│ ├ index.html
│ └ app.js
├──── .tmp
├──── config # API configurations
│ ├ admin.ts
│ ├ api.ts
│ ├ cron-tasks.ts # optional, only if you created CRON tasks
│ ├ database.ts
│ ├ middlewares.ts
│ ├ plugins.ts
│ └ server.ts
├──── database
│ └──── migrations
├──── dist # build of the backend
│ └──── build # build of the admin panel
├──── node_modules # npm packages used by the project
├──── public # files accessible to the outside world
│ ├──── uploads
│ └ robots.txt
├──── src
│ ├──── admin # admin customization files
│ │ ├──── extensions # optional, files to extend the admin panel
│ │ ├──── app.example.tsx
│ │ ├──── webpack.config.example.js
| | ├──── tsconfig.json
│ ├──── api # business logic of the project split into subfolders per API
│ │ └──── (api-name)
│ │ ├──── content-types
│ │ │ └──── (content-type-name)
│ │ │ ├ lifecycles.ts