Skip to content

Commit 10e6f05

Browse files
committed
readme updates
1 parent 7d06cdd commit 10e6f05

1 file changed

Lines changed: 82 additions & 101 deletions

File tree

README.md

Lines changed: 82 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -9,140 +9,133 @@ OHM exposes a FastAPI-based HTTP API that can be run locally via Docker Compose
99

1010
## Quick Start for New Users
1111

12-
### Prerequisites (first-time setup)
12+
### Prerequisites
1313

14-
If you are new to these tools, install them before continuing:
14+
| Tool | Purpose | Install |
15+
|------|---------|---------|
16+
| **Git** | Clone the repository | https://git-scm.com/downloads |
17+
| **Docker Desktop** | Run the API server | https://www.docker.com/products/docker-desktop/ |
18+
| **uv** | Python env + CLI (local dev) | `curl -LsSf https://astral.sh/uv/install.sh \| sh` or `brew install uv` |
19+
| **Node.js ≥ 18** | Reference frontend | https://nodejs.org/ |
1520

16-
- **Git** (to clone the repository): https://git-scm.com/downloads
17-
- **Docker Desktop** (includes Docker Compose): https://www.docker.com/products/docker-desktop/
18-
- **Miniconda** (recommended for Python env management): https://docs.conda.io/en/latest/miniconda.html
19-
- **MkDocs** (for local docs browsing): https://www.mkdocs.org/
21+
> Docker Desktop is sufficient if you only want to run the API. Install `uv` when you need the `ohm` CLI, to run tests, or to work on Python code.
2022
2123
After installing, open a new terminal so the tools are on your PATH.
2224

23-
### Installation
24-
25-
#### Option 1: Docker Compose (Recommended - Simplest)
26-
27-
Docker Compose is the recommended way to run the OHM server. It handles all dependencies, configuration, and provides a consistent environment.
25+
### Option A: API server only (Docker — no Python setup required)
2826

2927
```bash
30-
# Clone the repository
28+
# 1. Clone
3129
git clone https://github.com/helpfulengineering/supply-graph-ai.git
3230
cd supply-graph-ai
3331

34-
# Create and activate conda environment (Python 3.12 required)
35-
conda create -n supply-graph-ai python=3.12
36-
conda activate supply-graph-ai
37-
38-
# Install dependencies (CLI + tooling)
39-
pip install -r requirements.txt
40-
41-
# Install the CLI in editable mode (creates the 'ohm' command)
42-
pip install -e .
43-
44-
# Copy environment template and customize (optional)
32+
# 2. Create your environment file (defaults work for local development)
4533
cp env.template .env
46-
# Edit .env with your configuration if needed
47-
# Most defaults work for local development
4834

49-
# Start the API server (FastAPI via Docker)
50-
docker-compose up ohm-api
35+
# 3. Build and start the API
36+
docker compose up ohm-api
5137
```
5238

53-
**Docker Compose Benefits:**
54-
- ✅ Consistent environment across all machines
55-
- ✅ Automatic dependency management
56-
- ✅ Easy volume management for storage and logs
57-
- ✅ Built-in health checks
58-
- ✅ Simple scaling and service management
59-
- ✅ No need to install Python dependencies locally
39+
The API is now available at `http://localhost:8001`. Interactive API docs are at `http://localhost:8001/v1/docs`.
6040

61-
#### Option 2: Local Development (For Active Development)
41+
### Option B: Local development with uv (CLI + tests + scripts)
6242

63-
Use this option if you need to modify code frequently and want hot-reload without rebuilding Docker images.
43+
`uv` manages both the Python version and the virtual environment — no separate Python installation or conda is needed.
6444

6545
```bash
66-
# Clone the repository
46+
# 1. Clone
6747
git clone https://github.com/helpfulengineering/supply-graph-ai.git
6848
cd supply-graph-ai
6949

70-
# Create and activate conda environment (Python 3.12 required)
71-
conda create -n supply-graph-ai python=3.12
72-
conda activate supply-graph-ai
50+
# 2. Create your environment file
51+
cp env.template .env
7352

74-
# Install dependencies
75-
pip install -r requirements.txt
53+
# 3. Install all dependencies (uv downloads Python 3.12 automatically if needed)
54+
uv sync
7655

77-
# Install the package in editable mode (creates 'ohm' command)
78-
pip install -e .
56+
# 4. Activate the virtual environment
57+
source .venv/bin/activate # macOS / Linux
58+
# .venv\Scripts\activate # Windows
7959

80-
# Verify installation
60+
# 5. Verify the CLI is available
8161
ohm --help
8262

83-
# Start the API server (recommended)
84-
docker compose up --build ohm-api
63+
# 6. Start the API server (still uses Docker)
64+
docker compose up -d ohm-api
65+
```
8566

86-
# Or use uvicorn directly for more control
87-
uvicorn src.core.main:app --reload --host 0.0.0.0 --port 8001
67+
To include development dependencies (pytest, etc.):
8868

89-
# Or use the CLI directly
90-
ohm system health
69+
```bash
70+
uv sync --extra dev
9171
```
9272

93-
### Helpful Docker Commands
73+
You can also run one-off commands without activating the venv:
9474

9575
```bash
96-
# Run in detached mode (background)
97-
docker-compose up -d ohm-api
76+
uv run ohm system health
77+
uv run pytest tests -m unit
78+
```
79+
80+
### Helpful Docker commands
9881

