Templates & DSL
Use the lesson builder DSL to create structured lessons from templates.
The Lex Platform includes a powerful lesson builder that uses a Domain-Specific Language (DSL) to define structured lessons from reusable templates. Instead of building every lesson from scratch in the editor, you can use templates and DSL syntax to quickly scaffold complete lessons with consistent structure and quality.
What Are Lesson Templates?
Lesson templates are pre-built frameworks that define the structure, flow, and exercise types of a lesson. Think of them as blueprints: you select a template, customize the content, and the system generates a fully structured lesson ready for the Lex Editor.
Why Use Templates?
- Speed: Build lessons in minutes instead of hours
- Consistency: Every lesson follows a proven pedagogical structure
- Quality: Templates are designed by experienced educators
- Flexibility: Customize any section after generation
- Scalability: Build an entire course from a consistent set of templates
Templates do not replace your creativity -- they give you a head start. You can always modify, extend, or completely rework any generated lesson.
Available Template Types
Grammar Lesson Template
A structured lesson focused on teaching a specific grammar point.
Sections:
- Introduction -- Real-world context showing why this grammar matters
- Rule Presentation -- Clear explanation with visual aids
- Example Sentences -- 5-10 graded examples
- Common Mistakes -- Typical errors and how to avoid them
- Guided Practice -- Fill-in-blank and multiple choice exercises
- Free Practice -- Writing or speaking prompts applying the grammar
- Summary -- Quick-reference card of the rule
Vocabulary Lesson Template
Build a thematic vocabulary lesson with images, audio, and practice activities.
Sections:
- Theme Introduction -- Context for the vocabulary set
- Word Presentation -- New words with definitions, images, and pronunciation
- Contextual Sentences -- Each word used in a sentence
- Matching Activity -- Pair words with definitions
- Fill-in-Blank Practice -- Use new words in sentences
- Production Task -- Write or speak using the new vocabulary
- Review Game -- Interactive flashcard-style review
Conversation Practice Template
A lesson designed around dialogue and spoken interaction.
Sections:
- Situation Setup -- Describe the real-world scenario
- Model Dialogue -- Sample conversation with audio
- Key Phrases -- Essential expressions for the situation
- Comprehension Check -- Questions about the model dialogue
- Guided Role-Play -- Structured practice with prompts
- Free Role-Play -- Open conversation activity
- Reflection -- Self-assessment and vocabulary log
Assessment Template
A template for quizzes and tests with multiple exercise types.
Sections:
- Instructions -- Clear directions and time limits
- Section A: Multiple Choice -- Grammar and vocabulary recognition
- Section B: Fill-in-Blank -- Application of rules
- Section C: Matching -- Vocabulary or concept pairing
- Section D: Writing -- Short essay or paragraph
- Answer Key -- Hidden answers for teacher reference
Understanding the DSL
The lesson DSL lets you define lesson structure in a compact, readable format. Each lesson is described as a series of sections, and each section contains widgets -- the building blocks of your content.
Section Structure
A lesson is divided into sections, each with a type and a list of widgets:
Section: Introduction
- widget: text
content: "Welcome to this lesson on the present tense..."
- widget: image
src: greeting.jpg
alt: "Students greeting each other"
Section: Practice
- widget: exercise
type: fill-in-blank
items:
- "She _____ (go) to school every day." -> "goes"
- "They _____ (have) two cats." -> "have"Widget Types
The DSL supports a rich set of widget types that map to Lex Editor content blocks:
| Widget | Description | Use Case |
|---|---|---|
text | Rich text paragraph | Explanations, instructions |
heading | Section heading (H1-H3) | Organizing content |
image | Image with alt text | Visual aids, diagrams |
audio | Audio player | Pronunciation, listening |
video | Embedded video | YouTube, Vimeo clips |
exercise | Interactive exercise | Practice and assessment |
table | Data table | Conjugation charts, comparisons |
callout | Highlighted box | Tips, warnings, cultural notes |
collapsible | Expandable section | Answer keys, extra info |
sentence-builder | Drag-and-drop sentence construction | Word order practice |
Exercise Widgets in Detail
The exercise widget supports several types:
Multiple Choice:
- widget: exercise
type: multiple-choice
question: "Which is the correct past tense of 'go'?"
options:
- "goed"
- "went" [correct]
- "gone"
- "going"
feedback: "'Went' is the irregular past tense of 'go'."Fill-in-Blank:
- widget: exercise
type: fill-in-blank
sentence: "Yesterday, I _____ to the park."
answer: "went"
alternatives: ["walked"]
hint: "Irregular past tense of 'go'"Matching:
- widget: exercise
type: matching
pairs:
- ["hello", "hola"]
- ["goodbye", "adios"]
- ["please", "por favor"]
distractors: trueSentence Builder:
- widget: exercise
type: sentence-builder
target: "The cat is sitting on the mat"
words: ["mat", "The", "on", "sitting", "is", "the", "cat"]
distractors: ["dog", "under"]The distractors toggle adds extra wrong options to matching and sentence-builder exercises, increasing difficulty. This is recommended for B1+ students.
Using Templates in Practice
Creating a Lesson from a Template
Choose a Template
Navigate to Courses -> your course -> "Add Lesson". Select "From Template" instead of blank lesson. Browse the template gallery and pick the one that matches your lesson goal.
Configure Template Parameters
Fill in the template-specific fields:
- Topic: e.g., "Spanish present tense -AR verbs"
- Target Language: e.g., Spanish
- CEFR Level: e.g., A1
- Number of Exercises: e.g., 8
- Include Audio: Yes/No
Preview the Structure
The system shows you the generated lesson outline with all sections and placeholder widgets. Review the structure before proceeding.
Generate the Lesson
Click "Generate". The system creates the full lesson in the Lex Editor with all sections, exercises, and formatting in place.
Customize and Refine
Open the generated lesson in the editor. Replace placeholder text with your content, adjust exercise difficulty, add your own images and audio, personalize the tone and examples.
Saving Custom Templates
If you have built a lesson structure you want to reuse:
- Open the lesson in the editor
- Click "Save as Template" from the toolbar
- Give your template a name and description
- Choose visibility: Personal (only you) or Organization (all teachers in your school)
- Save
Your custom template now appears in the template gallery alongside the built-in options.
Browsing Public Templates
Course templates shared by other teachers or organizations can be viewed in read-only mode. When you open a public lesson template you do not own, the full DSL editor opens with all editing controls hidden and form fields disabled. This lets you review the complete template structure and content before deciding whether to purchase or adapt it.
Demo Content Badge
In the course templates list, templates that include pre-generated demo lessons show a "Demo" badge. Hover over the badge to see the number of demo lessons available. Click the badge to navigate to the template detail page with the demo filter enabled, so you can preview the sample content.
Template Best Practices
Start with Built-in Templates:
For your first few lessons, use the built-in templates to learn the structure. Once you are comfortable, create your own.
Customize, Do Not Over-Customize:
Templates work best when you keep the overall structure and focus on swapping content. Rearranging entire sections defeats the purpose of consistency.
Match Template to Lesson Type:
- Class Lessons -> Grammar or Vocabulary template
- Exercise Sets -> Assessment template (without the essay section)
- Homework -> Assessment template or Vocabulary review template
Use AI with Templates:
Combine templates with AI Lesson Generation for maximum efficiency. Select a template for structure, then let AI fill in the content.
Troubleshooting
Template Not Generating
Check:
- All required fields filled in
- Valid CEFR level selected
- Sufficient tokens (if AI-powered generation is used)
- Stable internet connection
Generated Content Looks Wrong
Solutions:
- Re-check the template parameters (wrong level or language can produce poor results)
- Try a different template type
- Edit manually in the Lex Editor after generation
- Regenerate specific sections rather than the whole lesson
Can't Find My Saved Template
Check:
- Visibility setting (Personal vs. Organization)
- Template gallery filter (make sure "My Templates" is selected)
- Template may have been archived -- check the archive section
Next Steps
- Lex Editor Guide - Learn the editor where templates come to life
- Exercises & Activities - Deep dive into exercise widget types
- AI Lesson Generation - Combine AI with templates for speed
- Creating Courses - Organize template-based lessons into courses
Q&A
Do I need to know the DSL syntax to use templates?
No. The template gallery provides a visual interface for selecting and configuring templates. The DSL syntax is used internally and is only relevant if you want to build advanced custom templates.
Can I share my custom templates with teachers at other schools?
Currently, custom templates can be shared within your organization. Sharing across organizations is on the roadmap.
How do templates differ from AI generation?
Templates define the structure of a lesson (which sections, what exercise types, in what order). AI generation fills in the content (the actual text, questions, and examples). You can use them independently or together.
Can I edit the DSL directly?
Advanced users can access the DSL definition of a template for fine-tuned control. This is available under Template Settings -> "Edit DSL" for custom templates you own.
Are there templates for specific languages?
The built-in templates are language-agnostic -- they define structure, not content. When you configure a template, you specify the target language, and the content is generated accordingly.

