forked from 0xWheatyz/SPARC
docs: update documentation for React frontend and cache mode
Update all documentation to reflect recent changes: - Replace Streamlit dashboard references with React TypeScript dashboard - Update dashboard port from 8501 to 8080 - Add auth.py and database.py to architecture section - Change USE_DATABASE terminology to USE_CACHE - Add JWT_SECRET to environment variables reference - Document default admin credentials and user seeding 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+24
-22
@@ -64,7 +64,7 @@ docker-compose ps
|
||||
# You should see:
|
||||
# - sparc-postgres (healthy)
|
||||
# - sparc-api (running on port 8000)
|
||||
# - sparc-dashboard (running on port 8501)
|
||||
# - sparc-dashboard (running on port 8080)
|
||||
```
|
||||
|
||||
The database is automatically initialized by the `init-db` service.
|
||||
@@ -116,11 +116,13 @@ docker-compose up -d postgres
|
||||
# Wait for database to be healthy, then initialize
|
||||
python scripts/init_database.py
|
||||
|
||||
# Terminal 1: Start FastAPI backend
|
||||
# Start FastAPI backend
|
||||
uvicorn SPARC.api:app --host 0.0.0.0 --port 8000 --reload
|
||||
|
||||
# Terminal 2: Start Streamlit dashboard
|
||||
streamlit run dashboard.py --server.port 8501 --server.address 0.0.0.0
|
||||
# For the React frontend (separate terminal)
|
||||
cd frontend
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
---
|
||||
@@ -141,7 +143,7 @@ Access the services:
|
||||
|---------|-----|
|
||||
| REST API | http://localhost:8000 |
|
||||
| API Documentation (Swagger) | http://localhost:8000/docs |
|
||||
| Dashboard (Web UI) | http://localhost:8501 |
|
||||
| Dashboard (Web UI) | http://localhost:8080 |
|
||||
|
||||
---
|
||||
|
||||
@@ -149,16 +151,17 @@ Access the services:
|
||||
|
||||
### Via Dashboard (Web UI)
|
||||
|
||||
1. Open http://localhost:8501
|
||||
2. Select **"Company Analysis"** from the sidebar
|
||||
3. Enter a company name (e.g., "Intel")
|
||||
4. Click **"Analyze"**
|
||||
1. Open http://localhost:8080
|
||||
2. Register a new account or login (default admin: `admin` / `admin`)
|
||||
3. Navigate to **"Analysis"** from the sidebar
|
||||
4. Enter a company name (e.g., "Intel")
|
||||
5. Click **"Analyze"**
|
||||
|
||||
This will:
|
||||
- Query SerpAPI for recent patents
|
||||
- Download and parse patent PDFs
|
||||
- Send patent content to Claude for analysis
|
||||
- Store prompt/response in PostgreSQL
|
||||
- Store prompt/response in PostgreSQL (with caching)
|
||||
- Display results in the dashboard
|
||||
|
||||
### Via REST API
|
||||
@@ -233,12 +236,12 @@ docker exec -it sparc-postgres psql -U postgres -d sparc -c \
|
||||
|
||||
| Component | Purpose |
|
||||
|-----------|---------|
|
||||
| **Dashboard** | Streamlit web UI for interactive analysis |
|
||||
| **FastAPI** | REST API for programmatic access |
|
||||
| **Dashboard** | React TypeScript web UI with authentication |
|
||||
| **FastAPI** | REST API with JWT authentication |
|
||||
| **Analyzer** | Orchestrates patent retrieval and LLM analysis |
|
||||
| **SerpAPI** | Retrieves patent data from Google Patents |
|
||||
| **OpenRouter** | Routes requests to Claude for AI analysis |
|
||||
| **PostgreSQL** | Stores prompts, responses, and analytics |
|
||||
| **PostgreSQL** | Stores prompts, responses, users, and cached results |
|
||||
|
||||
---
|
||||
|
||||
@@ -248,10 +251,9 @@ docker exec -it sparc-postgres psql -U postgres -d sparc -c \
|
||||
|----------|----------|---------|-------------|
|
||||
| `API_KEY` | Yes | - | SerpAPI key for patent search |
|
||||
| `OPENROUTER_API_KEY` | Yes | - | OpenRouter API key for Claude access |
|
||||
| `DATABASE_URL` | Yes* | - | PostgreSQL connection string |
|
||||
| `USE_DATABASE` | No | `false` | Set to `true` to enable database storage |
|
||||
|
||||
*Required when `USE_DATABASE=true`
|
||||
| `DATABASE_URL` | Yes | - | PostgreSQL connection string |
|
||||
| `USE_CACHE` | No | `true` | Check database for cached responses before API calls |
|
||||
| `JWT_SECRET` | Yes | - | Secret key for JWT authentication (change in production!) |
|
||||
|
||||
### Database URL Format
|
||||
|
||||
@@ -273,9 +275,9 @@ The `docker-compose.yml` includes all services needed for production:
|
||||
| Service | Container | Port | Description |
|
||||
|---------|-----------|------|-------------|
|
||||
| `postgres` | sparc-postgres | 5432 | PostgreSQL database |
|
||||
| `init-db` | sparc-init-db | - | One-time database initialization |
|
||||
| `api` | sparc-api | 8000 | FastAPI REST API |
|
||||
| `dashboard` | sparc-dashboard | 8501 | Streamlit web UI |
|
||||
| `init-db` | sparc-init-db | - | One-time database initialization (seeds admin user) |
|
||||
| `api` | sparc-api | 8000 | FastAPI REST API with JWT auth |
|
||||
| `dashboard` | sparc-dashboard | 8080 | React TypeScript web UI |
|
||||
|
||||
### Common Docker Compose Commands
|
||||
|
||||
@@ -382,11 +384,11 @@ cp .env.example .env
|
||||
docker-compose up -d postgres
|
||||
python scripts/init_database.py
|
||||
uvicorn SPARC.api:app --reload &
|
||||
streamlit run dashboard.py
|
||||
cd frontend && npm install && npm run dev &
|
||||
|
||||
# Check status
|
||||
curl http://localhost:8000/health
|
||||
open http://localhost:8501
|
||||
open http://localhost:8080
|
||||
|
||||
# View data
|
||||
python scripts/view_analytics.py
|
||||
|
||||
Reference in New Issue
Block a user