@leanspec/http-server
v0.2.23
Published
Rust HTTP server for LeanSpec UI
Readme
@leanspec/http-server
High-performance Rust HTTP server for LeanSpec UI.
Features
- Fast: Built with Rust and Axum web framework
- Lightweight: <30MB bundle size
- Multi-project: Support for multiple project workspaces
- RESTful API: JSON API for all spec operations
- Unified UI + API: Serves the Vite UI and
/api/*from one server - CORS-enabled: Configurable cross-origin resource sharing
Installation
npm install @leanspec/http-serverUsage
As a standalone server
npx leanspec-httpOptions:
--host <host>- Server host (default: 127.0.0.1)--port <port>- Server port (default: 3000)--help- Show help message
As a library
import { spawn } from 'child_process';
const server = spawn('leanspec-http', ['--port', '3000']);Configuration
The server reads configuration from ~/.lean-spec/config.json:
{
"server": {
"host": "127.0.0.1",
"port": 3000,
"cors": {
"enabled": false,
"origins": [
"http://localhost:5173",
"http://localhost:3000"
]
}
}
}API Endpoints
Projects
GET /api/projects- List all projectsPOST /api/projects- Add new projectGET /api/projects/:id- Get project detailsPATCH /api/projects/:id- Update projectDELETE /api/projects/:id- Remove projectPOST /api/projects/:id/switch- Switch to project
Specs
GET /api/specs- List specs (with filters)GET /api/specs/:spec- Get spec detailPATCH /api/specs/:spec/metadata- Update spec metadataPOST /api/search- Search specsGET /api/stats- Project statisticsGET /api/deps/:spec- Dependency graphGET /api/validate- Validate all specs
Health
GET /health- Health check
Platform Support
- macOS (x64, arm64)
- Linux (x64, arm64)
- Windows (x64)
License
MIT
