Rust HTTP server for LeanSpec UI
npm install @leanspec/http-serverHigh-performance Rust HTTP server for LeanSpec UI.
- 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
``bash`
npm install @leanspec/http-server
`bash`
npx leanspec-http
Options:
- --host - Server host (default: 127.0.0.1)--port
- - Server port (default: 3000)--help
- - Show help message
`javascript
import { spawn } from 'child_process';
const server = spawn('leanspec-http', ['--port', '3000']);
`
The server reads configuration from ~/.lean-spec/config.json:
`json`
{
"server": {
"host": "127.0.0.1",
"port": 3000,
"cors": {
"enabled": false,
"origins": [
"http://localhost:5173",
"http://localhost:3000"
]
}
}
}
- List all projects
- POST /api/projects - Add new project
- GET /api/projects/:id - Get project details
- PATCH /api/projects/:id - Update project
- DELETE /api/projects/:id - Remove project
- POST /api/projects/:id/switch - Switch to project$3
- GET /api/specs - List specs (with filters)
- GET /api/specs/:spec - Get spec detail
- PATCH /api/specs/:spec/metadata - Update spec metadata
- POST /api/search - Search specs
- GET /api/stats - Project statistics
- GET /api/deps/:spec - Dependency graph
- GET /api/validate - Validate all specs$3
- GET /health` - Health check- macOS (x64, arm64)
- Linux (x64, arm64)
- Windows (x64)
MIT