Skip to content

devDariush/dariushdev-sveltekit

Repository files navigation

Terminal Interface

A fully-featured terminal interface built with SvelteKit 5, featuring progressive enhancement, Cloudflare KV storage, markdown rendering, and comprehensive test coverage.

🌐 Live Demo: https://dariush.dev

✨ Features

  • 🎨 ANSI Color Support - Full 16-color ANSI code parsing
  • 🌓 Dark/Light Mode - System preference detection with manual toggle
  • 📝 Markdown Rendering - Read and display markdown files with syntax highlighting
  • 📁 File System - Browse and read files with cat and ls commands
  • 🔗 Clickable Links - Execute commands or open URLs from terminal output
  • 🚀 Progressive Enhancement - Full functionality without JavaScript
  • ☁️ Cloudflare KV Storage - Unlimited command history with session management
  • Real-time Persistence - History saved after every command (JS mode)
  • 🧪 Comprehensive Tests - Full test coverage with Vitest
  • 🎯 TypeScript - Full type safety throughout
  • Accessible - WCAG compliant with keyboard navigation

🚀 Quick Start

# Install dependencies
npm install

# Start development server
npm run dev

# Run tests
npm run test:unit

# Build for production
npm run build

📖 Documentation

🏗️ Architecture

Progressive Enhancement

Without JavaScript:

  • Server-side rendering with full terminal history
  • HTML form-based command execution
  • Cookie persistence for theme and limited history
  • Submit button for command execution

With JavaScript:

  • Client-side terminal component with smooth interactions
  • AJAX form submissions (no page reloads)
  • Real-time history persistence to Cloudflare KV
  • Auto-focus input with custom cursor
  • Enhanced link interactions

Storage Strategy

  • Session Management: UUID-based sessions with secure cookies
  • Command History: Cloudflare KV (production) or cookies (dev)
  • Theme Preference: Cookie storage for instant loading
  • Automatic Fallback: Cookie-based storage in local development

🧪 Testing

# Run unit tests
npm run test:unit

# Run e2e tests
npm run test:e2e

# Run all tests
npm test

Test Coverage: Comprehensive test suite covering commands, ANSI parsing, session management, file operations, and API endpoints. See docs/TEST_COVERAGE.md for details.

📦 Deployment

Cloudflare Pages

See docs/CLOUDFLARE_DEPLOYMENT.md for complete deployment instructions.

# Build and deploy
npm run deploy

Test Production Build Locally

# Build and run with Wrangler (local KV)
npm run preview

🛠️ Tech Stack

  • Framework: SvelteKit 5 with Runes
  • Styling: Tailwind CSS v4
  • Storage: Cloudflare KV
  • Markdown: marked
  • Testing: Vitest + Playwright
  • Deployment: Cloudflare Pages
  • Language: TypeScript (strict mode)

About

(Alpha) My upcoming kewl new personal landing page :3

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Contributors