Skip to content

ethaneng/ssh-portfolio

Repository files navigation

SSH Portfolio

A unique terminal-based portfolio application that users can access via SSH. Built with Go using the Charm ecosystem (Bubbletea, Lipgloss, Wish) for an authentic terminal experience.

Features

  • SSH Access: Users can literally SSH into your portfolio
  • Interactive TUI: Clean, responsive terminal interface
  • 3-Panel Layout: Header navigation, sidebar sections, and main content
  • Smooth Navigation: Tab cycling, vim keys, and hotkey support
  • Rate Limiting: Built-in protection against abuse
  • Session Management: Tracks and manages concurrent connections
  • Security: Rate limiting, session timeouts, and connection monitoring

Quick Start

Prerequisites

  • Go 1.21 or higher
  • SSH client for testing

Installation

  1. Clone the repository:
git clone <your-repo-url>
cd ssh-portfolio-claude
  1. Install dependencies:
make deps
  1. Generate SSH host key for development:
make generate-key
  1. Build and run:
make run

The server will start on localhost:2222 by default.

Testing the Application

Connect to your portfolio via SSH:

ssh -p 2222 localhost

Navigation

Key Bindings

  • Tab: Cycle between header, sidebar, and content areas
  • 1-4: Quick page navigation (About, Experience, Projects, Contact)
  • h/j/k/l or Arrow Keys: Navigate within focused area
  • Enter: Select items in sidebar
  • q or Ctrl+C: Quit

Layout

┌─────────────────── Header Navigation ──────────────────────┐
│ 1. About    2. Experience    3. Projects    4. Contact     │
├──────────┬──────────────────────────────────────────────────┤
│ Sidebar  │                                                  │
│          │                                                  │
│ • Item 1 │               Main Content                       │
│ • Item 2 │                                                  │
│ • Item 3 │                                                  │
│          │                                                  │
└──────────┴──────────────────────────────────────────────────┘

Configuration

The application can be configured via environment variables:

Server Configuration

  • SSH_HOST: Server host (default: 0.0.0.0)
  • SSH_PORT: Server port (default: 2222)
  • SSH_HOST_KEY_PATH: Path to SSH host key (default: ./ssh_host_key)

Security Configuration

  • SSH_MAX_SESSIONS: Maximum concurrent sessions (default: 100)
  • RATE_LIMIT_RPM: Requests per minute per IP (default: 60)
  • RATE_LIMIT_BURST: Burst size for rate limiting (default: 10)
  • SESSION_TIMEOUT: Session timeout duration (default: 30m)

Application Configuration

  • APP_NAME: Application name (default: SSH Portfolio)
  • APP_VERSION: Application version (default: 1.0.0)
  • DEBUG: Enable debug logging (default: false)

Development

Development Tools

Install development tools:

make install-tools

Development Workflow

  1. Hot Reload Development:
make dev
  1. Format Code:
make format
  1. Lint Code:
make lint
  1. Run Tests:
make test
  1. Test Coverage:
make test-coverage

Project Structure

ssh-portfolio/
├── cmd/server/          # Application entry point
├── internal/
│   ├── config/          # Configuration management
│   ├── data/            # Data layer and portfolio content
│   ├── domain/          # Domain models and types
│   ├── errors/          # Error handling
│   ├── logger/          # Logging utilities
│   ├── middleware/      # SSH middleware (security, rate limiting)
│   ├── server/          # SSH server implementation
│   └── ui/              # TUI components (Bubbletea models, views, styles)
├── keys/                # SSH host keys (generated)
├── bin/                 # Built binaries
├── Makefile            # Build and development commands
└── README.md           # This file

Customization

Portfolio Data

Edit the sample data in internal/data/portfolio.go to customize:

  • Personal information
  • Work experience
  • Projects
  • Contact details
  • Skills and interests

Styling

The application uses a GitHub-inspired terminal theme. Customize colors and styles in internal/ui/styles.go.

Content Layout

Modify content rendering in internal/ui/layout.go to change how information is displayed.

Deployment

Docker

  1. Build Docker image:
make docker-build
  1. Run with Docker:
make docker-run

Production Build

Create an optimized production binary:

make build-prod

Systemd Service

Example systemd service file:

[Unit]
Description=SSH Portfolio Server
After=network.target

[Service]
Type=simple
User=portfolio
Group=portfolio
WorkingDirectory=/opt/ssh-portfolio
ExecStart=/opt/ssh-portfolio/bin/ssh-portfolio
Restart=always
RestartSec=5
Environment=SSH_HOST=0.0.0.0
Environment=SSH_PORT=2222
Environment=SSH_HOST_KEY_PATH=/opt/ssh-portfolio/keys/ssh_host_key

[Install]
WantedBy=multi-user.target

Security Considerations

  • The application includes rate limiting and session management
  • All connections are logged and monitored
  • SSH host key should be properly secured in production
  • Consider running behind a reverse proxy for additional security
  • Regularly update dependencies for security patches

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run make format && make lint && make test
  6. Submit a pull request

License

MIT License - see LICENSE file for details.

Architecture

This application uses a clean, modular architecture:

  • Domain Layer: Core business logic and models
  • UI Layer: Bubbletea components with composite model pattern
  • Server Layer: SSH server with Wish middleware
  • Security Layer: Rate limiting, session management, and monitoring
  • Configuration Layer: Environment-based configuration management

The design follows Go best practices and uses dependency injection for testability and maintainability.

About

This is my first attempt at an SSH TUI application inspired by terminal.shop. Claude was used during development

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors