Skip to content

Repository files navigation

Portfolio

Portfolio

A local web server app for managing project port allocations — track which projects use which ports, detect process liveness, and avoid port conflicts.

Features

  • Tree & Card views — toggle between detail list and compact card grid layout
  • CRUD management — create, edit, delete projects and their services
  • Preview panel — zoomed-out iframe preview per project, toggle with MonitorPlay button
  • Power saving mode — screenshot service pages via html-to-image, replace live iframe with static image
  • Preview mask — hover over screenshot shows eye icon with i18n prompt, click to view live iframe
  • 5s revert countdown — mouse-leave timer before iframe switches back to image
  • Hostname proxypPORT.localhost transparently proxies to localhost:PORT, with WebSocket support
  • Right-click preview — right-click a service chip to set it as the project's preview
  • Custom tag colors — pre-define tags with colors; GitHub-style auto-computed background/text
  • Collapsible tag filter — sidebar with drag-to-reorder tags, tag manager
  • Port conflict detection — warns when two services claim the same port
  • Process liveness check — auto check every 10s, per-service TCP latency every 5s
  • Import / Export — backup and restore your port registry as JSON
  • Auto-backup — rotating backups (up to 5) on every modification
  • Quick open — open a project's directory in File Explorer, VS Code, or terminal
  • PWA support — install as a standalone desktop window
  • Cross-platform — Windows, macOS, Linux (including WSL)
  • npm packagenpx portfolio-local to run instantly, no clone needed
  • Light / Dark / System theme — theme-aware tag colors, custom scrollbar
  • i18n — English, Simplified Chinese, Japanese
  • Drag-and-drop reordering of projects and services
  • Keyboard shortcutsCtrl+N new project, Ctrl+K focus search, Esc close modals
  • Latency cache — survives view mode switches without data loss

Tech Stack

LayerChoice
FrontendReact 18 + TypeScript + Vite + Tailwind CSS + shadcn/ui
BackendNode.js + Express + TypeScript
i18nreact-i18next + i18next
StorageLocal JSON (~/.portfolio/data.json)
Packagepnpm monorepo

Getting Started

Prerequisites

  • Node.js ≥ 18

Quick Start (npm)

npx portfolio-local

Open http://localhost:35688. To install permanently:

npm i -g portfolio-local
portfolio

Click the install button in Chrome's address bar to add Portfolio as a PWA standalone window.

Development (from source)

git clone git@github.com:Crequency/Portfolio.git
cd Portfolio
pnpm install
pnpm dev # Frontend :45321 + Backend :45311

Open http://localhost:45321.

Production Build (from source)

pnpm build
pnpm start # Serves on :35688

Platform Support

Portfolio runs on Windows, macOS, and Linux (including WSL). Port status detection uses native system commands per platform (netstat, ss, lsof) with a TCP connect fallback.

Project Structure

Portfolio/
├── assets/
│ └── logo.svg # Project logo
├── packages/
│ ├── shared/ # Type definitions (Project, Service, API types)
│ ├── server/ # Express backend
│ │ └── src/
│ │ ├── cli.ts # npm CLI entry point
│ │ ├── index.ts # App factory + dev server
│ │ ├── routes/ # API route handlers (projects, services, check,
│ │ │ # data, ping, proxy)
│ │ ├── services/ # Storage, port checker, backup, open project
│ │ └── middleware/ # Validation, error handling
│ └── web/ # React frontend
│ └── src/
│ ├── components/ # tree (ServiceCard, ProjectCard, PreviewPanel),
│ │ # modals (Create/Edit Project/Service,
│ │ # DeleteConfirm, TagManager),
│ │ # common (StatusBadge, TagChip, LatencyChip,
│ │ # PingIndicator, SettingsDialog),
│ │ # sidebar (TagSidebar), layout (TopNav)
│ ├── hooks/ # useProjects, usePing, useServiceLatency,
│ │ # useDefinedTags, useKeyboardShortcuts
│ ├── lib/ # api (typed fetch client), theme (ThemeProvider),
│ │ # tagColorUtils (color algorithm), utils (cn)
│ ├── locales/ # i18n translation files (en, zh, ja)
│ └── pages/ # Dashboard
├── .develop/
│ └── Requirements.md # Full requirements document
└── pnpm-workspace.yaml

API Endpoints

Projects

MethodPathDescription
GET/api/projectsList all projects (?search= by name/port, ?tag= by tag name)
POST/api/projectsCreate project
GET/api/projects/:idGet project detail
PUT/api/projects/:idUpdate project
DELETE/api/projects/:idDelete project (cascading services)
PUT/api/projects/reorderReorder projects ({ projectIds: string[] })
POST/api/projects/:id/openOpen project path in explorer/code/terminal

Services

MethodPathDescription
POST/api/projects/:id/servicesAdd service
PUT/api/projects/:id/services/:sidUpdate service
DELETE/api/projects/:id/services/:sidDelete service
PUT/api/projects/:id/services/reorderReorder services

Check & Ping

MethodPathDescription
POST/api/checkCheck all services' port status
POST/api/check/:projectIdCheck one project's services
POST/api/check/:projectId/:serviceIdCheck single service
POST/api/ping-portTCP connect latency to a port

Data

MethodPathDescription
GET/api/exportExport all data as JSON
POST/api/importImport JSON data ({ data, mode: "merge" | "replace" })

Info & Health

MethodPathDescription
GET/api/infoServer info (port, etc.)
GET/api/healthHealth check

Proxy

HostDescription
http://p{PORT}.localhost/Transparent proxy to localhost:{PORT}
ws://p{PORT}.localhost/WebSocket proxy (HTTP upgrade → TCP pipe)

Response Format

// Success
{ "ok": true, "data": { ... } }
// Error
{ "ok": false, "error": { "code": "NOT_FOUND", "message": "Project not found" } }

Commit Convention

This project follows Conventional Commits.

<type>: <description>
TypeUsage
featNew feature
fixBug fix
docsDocumentation only
styleFormatting, missing semicolons, etc.
refactorCode change that neither fixes a bug nor adds a feature
perfPerformance improvement
testAdding or correcting tests
choreTooling, dependencies, build scripts
ciCI/CD configuration

License

GNU Affero General Public License v3.0

About

Your ports manager for local development environment

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages