How to Use AI Code Editors to Create Projects in ElmapiCMS

Learn how to leverage AI coding assistants like Cursor or GitHub Copilot to create ElmapiCMS project templates and accelerate your development workflow.

R
Raşit Apalak
·
·
8 min read

Artificial Intelligence has transformed how developers build software. When combined with ElmapiCMS, AI coding assistants can dramatically accelerate project creation from designing content schemas to generating complete project templates.

This guide will show you how to use AI tools like Cursor or VS Code with GitHub Copilot to create reusable ElmapiCMS project templates, making it possible to spin up new projects in minutes instead of hours.


Table of Contents


Why Use AI with ElmapiCMS?

ElmapiCMS is built for developers who want full control over their content structure. AI assistants excel at:

  • Schema Design - Generate complete collection and field definitions
  • Template Creation - Build reusable project templates with demo data
  • Code Generation - Create frontend components that consume your CMS API
  • Content Generation - Populate collections with realistic demo content

The key is providing the right context so AI understands ElmapiCMS's structure and conventions.


Setting Up Your AI Assistant

Choose Your Tool

Cursor (Recommended)

  • Built-in AI that understands your entire codebase
  • Can reference existing templates and code
  • Excellent for generating structured data

VS Code + GitHub Copilot

  • Industry-standard editor with AI assistance
  • Works well with code snippets and templates
  • Great for iterative development

Both tools work best when they can see examples of what you're trying to create.


Understanding ElmapiCMS Project Templates

Before asking AI to generate a template, you need to understand what a template looks like. Project templates in ElmapiCMS are JSON files that define:

  • Collections - Content types with their field configurations
  • Demo Data - Sample entries that populate collections automatically
  • Metadata - Template name, description, and identifier

Templates are stored in resources/data/project_templates/ as individual JSON files (e.g., landing-page-nextjs.json).

The Template Structure

Here's the basic structure of an ElmapiCMS template:

{
  "slug": "template-identifier",
  "name": "Template Display Name",
  "description": "What this template does",
  "has_demo_data": true,
  "collections": [
    {
      "name": "Collection Name",
      "slug": "collection-slug",
      "is_singleton": false,
      "fields": [
        {
          "type": "text",
          "label": "Field Label",
          "name": "field_name",
          "validations": {
            "required": { "status": true }
          }
        }
      ]
    }
  ],
  "demo_data": [
    {
      "collection": "collection-slug",
      "entries": [
        {
          "id": "e1",
          "locale": "en",
          "status": "published",
          "fields": {
            "field_name": "Example value"
          }
        }
      ]
    }
  ]
}

Step 1: Provide Context to Your AI Assistant

AI needs context to generate accurate templates. The best approach is to:

  1. Open an existing template in your editor (like landing-page-nextjs.json)
  2. Show it to your AI assistant by selecting it or referencing it
  3. Ask AI to create a similar template for your use case

Example Prompt for Cursor

In Cursor, you can:

  1. Open the existing template file: resources/data/project_templates/landing-page-nextjs.json
  2. Use Cursor's AI chat and say:

"I have an existing ElmapiCMS project template open. I want to create a new template for a product catalog. Generate a complete template JSON with collections for products, categories, and brands. Include demo data. Follow the same structure and field conventions as the existing template."

Cursor will analyze the existing template and generate a new one following the same patterns.

Example Prompt for GitHub Copilot

With GitHub Copilot in VS Code:

  1. Create a new file: resources/data/project_templates/product-catalog.json
  2. Start typing a comment:
// ElmapiCMS project template for product catalog
// Collections needed: products, categories, brands
// Products should have: name, description, price, SKU, images, category relation
// Categories should have: name, slug, description
// Brands should have: name, logo, description
// Include demo data for all collections

Copilot will suggest the complete JSON structure based on your comments and any similar files in your project.


Step 2: Generate the Template Schema

Once your AI assistant understands the structure, ask it to generate the complete template. Be specific about:

  • What collections you need (e.g., products, categories, blog posts)
  • What fields each collection should have (e.g., title, description, price)
  • Field types (text, longtext, media, relation, group, etc.)
  • Whether collections are singletons (single entry) or multi-entry
  • What demo data to include

Field Types in ElmapiCMS

