124 lines
2.3 KiB
Markdown
124 lines
2.3 KiB
Markdown
# @git.zone/tsview
|
|
|
|
A CLI tool for viewing S3 and MongoDB data with a web UI.
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
npm install -g @git.zone/tsview
|
|
# or
|
|
pnpm add -g @git.zone/tsview
|
|
```
|
|
|
|
## Usage
|
|
|
|
### CLI
|
|
|
|
```bash
|
|
# Start viewer (auto-finds free port from 3010+)
|
|
tsview
|
|
|
|
# Force specific port
|
|
tsview --port 3000
|
|
|
|
# S3 viewer only
|
|
tsview s3
|
|
|
|
# MongoDB viewer only
|
|
tsview mongo
|
|
```
|
|
|
|
### Configuration
|
|
|
|
tsview reads configuration from `.nogit/env.json` (the same format used by `gitzone service`):
|
|
|
|
```json
|
|
{
|
|
"S3_ENDPOINT": "localhost",
|
|
"S3_PORT": "9000",
|
|
"S3_ACCESSKEY": "minioadmin",
|
|
"S3_SECRETKEY": "minioadmin",
|
|
"S3_USESSL": false,
|
|
"MONGODB_URL": "mongodb://localhost:27017",
|
|
"MONGODB_NAME": "mydb"
|
|
}
|
|
```
|
|
|
|
### Programmatic API
|
|
|
|
```typescript
|
|
import { TsView } from '@git.zone/tsview';
|
|
|
|
const viewer = new TsView();
|
|
|
|
// Option 1: Load from env.json (gitzone service)
|
|
await viewer.loadConfigFromEnv();
|
|
|
|
// Option 2: Custom local config (MinIO + local MongoDB)
|
|
viewer.setS3Config({
|
|
endpoint: 'localhost',
|
|
port: 9000,
|
|
accessKey: 'minioadmin',
|
|
accessSecret: 'minioadmin',
|
|
useSsl: false
|
|
});
|
|
|
|
// Option 3: Cloud config (AWS S3 + MongoDB Atlas)
|
|
viewer.setS3Config({
|
|
endpoint: 's3.amazonaws.com',
|
|
accessKey: 'AKIAXXXXXXX',
|
|
accessSecret: 'secret',
|
|
useSsl: true,
|
|
region: 'us-east-1'
|
|
});
|
|
|
|
viewer.setMongoConfig({
|
|
mongoDbUrl: 'mongodb+srv://user:pass@cluster.mongodb.net',
|
|
mongoDbName: 'mydb'
|
|
});
|
|
|
|
// Start on auto-found port
|
|
const port = await viewer.start();
|
|
console.log(`Viewer running on http://localhost:${port}`);
|
|
|
|
// Or force specific port
|
|
await viewer.start(3500);
|
|
|
|
// Stop when done
|
|
await viewer.stop();
|
|
```
|
|
|
|
## Features
|
|
|
|
### S3 Browser
|
|
- **Column View**: Mac Finder-style navigation with horizontal columns
|
|
- **List View**: Flat list of all keys with filtering
|
|
- **Preview Panel**: View images, text, and JSON files
|
|
- **Operations**: Download, delete files
|
|
|
|
### MongoDB Browser
|
|
- **Database/Collection Navigation**: Hierarchical sidebar
|
|
- **Documents Table**: Paginated view with filtering
|
|
- **Document Editor**: Edit documents with JSON syntax highlighting
|
|
- **Index Management**: View, create, and drop indexes
|
|
|
|
## Development
|
|
|
|
```bash
|
|
# Install dependencies
|
|
pnpm install
|
|
|
|
# Build (bundles UI + compiles TypeScript)
|
|
pnpm build
|
|
|
|
# Run tests
|
|
pnpm test
|
|
|
|
# Run in development mode
|
|
./cli.ts.js
|
|
```
|
|
|
|
## License
|
|
|
|
MIT License - see [license](./license) for details.
|