Project: pattern-edit
Location: ../pattern-edit (peer directory to gram-rs)
Language: Rust
Framework: Leptos
Created: 2026-01-08
This document describes how to initialize the pattern-edit proof-of-concept application. It covers only the setup steps needed to create a working project structure—not implementation details or feature development.
Comprehensive technical documentation is available in the docs/ directory:
- Pattern Data Structure - Complete reference for
Pattern<V>type - Subject Data Type - Reference for
Subjectand value types - Gram Notation Syntax - Complete gram syntax reference
- gram-codec API - Parsing and serialization API
- gram-lint CLI - Syntax validation tool
- gramref CLI - Test generation and reference implementation tool
See docs/README.md for documentation index and quick reference.
- Rust toolchain (stable) with cargo
- wasm32-unknown-unknown target installed
- trunk (for building and serving Leptos applications)
- gram-rs project available in peer directory
Create the following directory structure:
pattern-edit/
├── Cargo.toml
├── index.html
├── src/
│ ├── main.rs
│ ├── lib.rs
│ └── app.rs
└── README.md
cd /Users/akollegger/Developer/gram-data
cargo new pattern-edit --bin
cd pattern-editAdd the following dependencies:
[package]
name = "pattern-edit"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
# Leptos and web dependencies
leptos = { version = "0.7", features = ["csr"] }
leptos_meta = { version = "0.7", features = ["csr"] }
leptos_router = { version = "0.7", features = ["csr"] }
# WASM and browser APIs
wasm-bindgen = "0.2"
web-sys = { version = "0.3", features = ["Storage"] }
console_error_panic_hook = "0.1"
# gram-rs dependency (local path)
gram-codec = { path = "../gram-rs/crates/gram-codec" }
pattern-core = { path = "../gram-rs/crates/pattern-core" }
# Serialization
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"Ensure the WASM target is installed:
rustup target add wasm32-unknown-unknownIf not already installed:
cargo install trunkCreate a minimal HTML file for Trunk to use as entry point:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pattern Edit</title>
</head>
<body>
</body>
</html>src/main.rs: Entry point for CSR (Client-Side Rendering)
pub fn main() {
// Entry point for client-side rendering
}src/lib.rs: Library exports
pub mod app;src/app.rs: Root application component
use leptos::*;
#[component]
pub fn App() -> impl IntoView {
view! {
<div>
<h1>"Pattern Edit"</h1>
</div>
}
}Document basic project information:
# Pattern Edit
A proof-of-concept application for editing graph patterns using gram notation.
## Features
- Read/write gram files
- Import CSV data
- Edit, create, and delete patterns
- Pattern navigation
## Development
```bash
trunk serveOpens development server at http://localhost:8080
trunk build --releaseOutputs to dist/ directory.
### 8. Verify Setup
Run the development server to verify initialization:
```bash
trunk serve
The application should compile and be accessible at http://localhost:8080.
After successful initialization:
- Verify gram-rs dependency resolution
- Create basic component structure for pattern operations
- Implement pattern storage using browser LocalStorage
- Design pattern navigation UI/UX
The project depends on the following gram-rs crates:
- gram-codec: For parsing and encoding gram notation
- pattern-core: For pattern data structures and operations
Ensure gram-rs is built before developing pattern-edit:
cd ../gram-rs
cargo build- Uses Leptos CSR (Client-Side Rendering) mode for simplicity
- WASM compilation target for browser execution
- Local path dependencies to gram-rs (requires peer directory structure)
- No server-side components in initial setup
- Browser LocalStorage for persistence (no backend)
The project is correctly initialized when:
cargo checkcompletes without errorstrunk servestarts development server successfully- Browser displays "Pattern Edit" heading at localhost:8080
- gram-rs crates resolve from peer directory