Structura
Next-generation code exploration for VS Code ⚡ Quick Start • Installation • Features • Usage • Shortcuts • Contributing New here? → Quick Start Guide — from install to exploring your codebase in 2 minutes.Note: if extension is not working please click
|
| Shortcut | Action |
|---|---|
Ctrl+Alt+G / Cmd+Alt+G |
Graph the active editor tab |
In-graph — Navigation
| Shortcut | Action |
|---|---|
Tab |
Select next visible node |
Shift+Tab |
Select previous visible node |
↑ ↓ ← → |
Jump to nearest node in that direction |
Space |
Fit / centre entire graph |
Esc |
Deselect all / close node inspector |
In-graph — Expansion
| Shortcut | Action |
|---|---|
Ctrl+Alt+E |
Expand selected node (depth 1) |
Ctrl+Alt+D |
Expand deep (depth 2) |
Ctrl+Alt+U |
Reveal who imports this node |
1 – 9 |
Show all nodes up to depth N |
In-graph — Node Actions
| Shortcut | Action |
|---|---|
Enter |
Open selected file in editor |
Ctrl+Alt+F |
Focus / zoom to selected node |
Ctrl+Alt+P |
Pin / unpin selected node |
Ctrl+Alt+H |
Hide selected node |
In-graph — History
| Shortcut | Action |
|---|---|
Ctrl+Alt+[ |
Time-travel back |
Ctrl+Alt+] |
Time-travel forward |
In-graph — Help
| Shortcut | Action |
|---|---|
? |
Toggle keyboard shortcut overlay |
Note: All in-graph shortcuts require the graph panel to have focus. Right-click any node for the same actions via context menu.
Architecture
High Level Architecture
Structura follows a layered architecture that separates concerns while enabling seamless language-agnostic code visualization.
Architectural Layers
Layer 1: VS Code Extension Layer (User Interface)
The presentation layer that interacts directly with developers through VS Code's extension API.
- Directory Walker - Recursively discovers source files in workspace
- Web View Panel - Renders interactive graph visualization using Cytoscape.js
- File Watcher - Monitors file system changes for real-time updates
- Command Handler - Processes VS Code commands and user interactions
- Status Bar - Shows current parsing state and quick actions
Layer 2: Structura Engine (Core Processing Middleware)
The brain of the system implementing the Chain of Responsibility pattern through a configurable pipeline.
Middleware Pipeline:
- File Reader → 2. Parser Selector → 3. AST Generator → 4. Graph Builder → 5. Weight Calculator → 6. State Persister
Key Subsystems:
- Child Process Manager - Executes parsers in isolated processes
- Normalization Pipeline - Normalize → Build → Weight → Persist
- Graph Slice Generator - Creates focused subgraphs for visualization
- Parser Registry - Manages language-specific parser implementations
- Semantic Normalizer - Maps language AST to universal semantic nodes
- Graph Builder - Constructs dependency graphs from semantic nodes
- Graph Expander - Extracts context-relevant subgraphs using policies
- State Storage - Manages graph persistence with checkpointing
- Expansion Policies - Configurable rules for graph traversal
Layer 3: Language-Specific Parser Layer
Pluggable parsers that convert source code to abstract syntax trees (ASTs).
Current Support:
- JavaScript Parser - Using @babel/parser
- TypeScript Parser - Using TypeScript compiler API
- Python Parser - Using Python's ast module via child process
- [+more] - Extensible through plugin system
Execution Model:
- Runs in child processes for isolation and crash protection
- Can run in-memory for performance-critical scenarios
- Language definitions configure semantic mapping and weights
Layer 4: Semantic Normalizer Foundation
The universal abstraction layer that makes Structura truly language-agnostic.
Core Components:
- Expected AST Contract - Language-to-universal node mapping
- Keyword Extractor - Identifies semantic keywords from code
- Graph Slice Schema - Standardized representation for visualization
- Language Definitions - Configurable mappings per language
Low Level Architecture
Structura implements Clean Architecture principles with a focus on SOLID design:
Core Domain Layer (Business Logic)
- Graph Models -
Graph,GraphNode,GraphEdgedomain entities - Semantic Models -
SemanticNode,SemanticIntentvalue objects - Expansion Policies - Business rules for graph traversal
- Language Definitions - Domain-specific language configurations
Application Layer (Use Cases)
- Processing Pipeline - Orchestrates the parse-normalize-build-weight-persist flow
- Graph Operations - Expand, find paths, detect cycles, calculate weights
- Parser Coordination - Manages parser execution and result aggregation
Interface Adapters (Ports & Adapters)
- Parser Registry - Adapter for language-specific parsers
- State Storage - Adapter for persistence (filesystem, memory, cloud)
- Visualizer - Adapter for rendering engines (Cytoscape.js, D3.js)
- Event System - Adapter for component communication
Infrastructure Layer (Frameworks & Drivers)
- VS Code Extension API - Platform-specific integration
- File System Access - OS-level file operations
- Child Process Management - Process isolation and IPC
- External Parser Libraries - Babel, TypeScript compiler, etc.
Key Architectural Patterns
Chain of Responsibility (Middleware Pipeline)
Each processing step (Handler) can process, modify, or pass along data, enabling flexible pipeline composition.
Ports & Adapters (Hexagonal Architecture)
Core business logic remains independent of external systems through defined interfaces.
Strategy Pattern (Language Parsers)
Interchangeable parser implementations following the ILanguageParser interface.
Observer Pattern (Real-time Updates)
File watchers and event listeners enable reactive architecture updates.
Factory Pattern (Component Creation)
Centralized creation of parsers, visualizers, and storage adapters.
Data Flow
VS Code Extension (UI)
↓
File Watcher + Directory Walker
↓
Parser Registry → Language Parser → AST Analysis
↓
Semantic Normalizer → Universal Semantic Nodes
↓
Graph Builder → Dependency Graph
↓
Weight Calculator → Weighted Graph
↓
State Storage ← → Graph Expander → Contextual Subgraph
↓
Visualizer (Cytoscape.js) → Interactive Visualization
Design Principles
- SOLID Compliance - Each component has single responsibility, open for extension
- Language Agnostic - Core works with any language through semantic normalization
- Real-time Reactive - Updates propagate instantly as code changes
- Performance First - Smart caching, incremental updates, parallel processing
- Extensible Core - Plugin system for new languages, visualizers, and analyzers
Project Structure
structura/
├── src/
│ ├── core/
│ │ ├── Directory.ts
│ │ ├── FileWatcher.ts
│ │ ├── TSParser.ts
│ │ ├── Visitors.ts
│ │ ├── Walker.ts
│ ├── extension.ts
│ ├── utilities # source code utilties
│ ├── parsers/
│ │ ├── executor.ts # ParserExecutor (spawns child processes)
│ │ ├── registry.ts # ParserRegistry (manages parsers)
│ │ ├── contract.ts # TypeScript interfaces for JSON contract
│ │ └── validator.ts # Validates parser output
│ ├── graph/
│ │ ├── builder.ts
│ │ ├── expander.ts
│ │ └── weights.ts
│ ├── storage/
│ │ └── filesystem.ts
│ └── ui/
│ ├── panel.ts
│ └── visualizer.ts
│
├── parsers/ # Native language parsers
│ │
│ ├── javascript/ # JavaScript/TypeScript parser
│ │ └── parse # Executable entry point
│ │
│ ├── python/ # Python parser
│ │ └── parse # Executable: #!/usr/bin/env python3
│ │
│ ├── go/ # Go parser
│ │ └── parse # Compiled binary
│ │
│ ├── rust/ # Rust parser
│ │ └── parse # Compiled binary
│ │
│ └── java/ # Java parser
│ └── parse # Launch script
│
├── definitions/ # Language semantic mappings
│ ├── javascript.json
│ ├── python.json
│ ├── go.json
│ ├── rust.json
│ └── java.json
│
├── test
│ ├── extension.test.ts
│ ├── unit # unit tests
│ ├── e2e # integration tests
├── scripts/
│ ├── build-parsers.sh # Build all parsers
│ ├── test-parsers.sh # Test all parsers
│ └── package-parsers.sh # Package parsers for distribution
│
├── package.json # Extension manifest
├── tsconfig.json
└── README.md
Development
Prerequisites
- Node.js v25.2.1 and npm
- VS Code 1.80+
Setup
# Clone repository
git clone https://github.com/yourusername/structura.git
cd structura
# Install dependencies
npm install
# Open in VS Code
code .
Running the Extension
- Press
F5to launch Extension Development Host - Open any project folder
- Activate Structura via status bar or Command Palette
Building
# Compile TypeScript
npm run build
# Watch for changes
npm run watch
# Run tests
npm run test
# Package extension
npm run package
Contributing a Parser
To add support for a new language:
- Create language definition in
definitions/[language].json - Implement
ILanguageParserinterface - Register parser in
ParserRegistry - Add tests
See CONTRIBUTING.md for detailed guidelines.
Roadmap
Phase 1: MVP (Current - v0.1.0)
- [x] JavaScript/TypeScript parsing
- [x] Interactive graph visualization
- [x] Basic keyboard navigation
- [x] Real-time file tracking
- [x] State persistence
Phase 2: Intelligence (v0.2.0 - Q2 2025)
- [ ] LLM-powered edge descriptions
- [ ] Circular dependency detection
- [ ] Dead code identification
- [ ] Architecture anti-pattern warnings
- [ ] Smart refactoring suggestions
Phase 3: Multi-Language (v0.3.0 - Q3 2025)
- [ ] Python support
- [ ] Go support
- [ ] Rust support
- [ ] Java support
- [ ] Generic parser framework
Phase 4: Enhanced UX (v0.4.0 - Q4 2025)
- [ ] Full Vim-style navigation
- [ ] Advanced filtering
- [ ] Graph export (PNG, SVG, Mermaid)
- [ ] Custom themes
- [ ] Share graph views
Phase 5: Documentation (v0.5.0 - Q1 2026)
- [ ] File-to-doc mapping
- [ ] Auto-generate docs from graph
- [ ] JSDoc/docstring integration
- [ ] Documentation coverage heatmap
Phase 6: Collaboration (v0.6.0 - Q2 2026)
- [ ] Git integration
- [ ] Team annotations
- [ ] Code review mode
- [ ] Shared graph exploration
Contributing
We welcome contributions! Structura is designed for both user and contributor joy.
Areas We Need Help
- Parser Development: Add support for Python, Go, Rust, Java
- Testing: Write tests for edge cases and real-world codebases
- Documentation: Improve guides and examples
- Performance: Optimize for larger codebases
- UI/UX: Design improvements and new features
How to Contribute
Important : checkout Parsers
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests
- Commit with clear messages (
git commit -m 'Add Python parser') - Push to your fork (
git push origin feature/amazing-feature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines.
Technology Stack
- Runtime: Node.js
- Language: TypeScript
- Extension API: VS Code Extension API
- AST Parsing:
- JavaScript/TypeScript:
@babel/parser, TypeScript Compiler API - Python (planned): Python
astmodule via child process
- JavaScript/TypeScript:
- Graph Theory: Cytoscape.js
- UI: HTML, CSS, Webview API
- Future: Tree-sitter for universal language support
Performance
Structura is optimized for speed and responsiveness:
- Incremental parsing: Only re-parses changed files
- Smart caching: Avoids redundant AST generation
- Parallel processing: Utilizes multiple CPU cores
- Lazy loading: On-demand graph expansion
- Virtual rendering: Handles 10,000+ node graphs smoothly
Benchmarks (Target)
- Parse 1,000-file codebase: < 30 seconds
- Load graph visualization: < 1 second
- Expand node: < 100ms
- Switch files: < 50ms
- Memory usage: < 200MB for 10,000 nodes
FAQ
Q: Does Structura work with monorepos?
A: Yes! Configure structura.baseDirectory to target specific packages, or use multiple instances.
Q: Can I use Structura with large codebases (10,000+ files)?
A: Yes, Structura uses smart caching and incremental parsing. Initial analysis may take a few minutes, but subsequent updates are fast.
Q: Does Structura require internet access?
A: No. Structura works entirely offline. LLM features (planned) are optional and require API keys.
Q: How does Structura compare to [other tool]?
A: Structura is unique in its semantic-first, language-agnostic approach and keyboard-first UX. Most tools are language-specific or mouse-dependent.
Q: Can I export graphs to share with my team?
A: Export features (PNG, SVG, Mermaid) are planned for v0.4.0.
Q: Is there a CLI version?
A: Not yet, but it's on the roadmap for CI/CD integration and automated documentation.
Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: support@structura.dev
- Twitter: @StructuraDev
License
MIT License - see LICENSE for details.
Acknowledgments
Structura stands on the shoulders of giants:
- Neovim - Keyboard-first philosophy
- Cytoscape.js - Graph visualization
- Babel - JavaScript parsing
- VS Code - Extensibility platform
- Tree-sitter - Future language support
Special thanks to all contributors who make Structura better every day.
Built with ❤️ by developers, for developers
Making code exploration delightful, one graph at a time