Make sure your AI understands all available field types in ElmapiCMS:

  • text - Single line text (headings, titles)
  • longtext - Multi-line text (descriptions, paragraphs)
  • richtext - Rich text editor with formatting capabilities
  • slug - URL-friendly strings (permalinks, URLs)
  • email - Email field with validation
  • password - Password field with encryption
  • number - Integer, decimal, and float numbers
  • enumeration - Dropdown with predefined list of values
  • boolean - True or false checkbox
  • color - Color picker
  • date - Calendar date picker
  • time - Time picker
  • media - File uploads from the asset library (images, documents, videos)
  • relation - Link to other collections
  • json - Raw JSON data
  • group - Nested field groups (can be repeatable)

Example: Generating a Blog Template

Prompt: "Create an ElmapiCMS template for a blog. Collections: posts (multi-entry), categories (multi-entry), authors (multi-entry). Posts need: title (text, required), slug (slug, auto-generated from title), content (richtext), excerpt (longtext), featured_image (media), publish_date (date), category (relation to categories), author (relation to authors), tags (repeatable text). Include demo data: 5 posts, 3 categories, 2 authors."

Your AI assistant will generate the complete JSON structure.


Step 3: Handle Complex Field Structures

AI assistants excel at generating complex nested structures. Here are common patterns:

Repeatable Field Groups

For features, FAQ items, or navigation links:

{
  "type": "group",
  "label": "Feature",
  "name": "features",
  "repeatable": true,
  "children": [
    {
      "type": "text",
      "label": "Title",
      "name": "title"
    },
    {
      "type": "longtext",
      "label": "Description",
      "name": "description"
    },
    {
      "type": "text",
      "label": "Icon Name",
      "name": "icon_name"
    }
  ]
}

Repeatable Text Fields

For simple lists (like pricing features):

{
  "type": "text",
  "label": "Features",
  "name": "features",
  "options": {
    "repeatable": true
  }
}

Relations Between Collections

Link collections together:

{
  "type": "relation",
  "label": "Category",
  "name": "category",
  "options": {
    "relation": {
      "type": 1,
      "collection": "categories"
    }
  }
}

Your AI assistant can generate these complex structures when you describe what you need.


Step 4: Generate Demo Data

Once collections are defined, ask AI to generate realistic demo content:

Prompt: "Generate demo data entries for the blog template. Create 5 blog posts with varied topics (technology, design, business). Each post should have a unique title, engaging content (2-3 paragraphs), excerpt, and realistic publish dates. Assign posts to different categories and authors."

AI can generate:

  • Multiple blog posts with varied content
  • Product listings with descriptions and pricing
  • FAQ entries with questions and answers
  • Feature lists with descriptions
  • Any structured content your template needs

Step 5: Save and Load Your Template

Save the Template File

  1. Save your generated template as a JSON file in resources/data/project_templates/
  2. Name it using the template slug (e.g., product-catalog.json)
  3. Validate the JSON syntax (your editor should catch errors)

Load the Template

Run the ElmapiCMS seeder to load templates into the database:

php artisan db:seed --class=ProjectTemplateSeeder

This command reads all JSON files from resources/data/project_templates/ and loads them into the database.

Apply the Template

When creating a new project in ElmapiCMS:

  1. Select your template from the dropdown
  2. Choose whether to include demo data
  3. ElmapiCMS automatically creates all collections, fields, and populates demo content

Best Practices

1. Always Start with an Example

AI works best when it has context. Open an existing template or provide a reference structure before asking for a new one.

2. Be Specific About Requirements

Instead of "create a blog template," say "create a blog template with posts, categories, and authors, where posts have title, content, featured image, and publish date."

3. Validate AI Output

Always review AI-generated templates:

  • Check JSON syntax
  • Verify field types match your needs
  • Ensure demo data is realistic
  • Test the template on a sample project

4. Iterate and Refine

Use AI for the initial generation, then refine based on your specific requirements. AI is a starting point, not the final product.

5. Keep Templates Generic

Generate demo content that works for any use case. Avoid company-specific names or details that limit reusability.


Conclusion

AI coding assistants like Cursor and GitHub Copilot make creating ElmapiCMS project templates fast and efficient. The key is providing proper context: show AI an example template, describe your requirements clearly, and iterate on the results.

By combining AI's speed with your domain knowledge, you can create production-ready templates in minutes instead of hours. Start with an existing template as a reference, describe what you need, and let AI handle the heavy lifting.

Ready to try it? Open an existing template in Cursor or VS Code, describe your next project, and watch AI generate a complete template structure for you.

Share this post:

Ready to build your content API?

Try ElmapiCMS free with our live demo, or get the full source code for $149.

Comparing options first? Read our best headless CMS comparison.

Related Posts