Markdown-like App Models โ Production Code, Docs & Diagrams
| โ๏ธ Enemy | Drift โ when docs say one thing and code does another |
|---|---|
| ๐ Philosophy | Zero Dead Docs |
| โ๏ธ Mechanism | One model, multiple views |
| ๐ค Promise | Intent stays synchronized across docs, diagrams, and code |
| ๐ค AI Angle | AI can help author and evolve, but never silently forks intent from implementation |
One source of truth. Zero dead documentation.
AI in the loop โ but never in control.
Explore with AI. Ship with determinism.
Build systems with structure, intent, and trust.
.modelhike files โ Parse โ Hydrate โ Validate โ Render โ Output
All boilerplate โ entities, repositories, controllers, services, DTOs, validation, and API docs โ is generated from a single source of truth, so your team can focus on domain rules and business logic.
| Property | Description |
|---|---|
| ๐ Deterministic | Same model + same templates = identical output. CI-safe, diffable builds. |
| ๐ฆ Zero Dependencies | Core library is fully self-contained. No third-party Swift packages. |
| โก Swift 6 | Actors throughout, strict concurrency, fully Sendable-compliant. |
| ๐ค AI Optional | AI bootstraps and refines; templates drive production builds. No babysitting. |
Result: ๐ Speed + Safety: AI accelerates exploration while the system is still fluid. Templates drive bullet-proof production builds โ deterministic, diffable, CI-safe.
- The DSL
- How It Works
- Installation
- Visual Debugger
- Project Structure
- Documentation
- Current State
- Why ModelHike?
- License
// payment-entity.ts
export class Payment {
id: string;
amount: number;
status: string = "NEW";
customerId: string;
createdAt: Date;
updatedAt: Date;
}
// payment-repository.ts
import { Payment } from './payment-entity';
export class PaymentRepository {
async findById(id: string): Promise<Payment> { /* implementation */ }
async save(payment: Payment): Promise<Payment> { /* implementation */ }
async findByCustomerId(customerId: string): Promise<Payment[]> { /* implementation */ }
}
// payment-controller.ts
import { Request, Response } from 'express';
import { PaymentService } from './payment-service';
export class PaymentController {
constructor(private paymentService: PaymentService) {}
async createPayment(req: Request, res: Response) { /* validation, mapping, error handling
*/ }
async getPaymentById(req: Request, res: Response) { /* validation, mapping, error handling
*/ }
async getCustomerPayments(req: Request, res: Response) { /* validation, mapping, error
handling */ }
}
// payment-service.ts
import { Payment } from './payment-entity';
import { PaymentRepository } from './payment-repository';
export class PaymentService {
constructor(private paymentRepository: PaymentRepository) {}
async createPayment(data: any): Promise<Payment> { /* business logic */ }
async getPaymentById(id: string): Promise<Payment> { /* business logic */ }
async getCustomerPayments(customerId: string): Promise<Payment[]> { /* business logic */ }
}
// routes.ts, validation.ts, dto.ts, tests, swagger docs... (30+ files total)ModelHike uses a Markdown-flavoured DSL to describe software systems. Here's what a model looks like:
- Create a domain model (
models/payments.dsl.md):
==============================
Payments Service (microservices) #blueprint(api-springboot-monorepo)
==============================
+ Payments Module
@ auth:: JWT
@ validation:: strict
=== Payments Module ===
Payment
=======
* _id : Id
* amount : Float { min = 0 }
* customerId: Reference@User
- status : String = "NEW" <NEW, PENDING, COMPLETED, FAILED>
- createdAt : Timestamp
- updatedAt : Timestamp
- audit : Audit (backend)
calculateTotal(items: [LineItem]) : Float
--------------------------------------------
return items.sum(item.price * item.quantity)
---
# APIs ["/payments"]
@ apis:: create, get-by-id, list
@ api:: get-customer-payments [GET "/customers/{customerId}/payments"]
# Events
@ publish:: payment.created, payment.status-changed
@ consume:: customer.verified
#
From this single model, ModelHike generates entities, repositories, controllers, services, DTOs, validation, and API routing โ all wired together and ready to run.
DSL Highlights
| Feature | Capabilities |
|---|---|
| ๐๏ธ C4 Hierarchy | System โ Container โ Module โ Class/DTO/UIView |
| ๐ Typed Properties | Constraints {min, max}, defaults, value sets <A, B, C> |
| โ๏ธ Methods | Typed params, return types, fenced logic blocks |
| ๐ API Scaffolding | Annotations @apis:: create, get-by-id, list |
| ๐ Protocols | REST, GraphQL, gRPC support |
| ๐ท๏ธ Extensibility | Mixins, annotations, attributes, tags |
Full DSL specification: DSL/modelHike.dsl.md
Discover โ Load โ Hydrate โ Validate โ Render โ Persist
| Phase | What it does |
|---|---|
| Discover | Walks the model directory, finds all .modelhike files |
| Load | Parses DSL files into an in-memory model (ModelSpace with containers, modules, domain objects, DTOs, UIViews) |
| Hydrate | Post-load refinements โ port assignment, data type classification, annotation cascade |
| Validate | Semantic checks โ unresolved types, duplicate names, missing modules. Emits structured diagnostics (never halts) |
| Render | Loads a blueprint (templates + scripts), runs main.ss entry-point script, generates output files |
| Persist | Writes all generated files to the output directory |
| Component | Description |
|---|---|
๐ .teso Files |
Templates with {{ expression }} blocks and :statement script lines |
๐ .ss Files |
Pure SoupyScript โ no prefix needed for statements |
| ๐ง Modifiers | Transform inline: {{ name | capitalize }}, {{ prop | typescriptType }} |
| ๐จ Custom Modifiers | Drop .teso files in _modifiers_/ with front-matter config |
| ๐งฉ Full Scripting | Loops, conditionals, variables, functions, file/folder operations |
Template/script specification: DSL/templatesoup.dsl.md
A Blueprint is a named folder of templates, scripts, and static files that drives code generation for a specific stack. The engine renders the blueprint against the parsed model to produce the output codebase.
Current blueprint: api-nestjs-monorepo (NestJS + TypeScript + MongoDB). Spring Boot blueprint infrastructure is wired and ready for an active blueprint.
// Package.swift
dependencies: [
.package(url: "https://github.com/modelhike/modelhike.git", branch: "main")
]git clone https://github.com/modelhike/modelhike.git
cd modelhike
swift buildThe DevTester executable is the development harness for running the full pipeline:
swift run DevTesterNote:
DevTesterrequires amodelhike-blueprintscompanion repository cloned alongside this repo. SeeDevTester/Environment.swiftfor path configuration.
ModelHike ships with a browser-based visual debugger for inspecting pipeline runs โ a powerful tool for blueprint development and troubleshooting.
# Post-mortem: run pipeline, then inspect results
swift run DevTester --debug --debug-dev
# Live stepping: watch events stream in real time via WebSocket
swift run DevTester --debug-stepping --debug-devThen open http://localhost:4800 in your browser.
| Feature | Description |
|---|---|
| ๐๏ธ File Tree | Folder hierarchy of all generated files |
| ๐ช Split View | Template source alongside generated output |
| ๐ Event Trace | Click events to jump to source locations |
| ๐ Variable Inspector | Capture state at each generation point |
| ๐ณ Model Browser | Navigate containers โ modules โ entities |
| ๐งฎ Expression Eval | Test expressions in the footer |
| ๐ด Live Streaming | WebSocket events in stepping mode |
| โฏ๏ธ Stepper Panel | Breakpoints with step over/into/out |
| Flag | Description |
|---|---|
--debug |
Post-mortem mode โ pipeline runs first, then browse the session |
--debug-stepping |
Live mode โ server starts first, events stream over WebSocket |
--debug-port=<port> |
HTTP server port (default: 4800) |
--debug-dev |
Serve HTML from DevTester/Assets (for live UI edits) |
--no-open |
Don't auto-open the browser |
Full guide: Docs/debug/VISUALDEBUG.md
| Document | Description |
|---|---|
| ModelHike DSL Spec | Complete DSL syntax โ beginner to pro guide |
| Code Logic DSL | Fenced method-body logic blocks |
| TemplateSoup & SoupyScript | Template engine and scripting language |
| Documentation Hub | Index of all available docs |
| Debugging Guide | Debug flags, hooks, and techniques |
| Visual Debugger | Browser-based pipeline inspector |
| WebSocket Protocol | Live stepping message format |
| ADRs | Architecture decision records |
| Brand Guide | Naming, metaphor, tone |
| Status | Feature |
|---|---|
| โ | Complete DSL parser with containers, modules, classes, DTOs, UIViews, properties, methods, APIs |
| โ | 6-phase pipeline: Discover โ Load โ Hydrate โ Validate โ Render โ Persist |
| โ | TemplateSoup + SoupyScript engine with full scripting (loops, conditionals, modifiers) |
| โ | NestJS monorepo blueprint (TypeScript + MongoDB) |
| โ | Semantic validation with structured diagnostics |
| โ | World-class error messages with "did you mean?" suggestions |
| โ | Blueprint-defined modifiers with front-matter configuration |
| โ | Browser-based visual debugger with live stepping |
| โ | ~120+ test cases |
| โณ | Production CLI (modelhike generate, modelhike validate) |
| โณ | Spring Boot blueprint |
| โณ | VS Code extension |
| โณ | Plugin system for Transform phase |
| Pain Point | Traditional Approach | ModelHike Approach |
|---|---|---|
| Architecture drift | Confluence docs rot, tribal knowledge | Single source-of-truth .modelhike models |
| Boilerplate | Copy-paste patterns, reviews on plumbing | Templates generate proven patterns automatically |
| AI unpredictability | Opaque code suggestions | AI is optional; core generation is deterministic |
| Onboarding | Read thousands of files to understand the system | Read one .modelhike file to see the full domain |
ModelHike moves programming up a level โ from line-by-line code into systems thinking and intent-driven modelling. You define the what; templates handle the how.
And, just like a good hike, you always know where you are.
Need help or want to contribute?
ModelHike is open source and welcomes fellow explorers.
We're building ModelHike to be the most joyful, intuitive, and structured way to develop modern software, in the era of AI. Feel the flow, spark creativity, enjoy the journey... See you on the trail. ๐๏ธ
Built by engineers, for engineers. Describe your architecture once, generate confidently forever.