99-
# View logs
100-
docker-compose logs -f ohm-api
82+
```bash
83+
# Start in the background
84+
docker compose up -d ohm-api
10185

102-
# Stop the server
103-
docker-compose down
86+
# Tail logs
87+
docker compose logs -f ohm-api
88+
89+
# Rebuild after Python source changes
90+
docker compose up --build ohm-api
91+
92+
# Stop everything
93+
docker compose down
10494
```
10595

10696
### Reference demo frontend (optional)
10797

108-
The repository includes a Vite + React reference UI under `frontend/`. Start the OHM API first, then from the **`frontend`** directory run:
98+
The repository includes a Vite + React reference UI under `frontend/`. It provides a browser-based interface for browsing OKH designs, running matches, and visualising supply-chain solutions.
99+
100+
**Step 1 — start the API** (must be running before the frontend is useful):
101+
102+
```bash
103+
docker compose up -d ohm-api
104+
```
105+
106+
**Step 2 — start the frontend dev server** (requires Node.js ≥ 18):
109107

110108
```bash
111109
cd frontend
112-
npm install # first time only
110+
npm install # first time only — installs JS dependencies
113111
npm run dev
114112
```
115113

116-
Open the URL Vite prints (typically `http://localhost:5173`). The dev server proxies `/v1` to the API; set `OHM_API_BASE_URL` in `frontend/.env` if your API is not at `http://localhost:8001` (see `frontend/.env.example`).
114+
Open the URL Vite prints (typically `http://localhost:5173`).
115+
116+
The dev server proxies all `/v1` requests to the OHM API. If your API is not at the default `http://localhost:8001`, copy `frontend/.env.example` to `frontend/.env` and set `OHM_API_BASE_URL` accordingly.
117+
118+
> **Hot-reload:** The frontend picks up TypeScript/CSS changes automatically while `npm run dev` is running. Python backend changes require rebuilding and restarting the Docker container (`docker compose up --build ohm-api`).
117119
118120
## Documentation
119121

120122
This README provides a quick start guide and basic project information. For full documentation, run MkDocs locally.
121123

122124
### Building Documentation Locally
123125

124-
The OHM documentation is built using [MkDocs](https://www.mkdocs.org/), a simple static site generator for project documentation.
125-
126-
To build and view the documentation locally:
126+
The OHM documentation is built using [MkDocs](https://www.mkdocs.org/).
127127

128-
1. Ensure your conda environment is active:
129128
```bash
130-
conda activate supply-graph-ai
131-
```
129+
# Install docs dependencies (MkDocs + plugins) into the project venv
130+
uv sync --extra docs
132131

133-
2. Install MkDocs and required plugins:
134-
```bash
135-
pip install mkdocs mkdocs-material mkdocs-mermaid2-plugin
136-
```
137-
138-
3. Start the documentation server:
139-
```bash
140-
mkdocs serve
132+
# Serve with live reload
133+
uv run mkdocs serve
141134
```
142135

143-
4. Open your browser to `http://localhost:8000/`
136+
Open your browser to `http://localhost:8000/`.
144137

145-
Note: This is the MkDocs documentation server port, not the API server which runs on port 8001.
138+
> Port 8000 is the MkDocs server. The API server runs on port 8001.
146139
147140
### Documentation Structure
148141

@@ -201,43 +194,31 @@ supply-graph-ai/
201194
├── mkdocs.yml # Documentation configuration
202195
├── bin/ # Development entrypoint scripts
203196
│ └── ohm # Development CLI entrypoint (fallback)
204-
├── pyproject.toml # Package configuration (creates 'ohm' command via pip install -e .)
205-
├── requirements.txt # Project dependencies
197+
├── pyproject.toml # Package metadata and dependencies
198+
├── uv.lock # Locked dependency versions (managed by uv)
206199
└── docker-compose.yml # Local service orchestration
207200
```
208201

209202
## Running the Application
210203

211-
### Using Docker (Recommended)
204+
### API server (Docker)
212205

213206
```bash
214-
# Start the API server
215-
docker-compose up ohm-api
216-
217-
# Access the API documentation at:
218-
# http://localhost:8001/docs
219-
```
220-
221-
```bash
222-
# Run CLI commands (local install required)
223-
ohm system health
207+
# Start (or rebuild) the API server
208+
docker compose up --build ohm-api
224209

225-
# Or run a containerized CLI command
226-
docker run --rm \
227-
-v $(pwd)/test-data:/app/test-data \
228-
open-matching-engine cli okh validate /app/test-data/manifest.okh.json
210+
# API base URL: http://localhost:8001
211+
# Interactive docs: http://localhost:8001/v1/docs
229212
```
230213

231-
### Local Development
232-
233-
Note: You may need to add a directory called "logs" locally if the command below indicates it can't open the log file!
214+
### CLI commands (requires uv setup from Option B above)
234215

235216
```bash
236-
# Start the FastAPI server
237-
docker compose up --build ohm-api
217+
# Health check
218+
ohm system health
238219

239-
# Visit the API documentation at:
240-
# http://127.0.0.1:8001/v1/docs
220+
# Or without activating the venv
221+
uv run ohm system health
241222
```
242223

243224
For container deployment guides, see the [Container Guide](docs/development/container-guide.md) in our documentation.

0 commit comments

Comments
 (0)