Development Guide
Project Overview
Lobster is an intelligent web application stress testing tool that automatically discovers URLs through crawling and validates performance under concurrent load.
Repository: https://github.com/1mb-dev/lobster Version: 2.0.0 License: MIT
What Makes Lobster Different
- Crawler-First: Automatically discovers URLs (unlike ab, wrk, hey, vegeta)
- Validation-Focused: Pass/fail criteria vs raw metrics (unlike k6, JMeter)
- Zero-Config: Works out of the box (unlike enterprise tools)
- Smart Rate Limiting: Uses goflow token bucket to respect server capacity
- Security Hardened: SSRF protection, secure credential handling
Architecture
Clean Architecture Layers
cmd/lobster/ # CLI entry point, flag parsing
│
internal/cli/ # CLI utilities, auth handling
│
internal/config/ # Configuration loading and merging
│
internal/domain/ # Core entities and types
│
├── internal/crawler/ # URL discovery
├── internal/tester/ # Load testing engine
├── internal/reporter/ # Report generation
├── internal/validator/ # Performance validation
├── internal/robots/ # robots.txt parsing
└── internal/util/ # Shared utilities (URL validation, sanitization)
Component Responsibilities
| Package | Purpose |
|---|---|
domain/ |
Core business entities (TestResults, URLTask, Config) |
crawler/ |
URL discovery, link extraction, deduplication |
tester/ |
Load testing engine, worker pool, rate limiting |
reporter/ |
HTML/JSON/console report generation |
validator/ |
Performance target validation |
config/ |
Configuration file loading and merging |
cli/ |
CLI utilities, auth handling, stdin reading |
robots/ |
robots.txt parsing with wildcard support |
util/ |
URL validation, error sanitization |
Development Workflow
Setup
git clone https://github.com/1mb-dev/lobster.git
cd lobster
go mod download
make build
./lobster -url http://localhost:3000 -allow-private-ips
See Makefile for all build targets: make help
Running Tests
make test # Fast tests only
make test-verbose # Full suite with output
make coverage # Coverage report
make lint # Run golangci-lint
See testing for the complete testing guide.
Key Implementation Details
Rate Limiting
Uses goflow’s token bucket for smooth rate limiting:
rateLimiter, err = bucket.NewSafe(bucket.Limit(config.Rate), burst)
if err := t.rateLimiter.Wait(ctx); err != nil {
// Handle cancellation
}
Burst capacity: 2x the rate per second allows short bursts while maintaining overall limit.
URL Discovery
// Pattern: href=["']([^"']+)["']
// Handles: <a href="..."> extraction
// Filters: javascript:, mailto:, # links
// Resolves: Relative URLs to absolute
// Dedupes: sync.Map for discovered URLs
Concurrent Testing
// Worker pool pattern
for i := 0; i < concurrency; i++ {
wg.Add(1)
go t.worker(ctx, &wg)
}
// Thread-safe result collection
validationsMutex.Lock()
t.results.URLValidations = append(...)
validationsMutex.Unlock()
Key Dependencies
goflow (v1.0.3)
- Purpose: Token bucket rate limiting
- Location:
internal/tester/tester.go
Common Tasks
Adding a Feature
- Update domain models in
internal/domain/ - Implement logic in appropriate package (
tester/,crawler/, etc.) - Add tests achieving 70%+ coverage
- Update CLI flags in
cmd/lobster/main.go - Document in README.md and relevant docs
Release Checklist
- Update version in
cmd/lobster/main.go - Update
CHANGELOG.mdwith changes - Run all tests:
go test ./... - Build for all platforms
- Create git tag:
git tag -a vX.Y.Z -m "Release vX.Y.Z" - Push tag:
git push origin vX.Y.Z - Create GitHub release with binaries
Key Files
cmd/lobster/main.go # CLI entry point
internal/cli/ # CLI utilities
internal/tester/ # Core testing engine
internal/crawler/ # URL discovery
internal/reporter/ # Report generation
internal/domain/ # Business entities
internal/util/ # URL validation, sanitization
Makefile # Build targets
.golangci.yml # Linter config
Git Workflow
Commit Message Format
type(scope): description
[optional body]
[optional footer]
Types: feat, fix, docs, style, refactor, test, chore
Examples:
feat(auth): add cookie-based authentication support
fix(crawler): handle malformed URLs gracefully
docs(readme): update installation instructions
Branch Strategy
main: Stable, releasable codefeature/*: New featuresfix/*: Bug fixesdocs/*: Documentation updates
Troubleshooting
Out of Memory
Symptoms: Process killed, OOM errors
Fix: Reduce -max-depth, lower -queue-size, or use -dry-run to preview URL count first
High Error Rate
Symptoms: Many 429 or timeout errors
Fix: Reduce -concurrency, lower -rate, increase -timeout
No URLs Discovered
Symptoms: Only tests base URL
Fix: Check HTML has <a> links, verify -follow-links=true, ensure same domain
Resources
Contact
- Issues: https://github.com/1mb-dev/lobster/issues
- Discussions: https://github.com/1mb-dev/lobster/discussions
- Pull Requests: Welcome! See contributing