Getting Started
Install CodeBaker and generate your first files in about five minutes.
1. Install the plugin
- Open an IntelliJ Platform IDE, version 2023.2 to 2026.2: IntelliJ IDEA, PhpStorm, WebStorm, PyCharm, GoLand, RubyMine, CLion, Rider or DataGrip.
- Go to Settings/Preferences → Plugins → Marketplace, search for CodeBaker, click Install, and restart the IDE.
CodeBaker is a 0.9 beta: please report what you find at info@codebaker.dev.
2. Install the sample templates
Open a project, then in the Project view right-click any folder and choose New → Generate from Template → Install Sample Templates…. Keep both samples ticked and click Install. This copies two templates into your project's .CodeBaker/ folder (created if it does not exist):
| Sample | What it is |
|---|---|
| Hello World | The simplest template: you type your name, it writes a Hello.txt. |
| CRUD Demo | A small web app generated from a template. It shows the advanced features. |
The Install Sample Templates entry appears while your project has no templates yet. Later you can find it with Search Everywhere (press Shift twice): CodeBaker: Install Sample Templates.
3. Generate Hello World
Generated files are written into the folder you right-click, so create an empty folder for the sample, for example hello, and use that.
- Right-click the
hellofolder. - Choose New → Generate from Template → Hello World.
- Type your name in the form and click Next >> twice.
- Click Finish, then Done.
Hello.txtappears in the folder and opens in the editor, with your name in it.
This is what you just did, from the template to the file:
https://codebaker.dev/examples/hello-world.zipNeeds the CodeBaker plugin and an open project. Another IDE, or the button does nothing? Copy the link, then in the IDE right-click any folder → New → Generate from Template → Install Template from URL… and paste it. You always get a confirmation dialog before anything is installed.
Hello, {{ name }}!
Thank you for trying CodeBaker.
Questions or suggestions? Write to info@codebaker.dev or visit https://codebaker.dev
{
// Folder name when installed under .CodeBaker/ (see samples/README.md).
id: "hello-world",
// Displayed in the "Generate from Template" menu
name: "Hello World",
// Semver, shown next to the name in the menu and recorded in the generation history.
version: "1.0.1",
// One line for the "Install Sample Templates" dialog.
description: "The simplest template: type your name, get a Hello.txt. Shows variables and the diff preview.",
// Hello.txt uses Pebble's own {{ name }} placeholder, which works in every template with no setup.
// Two optional settings are not needed here: `placeholders` adds another way to write a value (for example
// placeholders: ["___VAR___"] lets you write ___name___), and `syntax` switches the whole template to other
// delimiters (for example syntax: "square" reads [[ name ]] instead of {{ name }}). See the Configuration Reference.
// Each variable becomes a field in the dialog, with this as its default value.
vars: {
name: "Your Name",
},
// Opened in the editor after generation.
open: ["Hello.txt"],
}
- name
- Ada
Hello, Ada!
Thank you for trying CodeBaker.
Questions or suggestions? Write to info@codebaker.dev or visit https://codebaker.dev
The field you filled in, name, comes from the vars section of the template's codebaker.config.json5: click that file in the tree above. Values and Variables shows how to define your own fields and lists.
The dialog has four steps, each described in the Generation Workflow:
- Generation Properties: the form where you type the values.
- Pre-Generation: CodeBaker works out the files. Nothing is written yet.
- Code Preview: every file that would be created or changed, with a diff for files that already exist. You can edit the result here.
- Code Generation: the files are written, in one undoable command.
The same four steps in twelve seconds, with a PHP model template.
Generate again with a different name and the preview shows a diff against the file you already have. An existing file is overwritten when you finish, after a confirmation, so look at the changes first.
Right-click a folder in the Project view: the entry is in New → Generate from Template. A template that sets paths in its config is offered only in the folders that match, and the menu lists the templates that are in your project's .CodeBaker/ folder. If you have no templates yet, the menu offers Install Sample Templates… instead.
4. The bigger sample (optional)
The CRUD Demo creates about 25 files, so generate it into an empty folder of its own, for example demo, never into the middle of a real project.
- Right-click the empty
demofolder and choose New → Generate from Template → CRUD Demo. Generate it with the default values. - The IDE opens
index.htmland the generatedtask.html. Open either in your browser (right-click the file, then Open in → Browser). It is a working page that stores its data in the browser: this is the template in the video on the first page. - Generate again with another entity name (for example
littlePuppy). A second page appears, and the list ondemo.htmland the menu on the entity pages gain the new entity: one template, many outputs. (index.htmlis a cover page and has no live menu.)
Next steps
- Your First Template: write a small template yourself.
- Values and Variables: where the fields come from, what JSON is, how a value is computed.
- How It Works: the whole process on one diagram.
- Questions and Answers: short answers to common questions.
First questions
Where do templates live?
In the .CodeBaker/ folder at your project root. Commit it to Git and everyone who pulls the repository gets the same templates (they still need the plugin installed).
Can I use existing code as templates?
Yes, that is the usual way. Copy working code into .CodeBaker/YourTemplate/, replace the parts that vary with placeholders, and add a codebaker.config.json5 that declares those variables under vars. Then generate and check the preview, because the first version of a template rarely comes out right. Turn Your Own Code into a Template goes through it step by step.
What if I make a mistake?
The preview shows every file and a diff for files that already exist, and you can cancel before anything is written. Finishing overwrites existing files (you are asked to confirm). If you do not like the result, Edit → Undo reverts the whole generation in one step, and since the project is in Git you can revert there too.
Will templates work with my IDE?
Templates are ordinary files with ordinary extensions, so your IDE highlights and inspects them as it normally would. A placeholder style such as ___title___, which you can declare under placeholders, is a valid identifier in most languages, but not everywhere (for example, a CSS value), so you may still see an occasional warning in a template. The plugin also colors the CodeBaker: at the start of a directive comment, so you can see which comments CodeBaker will act on (see How CodeBaker comments work).