Metadata-Version: 2.4
Name: trajectory-server
Version: 0.1.0
Summary: Trajectory platform server
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi>=0.104.0
Requires-Dist: uvicorn>=0.24.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: trajectory-sdk
Provides-Extra: dev
Dynamic: license-file

# Trajectory Platform

Import your data, convert them into Trajectories, and receive endpoints via the Trajectory Platform. 

Currently supports Langsmith Integration (Braintrust coming soon).

All processing happens on your machine and your API key never leaves your environment.

## Prerequisites

- [Python 3.11+](https://www.python.org/downloads/)
- [UV](https://docs.astral.sh/uv/getting-started/installation/) (Python package manager)
- [Node.js](https://nodejs.org/) (v18+)
- A [LangSmith API key](https://smith.langchain.com/) (`lsv2_pt_...`)

## Quick Start

```bash
./run.sh
```

This single command handles everything:
1. Creates a Python virtual environment (via `uv venv`) if one doesn't exist
2. Installs backend dependencies
3. Installs frontend dependencies (if `node_modules` is missing)
4. Starts the FastAPI backend on http://localhost:8000
5. Starts the Vite dev server on http://localhost:5173

Open http://localhost:5173 in your browser, enter your LangSmith API key, and start browsing traces.

Press `Ctrl+C` to stop both servers.

## Manual Setup

If you prefer to run things separately:

### Backend

```bash
uv venv
uv pip install -r server/requirements.txt
uv run uvicorn server.main:app --reload
```

The API server will be available at http://localhost:8000.

### Frontend

```bash
cd frontend
npm install
npm run dev
```

The frontend dev server will be available at http://localhost:5173. It proxies `/api` requests to the backend automatically.

## Project Structure

```
.
├── server/                  # FastAPI backend
│   ├── main.py              # App setup, CORS, routes
│   ├── routers/             # API endpoint definitions
│   │   ├── projects.py      # Project listing & validation
│   │   └── threads.py       # Thread/conversation endpoints
│   ├── services/
│   │   └── langsmith.py     # LangSmith API interaction
│   └── models/
│       └── schemas.py       # Pydantic request/response models
├── frontend/                # React + TypeScript frontend
│   ├── src/
│   │   ├── components/      # UI components
│   │   ├── context/         # React context (auth state)
│   │   ├── api/             # API client
│   │   └── types/           # TypeScript type definitions
│   └── vite.config.ts       # Vite config with API proxy
├── run.sh                   # Development startup script
└── pyproject.toml           # Python project config
```

## Available Scripts

| Command | Description |
|---|---|
| `./run.sh` | Start both backend and frontend |
| `npm run dev` | Start frontend dev server only (from `frontend/`) |
| `npm run build` | Type-check and build frontend for production |
| `npm run lint` | Run ESLint on frontend code |
| `npm run preview` | Preview production build |

## License

[Apache 2.0](LICENSE)
