# strapi/launchpad architecture

> Architecture diagram of the GitHub repository strapi/launchpad, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/strapi/launchpad
- Repository: https://github.com/strapi/launchpad

## Overview

##### Main Components
- Backend (Strapi):
- Contains directories for configuration, API endpoints, middleware, custom components, and extensions.
- Implements content types (articles, categories, pages, etc.), controllers, routes, and services.
- Includes custom middleware (deepPopulate) and scripts (UUID regeneration, prefill login fields).
- Uses the Strapi admin panel along with plugins and customizations for things like internationalization, media management, RBAC, and audit logs.
- Frontend (Next.js):
- Includes all Next.js directories (app, pages for localized routes, components, context, lib, and public resources).
- Designed for dynamic content rendering and previewing content from Strapi.
- Implements various UI components such as blog cards, navigation bars, and hero sections to display content and handle interactions.
- Integration Components:
- The environment variables connecting both parts (NEXT_PUBLIC_API_URL in Next.js and STRAPI_ADMIN_CLIENT_URL in Strapi) indicate a clear API connection.
- Data flow is from the Strapi-based content API to the Next.js client.
- External Dependencies:
- Underlying databases as configured in Strapi (look inside the database and migrations folders).
- External services and CDN(s) might be implied (media uploads in Strapi).

##### Relationships and Interactions
- The Next.js frontend makes API calls to the Strapi backend to fetch and display dynamic content.
- Strapi exposes REST or GraphQL endpoints (customizable API) and automatically builds the required endpoints when content types are defined.
- Middleware (like deepPopulate) in Strapi adds additional functionality to content population, which may influence how data is served to the frontend.
- The custom post-install and patch scripts present in the Strapi folder indicate automated configuration steps during deployment.

##### Architecture Patterns
- Separation of Concerns: There is a clear separation between the content management backend (Strapi) and the content consumption frontend (Next.js).
- Modular Design: Both projects are organized in modules (controllers, content types, extensions in Strapi; components, pages, context in Next.js) so that major functionalities are encapsulated.
- Internationalization: The Next.js frontend uses locale-specific routing (noted in the folder structure under next/app/[locale]) to support multiple languages.
- API-Driven Architecture: The projects interact via well-defined API endpoints.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Strapi Backend"
        StrapiBackend["Strapi Backend"]
        APIEndpoints["API (Controllers,Routes,Services)"]
        ContentTypes["Content Types"]
        CustomMiddleware["Custom Middleware (deepPopulate)"]
        AdminPanel["Admin Panel & Extensions"]
        subgraph "Custom Scripts"
            PrefillLogin["Prefill Login Fields"]
            UpdateUuid["UUID Regeneration"]
        end
        Database["Database & Migrations"]
    end

    subgraph "Next.js Frontend"
        NextFrontend["Next.js Frontend"]
        AppShell["App Shell & Routing"]
        UIComponents["UI Components"]
        ContextManagement["Context & State Management"]
        StrapiAdapter["Strapi Adapter"]
    end

    DeploymentPipelines["Deployment Pipelines"]

    %% Connections between components
    UIComponents -->|"fetches"| APIEndpoints
    StrapiAdapter -->|"calls"| APIEndpoints
    AppShell -->|"routesTo"| UIComponents
    ContentTypes -->|"defines"| APIEndpoints
    AdminPanel -->|"customizes"| APIEndpoints
    APIEndpoints -->|"enhancedBy"| CustomMiddleware
    ContextManagement -->|"supports"| UIComponents
    DeploymentPipelines -->|"deploys"| StrapiBackend
    DeploymentPipelines -->|"deploys"| NextFrontend

    %% Click Events
    click StrapiBackend "https://github.com/strapi/launchpad/tree/main/strapi/"
    click APIEndpoints "https://github.com/strapi/launchpad/tree/main/strapi/src/api/"
    click ContentTypes "https://github.com/strapi/launchpad/tree/main/strapi/src/api/article/"
    click CustomMiddleware "https://github.com/strapi/launchpad/blob/main/strapi/src/middlewares/deepPopulate.ts"
    click AdminPanel "https://github.com/strapi/launchpad/tree/main/strapi/src/admin/"
    click PrefillLogin "https://github.com/strapi/launchpad/blob/main/strapi/scripts/prefillLoginFields.js"
    click UpdateUuid "https://github.com/strapi/launchpad/blob/main/strapi/scripts/updateUuid.js"
    click Database "https://github.com/strapi/launchpad/tree/main/strapi/database/migrations/"
    click NextFrontend "https://github.com/strapi/launchpad/tree/main/next/"
    click AppShell "https://github.com/strapi/launchpad/tree/main/next/app/"
    click UIComponents "https://github.com/strapi/launchpad/tree/main/next/components/"
    click ContextManagement "https://github.com/strapi/launchpad/tree/main/next/app/context/"
    click StrapiAdapter "https://github.com/strapi/launchpad/tree/main/next/lib/strapi/"
    click DeploymentPipelines "https://github.com/strapi/launchpad/blob/main/.github/workflows/deploy-demo.yaml"

    %% Styles
    classDef backend fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef frontend fill:#66ccff,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#ff9966,stroke:#333,stroke-width:2px;
    classDef middleware fill:#cc99ff,stroke:#333,stroke-width:2px;
    classDef utility fill:#ccffcc,stroke:#333,stroke-width:2px;

    class StrapiBackend,APIEndpoints,ContentTypes,AdminPanel,Database backend;
    class CustomMiddleware middleware;
    class PrefillLogin,UpdateUuid utility;
    class NextFrontend,AppShell,UIComponents,ContextManagement,StrapiAdapter frontend;
    class DeploymentPipelines infrastructure;
```
