Project: Walrus Starter Kit Generated: 2026-01-24 (Updated with Reorganization Analysis) Version: 0.1.5 Status: Core MVP Ready + Enoki Beta Integration
Walrus Starter Kit is a monorepo containing create-walrus-app, an interactive CLI tool for scaffolding production-ready Walrus applications on Sui. It uses a preset-based architecture with pre-built templates for rapid scaffolding, supporting multiple SDKs, frameworks, and use cases.
- CLI engine AND complete application templates coexist in
packages/cli/ - Build artifacts (
dist/) committed to version control - Test applications (
my-test-app/,pkg-test/) mixed with production code
templates/(legacy reference layers) andpackages/cli/presets/(production presets) both exist- Architecture docs state templates are reference-only, but both systems maintained
- Mix of kebab-case and camelCase naming
- Development artifacts scattered throughout source directories
- Large planning directory (260+ files) may overwhelm contributors
- Build artifacts should be gitignored
- Test apps belong in development tools, not source code
- Empty
examples/directory serves no purpose
walrus-starter-kit/
├── packages/
│ ├── cli/ # CLI engine only
│ │ ├── src/ # CLI source code
│ │ └── scripts/ # Template validation
│ └── templates/ # Pre-built presets (moved from cli/presets)
│ ├── react-mysten-simple-upload/
│ ├── react-mysten-gallery/
│ └── react-mysten-simple-upload-enoki/
├── templates/ # Legacy reference layers (unchanged)
├── tools/ # Development tools
│ ├── test-apps/ # Test applications (moved from cli/)
│ └── validation/ # Template validation scripts
├── docs/ # Documentation (unchanged)
└── examples/ # Generated outputs (populate or remove)
- Clear Separation: CLI logic separate from application templates
- Logical Grouping: Related functionality grouped together
- Reduced Complexity: Remove build artifacts and test apps from source
- Better DX: Cleaner directory structure for contributors
- Update all file references and import paths
- Modify build scripts and package configurations
- Update documentation and CI/CD pipelines
- Ensure backward compatibility for existing installations
The project transitioned from a layer-based template system to a preset-based architecture for better reliability and maintainability. Each preset is a complete, pre-validated template combination.
- Location:
packages/cli/presets/ - Pattern: Pre-built complete templates (no runtime merging)
- Validation: Each preset independently tested and validated
- Available Presets:
react-mysten-simple-upload- Simple file upload/downloadreact-mysten-gallery- Multi-file gallery with localStoragereact-mysten-simple-upload-enoki- Upload with zkLogin (Beta)
- Location:
templates/(maintained for documentation) - Pattern: Modular layers (base + sdk + framework + use-case)
- Status: Superseded by presets but kept for reference
walrus-starter-kit/
├── packages/cli/ # ⚠️ MIXED: CLI engine + presets + test apps
│ ├── src/ # ✅ CLI source code
│ ├── presets/ # ⚠️ Should be separate package
│ ├── my-test-app/ # ❌ Development artifact in source
│ ├── pkg-test/ # ❌ Development artifact in source
│ └── dist/ # ❌ Build artifacts (should be gitignored)
├── templates/ # ✅ Legacy reference layers
├── docs/ # ✅ Documentation
├── examples/ # ⚠️ Empty directory
└── plans/ # ⚠️ 260+ files, may overwhelm
walrus-starter-kit/
├── packages/
│ ├── cli/ # ✅ CLI engine only
│ │ ├── src/ # CLI source code
│ │ └── scripts/ # Template validation
│ └── templates/ # ✅ Pre-built presets (moved)
│ ├── react-mysten-simple-upload/
│ ├── react-mysten-gallery/
│ └── react-mysten-simple-upload-enoki/
├── templates/ # ✅ Legacy reference layers (unchanged)
├── tools/ # ✅ Development tools (new)
│ ├── test-apps/ # Test applications (moved)
│ └── validation/ # Template validation scripts
├── docs/ # ✅ Documentation (unchanged)
└── examples/ # ⚠️ Generated outputs (populate/remove)
packages/cli/src/
├── index.ts # Entry point with Commander
├── context.ts # Context builder (args + prompts)
├── matrix.ts # SDK/framework compatibility
├── generator/ # Project generation engine
│ ├── index.ts # Generation orchestrator
│ ├── file-ops.ts # File operations + env setup
│ └── transform.ts # Variable replacement
└── post-install/ # Post-generation automation
├── index.ts # Orchestrator
├── package-manager.ts # PM detection/install
├── validator.ts # Project validation
└── messages.ts # Success/error UI
walrus-starter-kit/ ├── packages/cli/ # CLI engine and presets │ ├── src/ # CLI source code │ │ ├── index.ts # Entry point with Commander │ │ ├── context.ts # Context builder (args + prompts) │ │ ├── matrix.ts # SDK/framework compatibility │ │ ├── generator/ # Project generation engine │ │ │ ├── index.ts # Generation orchestrator │ │ │ ├── file-ops.ts # File operations + env setup │ │ │ └── transform.ts # Variable replacement │ │ └── post-install/ # Post-generation automation │ │ ├── index.ts # Orchestrator │ │ ├── package-manager.ts # PM detection/install │ │ ├── validator.ts # Project validation │ │ └── messages.ts # Success/error UI │ ├── presets/ # Pre-built templates │ │ ├── react-mysten-simple-upload/ │ │ ├── react-mysten-gallery/ │ │ └── react-mysten-simple-upload-enoki/ │ └── scripts/ │ └── test-templates.sh # Automated validation ├── templates/ # Reference template layers │ ├── base/ # Core config + StorageAdapter │ ├── sdk-mysten/ # @mysten/walrus adapter │ ├── enoki/ # Enoki zkLogin layer │ ├── react/ # React framework │ ├── simple-upload/ # Upload use case │ └── gallery/ # Gallery use case ├── docs/ # Project documentation ├── examples/ # Generated test outputs └── plans/ # Implementation plans + reports
## 4. CLI Engine Components
### Entry Point (`src/index.ts`)
- Commander.js setup for argument parsing
- SIGINT handling for cleanup on Ctrl+C
- Hybrid mode: interactive wizard or CI/CD flags
- Interrupt-safe project generation
### Context Builder (`src/context.ts`)
- Merges CLI arguments and prompt responses
- Runtime validation with detailed error messages
- Auto-resolves project absolute path
- Default values for optional fields
### Compatibility Matrix (`src/matrix.ts`)
- Defines SDK/framework/use-case combinations
- Enforces valid preset selections
- Metadata for SDK descriptions and docs
**Matrix Contents:**
```typescript
{
mysten: {
frameworks: ['react', 'vue', 'plain-ts'],
useCases: ['simple-upload', 'gallery', 'defi-nft']
},
tusky: { frameworks: ['react', 'vue', 'plain-ts'], useCases: ['simple-upload', 'gallery'] },
hibernuts: { frameworks: ['react', 'plain-ts'], useCases: ['simple-upload'] }
}
Orchestrator (index.ts):
- Resolves preset path from context
- Copies preset template to target directory
- Transforms variables in template files
- Auto-copies
.env.example→.env - Atomic rollback on errors or SIGINT
File Operations (file-ops.ts):
- Cross-platform directory copying
- Environment file setup with dry-run support
- Path traversal security checks
- Non-critical error handling for env setup
Transformation (transform.ts):
- Mustache-style variable replacement (
{{projectName}}) - Applies to
.ts,.tsx,.json,.md,.html,.env.example - Context variables:
projectName,sdk,framework, etc.
Orchestrator (index.ts):
- Manages dependency installation
- Runs project validation
- Displays success/error messages
- Skip flags:
--skip-install,--skip-validation
Package Manager (package-manager.ts):
- Auto-detects npm/pnpm/yarn/bun
- Executes install with streaming output
- Command injection hardening
Validator (validator.ts):
- Checks
package.jsonintegrity - Verifies
node_modulesexistence - Runs TypeScript compilation (
tsc --noEmit) - Multi-step validation reporting
Messages (messages.ts):
- Success UI with next steps
- Error recovery instructions
- Colored console output (kleur)
Each preset is a complete, standalone template with:
react-mysten-simple-upload/
├── src/
│ ├── lib/walrus/ # Walrus SDK integration
│ │ ├── client.ts # Singleton WalrusClient
│ │ ├── adapter.ts # StorageAdapter implementation
│ │ └── types.ts # Type definitions
│ ├── providers/ # React context providers
│ │ ├── QueryProvider.tsx
│ │ └── WalletProvider.tsx
│ ├── hooks/ # TanStack Query hooks
│ │ ├── use-upload.ts
│ │ ├── use-download.ts
│ │ └── use-wallet.ts
│ ├── components/ # UI components
│ │ ├── features/ # Feature components
│ │ └── layout/ # Layout components
│ ├── utils/ # Utilities
│ │ ├── env.ts # Zod env validation
│ │ └── mime-type.ts # MIME detection
│ ├── App.tsx # Root component
│ └── main.tsx # Entry point
├── scripts/
│ ├── run-portal.sh # Local Walrus portal
│ └── setup-walrus-deploy.sh # Sites deployment
├── .env.example # Environment template
├── package.json # Dependencies
├── vite.config.ts # Vite configuration
├── tsconfig.json # TypeScript config
└── README.md # Setup instructions
Status: Testnet Stable
Implementation: src/lib/walrus/adapter.ts in each preset
API Pattern: Object-based parameters
// Upload
await client.writeBlobToUploadRelay({ blob, nEpochs, signer });
// Download
await client.readBlob({ blobId });
// Metadata (V1 structure)
const response = await client.getBlobMetadata({ blobId });
const size = response.metadata.V1.unencoded_length;Signer Integration:
- Upload requires connected wallet
- Signer injected from
@mysten/dapp-kituseCurrentAccount() - Read operations work without wallet
Status: Beta (Scaffolding Complete, Logic Pending)
Implementation: src/lib/enoki/ + src/providers/EnokiProvider.tsx
Features:
- zkLogin via Google OAuth
- SessionStorage adapter with SSR guards
- Dual-auth flow (zkLogin + standard wallets)
Pending Implementation:
- Constants & Zod validation (Phase 02)
- EnokiProvider & Auth flow (Phase 03)
- CLI matrix integration (Phase 04)
- Tusky (
@tusky-io/ts-sdk) - Community SDK - Hibernuts (
@hibernuts/walrus-sdk) - Alternative SDK
<QueryProvider>
{' '}
// TanStack Query
<WalletProvider>
{' '}
// Sui wallet + network
<EnokiProvider>
{' '}
// zkLogin (Enoki presets only)
<App />
</EnokiProvider>
</WalletProvider>
</QueryProvider>Storage Hooks (use-upload.ts, use-download.ts):
- Wrap
StorageAdaptermethods in TanStack Query useMutationfor writes (upload)useQueryfor reads (download, metadata)- Auto-inject wallet signer for uploads
Wallet Hook (use-wallet.ts):
- Access current account from
@mysten/dapp-kit - Network configuration
- Connection state
Base Interface:
interface StorageAdapter {
upload(data: File | Uint8Array, options?: UploadOptions): Promise<string>;
download(blobId: string): Promise<Uint8Array>;
delete(blobId: string): Promise<void>;
getMetadata(blobId: string): Promise<BlobMetadata>;
}Mysten Implementation:
- Uses singleton
WalrusClientfromclient.ts - Object-based SDK calls
- V1 metadata structure validation
- Signer required for uploads
- Runtime: Node.js (ESM)
- Build: TypeScript Compiler (strict mode)
- Testing: Vitest (91/91 tests, 97.5% coverage)
- CLI Libs: commander ^11.1.0, prompts ^2.4.2, kleur ^4.1.5
- File Ops: fs-extra ^11.2.0, cross-spawn ^7.0.6
- UI: React 18.2.0 (Hooks, Suspense)
- Build: Vite 5.0.11 (HMR, Fast Refresh)
- State: TanStack Query 5.17.0
- Sui: @mysten/dapp-kit 0.14.0, @mysten/sui 1.10.0
- Language: TypeScript 5.3.3 (strict mode, ES2022)
- Linting: ESLint 8.56 + React plugins
- Auto-copies
.env.example→.envafter generation - Non-critical error handling (warns but doesn't fail)
- Dry-run support for testing
- Package manager auto-detection
- Automatic dependency installation
- TypeScript compilation validation
- Success/error messaging with next steps
- Automated testing via
scripts/test-templates.sh - Validates all preset combinations
- Checks generation, install, compilation
- Security hardening against command injection
- Path traversal prevention in project names
- NPM naming compliance validation
- Length limits (214 chars)
- Absolute path rejection
Completed:
- ✅ CLI Engine MVP (Phases 1-9)
- ✅ React + Mysten SDK presets (simple-upload, gallery)
- ✅ Automated testing infrastructure
- ✅ Post-install automation + validation
- ✅ Enoki scaffolding + documentation (Phase 10.01, 10.05)
- ✅ TypeScript build fixes for all presets
In Progress:
- 🚧 Enoki provider implementation (Phase 10.02-10.04)
Planned:
- ⏳ Vue.js framework support
- ⏳ Plain TypeScript templates
- ⏳ Tusky/Hibernuts SDK integration
- ⏳ Walrus Sites deployment integration
Unit Tests:
- Co-located with source files (
*.test.ts) - Vitest test runner
- 97.5% coverage across CLI engine
Integration Tests:
packages/cli/scripts/test-templates.sh- End-to-end preset generation
- Dependency install + TypeScript compilation
- Validates 5+ template combinations
CI/CD:
- GitHub Actions workflows
- Automated release via semantic-release
- Conventional commits enforcement
docs/
├── project-overview-pdr.md # Product requirements
├── system-architecture.md # Technical architecture
├── code-standards.md # Coding conventions
├── project-roadmap.md # Implementation phases
├── codebase-summary.md # This file
├── design-guidelines.md # UI/UX standards
└── wireframes/ # Design mockups
- Framework Support: Only React is production-ready; Vue and Plain TS are planned
- SDK Support: Only Mysten SDK is fully stable; Enoki is beta, others are planned
- Preset Expansion: Limited to 3 presets; more combinations coming
- Git Automation: Removed to reduce complexity (users manage manually)
Layer-Based → Preset-Based:
- Originally designed as runtime layer merging
- Migrated to pre-built presets for reliability
- Templates maintained for reference and documentation
Git Initialization:
- Originally auto-initialized git repos
- Deprecated in v0.1.3 to reduce post-install complexity
Enoki Integration:
- Added in v0.1.4 as new authentication method
- Scaffolding complete, logic implementation pending
# Remove committed dist directories
rm -rf packages/cli/dist/
# Update .gitignore (already includes dist/)# Relocate development test apps
mkdir -p tools/test-apps/
mv packages/cli/my-test-app/ tools/test-apps/
mv packages/cli/pkg-test/ tools/test-apps/# Create separate templates package
mkdir -p packages/templates/
mv packages/cli/presets/* packages/templates/
# Update pnpm-workspace.yaml and package references# Move validation scripts to tools/
mkdir -p tools/validation/
mv packages/cli/scripts/test-templates.sh tools/validation/# Move old plans to archive (keep recent active plans)
mkdir -p plans/archive/
# Move plans older than 30 days to archive- Either populate with real examples or remove empty directory
- Consider integrating with CI/CD to generate fresh examples
- Audit and standardize kebab-case vs camelCase usage
- Update all references consistently
- Run full test suite (
pnpm test) - Verify all presets generate correctly
- Backup current working state
- Update all import paths and references
- Clean build artifacts
- Move test applications to
tools/test-apps/ - Create
packages/templates/and move presets - Update
packages/cli/src/generator/layers.tspreset paths - Update
pnpm-workspace.yaml - Move validation scripts to
tools/validation/
- Run full test suite
- Test preset generation with all combinations
- Update CI/CD pipelines
- Update documentation references
- Verify npm package still builds correctly
- Maintainability: Clear separation of concerns
- Developer Experience: Logical file placement
- CI/CD Efficiency: No build artifacts in version control
- Package Size: Smaller CLI package (engine only)
- Scalability: Easy to add new templates without bloating CLI
- Backward Compatibility: Ensure existing installations continue working
- Path Updates: Comprehensive search/replace for all file references
- Testing: Full integration testing before/after migration
- Documentation: Update all docs and README files
- Total Files: 502 files
- Total Tokens: 503,349 tokens
- Planning Documents: 260+ files (~100K tokens)
- CLI Tests: 91/91 passing (97.5% coverage)
- Security: No sensitive data detected
- Build Status: All presets compile successfully