Skip to content

How can I customize the default set of files generated when creating a new project? #5264

Open

Description

@doguto

When I create a new project, these files and folders are created by default.

|- .pio/
|- .vscode/
|    |- extensions.json
|- include/
|    |- README.md
|- lib/
|    |- README.md
|- src/
|- test/
|    |- README.md
|- .gitignore
|- platformio.ini

These are good, but I want to add mbed_app.json to these.
How can I do this?

Activity

  1. JamBalaya56562 commented on Jul 5, 2026

    @JamBalaya56562

    Hi @doguto, thanks for the great question!

    I had a look at how this works in Core: pio project init doesn't currently expose any template hook. Its options are a fixed set (--board, --ide, --sample-code, --project-option, …), and the generated layout (src/, include/, lib/, test/, platformio.ini, the README stubs and .gitignore) is produced by hard-coded helpers in platformio/project/commands/init.py — so there's no built-in way to inject an extra file such as mbed_app.json at creation time.

    Until such a feature exists, the two most reliable approaches are:

    1. Keep a small "starter" project that already contains the file and copy/clone it for new projects, or
    2. Generate the file automatically from an extra_scripts step, so a pre-build script creates it if it's missing — see https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html

    If a first-class, configurable project-template option would be valuable to you, that's a very reasonable enhancement to request — feel free to open a focused feature request describing the use case so it can be considered on its own. Hope this helps, and thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions