Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ venv/
*.py[cod]
.pytest_cache/
*.xlsx
.vercel
8 changes: 8 additions & 0 deletions .vercelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
data/
.venv/
venv/
**/node_modules
*.xlsx
*.pkl
*.parquet
.env*
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# SkillGraph — India Job Market Mining Engine
# SkillGraph: India Job Market Mining Engine

**Live Web App**: https://skillgraph-two-delta.vercel.app
**Production API**: https://skillgraph-api-notionatul.vercel.app

A student types the skills they have and the job they want. They get back: the role that actually fits them, whether they are ready for the one they asked for, and the skills that would move them fastest.

Expand Down Expand Up @@ -30,9 +33,9 @@ skillgraph/
├── api/ # Archit — FastAPI serving layer
├── frontend/ # Shashank — Vite + React UI
├── tests/ # each person owns their module's tests
├── docs/ # data audit, contracts, model writeup
├── data/ # GITIGNORED — rebuilt by the pipeline
└── artifacts/ # GITIGNORED — built artifacts shipped via GitHub Releases
├── docs/ # data audit, contracts, model writeup, deployment guide
├── data/ # GITIGNORED: rebuilt by the pipeline
└── artifacts/ # GITIGNORED: built artifacts shipped via GitHub Releases
```

## API Endpoints
Expand Down
1 change: 1 addition & 0 deletions app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from api.main import app # noqa: F401
103 changes: 103 additions & 0 deletions docs/deploy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Deployment Guide

This document describes the Vercel production deployment setup for SkillGraph, recorded on 2026-10-05.

## 1. Production URLs

- Web application: https://skillgraph-two-delta.vercel.app (alias: https://skillgraph-notionatul.vercel.app)
- API service: https://skillgraph-api-notionatul.vercel.app (alias: https://skillgraph-api-three.vercel.app)

The web client sends all requests to its own origin under `/api/*`. `frontend/vercel.json` rewrites these paths to the API production domain.

## 2. Project Settings

### API: skillgraph-api

- Project Name: `skillgraph-api`
- Root Directory: `.` (repo root)
- Framework Preset: FastAPI
- Runtime: Python 3.12 (specified in `.python-version`)
- Entrypoint: `app.py` (`from api.main import app`)
- Install Command: `pip install -r requirements.txt`
- Excluded Files: defined in `vercel.json` functions block to keep bundle size small and preserve `artifacts/*.json` and `taxonomy/`
- Git Connection: `https://github.com/AtulACleaver/SkillGraph` (production branch: `main`)

### Web: skillgraph

- Project Name: `skillgraph`
- Root Directory: `frontend`
- Framework Preset: Vite
- Build Command: `npm run build`
- Output Directory: `dist`
- Install Command: `npm install`
- Rewrites: `frontend/vercel.json` rewrites `/api/:path*` to `https://skillgraph-api-notionatul.vercel.app/api/:path*`
- Git Connection: `https://github.com/AtulACleaver/SkillGraph` (production branch: `main`)

## 3. Latency Benchmarks (Measured 2026-10-05)

Benchmarked `/api/analyze` using the payload:
`{"skills": ["python", "sql", "pandas"], "desired_role": "Data / BI Analyst"}`

- Cold start (initial invocation after fresh deployment): 2521.1 ms (2.52 s)
- Warm sequential calls (20 requests through web domain rewrite):
- p50: 454.4 ms
- p95: 728.8 ms
- Min: 361.7 ms
- Max: 1023.1 ms
- Mean: 491.0 ms

Recorded from command:
```bash
for i in $(seq 1 20); do
curl -w "%{time_total}\n" -o /dev/null -s -X POST "https://skillgraph-two-delta.vercel.app/api/analyze" \
-H "Content-Type: application/json" \
-d '{"skills":["python","sql","pandas"],"desired_role":"Data / BI Analyst"}'
done
```

## 4. Environment Variables

- `ALLOWED_ORIGINS`: Comma-separated list of origins allowed by CORS. Only matters for local development or cross-origin access. Not required in production because the web client uses same-origin `/api` rewrites.
- `PORT`: Set automatically by Vercel serverless environment.

## 5. How to Roll Back

### Via CLI

Run rollback inside the respective directory:

```bash
# Roll back API
vercel rollback <deployment-url>

# Roll back web frontend
cd frontend && vercel rollback <deployment-url>
```

### Via Dashboard

1. Open the project dashboard on Vercel:
- API: `https://vercel.com/notionatul/skillgraph-api`
- Web: `https://vercel.com/notionatul/skillgraph`
2. Open the **Deployments** tab.
3. Select the previous stable deployment.
4. Click the three dots icon (`...`) on the right.
5. Select **Promote to Production**.

## 6. How to Redeploy

### Via Git (Automated)

Both projects connect to `https://github.com/AtulACleaver/SkillGraph`. Merges or pushes to `main` trigger production deployments automatically. Pull requests receive isolated preview deployments with unique preview URLs.

### Via CLI (Manual)

To deploy directly from the CLI:

```bash
# Redeploy API
vercel deploy --prod

# Redeploy web frontend
cd frontend && vercel deploy --prod
```
Binary file added docs/screenshots/prod-mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ dist-ssr
*.njsproj
*.sln
*.sw?
.vercel
8 changes: 8 additions & 0 deletions frontend/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"rewrites": [
{
"source": "/api/:path*",
"destination": "https://skillgraph-api-notionatul.vercel.app/api/:path*"
}
]
}
120 changes: 120 additions & 0 deletions scripts/smoke.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env bash
set -euo pipefail

BASE_URL="${1:-https://skillgraph-two-delta.vercel.app}"
BASE_URL="${BASE_URL%/}"

echo "Running smoke tests against: ${BASE_URL}"

# 1. Health check
echo "1. Checking GET /api/health..."
HEALTH=$(curl -sSf "${BASE_URL}/api/health")
echo "${HEALTH}" | python3 -c '
import sys, json
data = json.load(sys.stdin)
assert data.get("status") == "ok", f"Invalid status: {data}"
assert data.get("artifacts_loaded") is True, "artifacts_loaded is not True"
print(" Passed: status ok, artifacts_loaded true")
'

# 2. Roles list check
echo "2. Checking GET /api/roles returns 10 roles..."
ROLES=$(curl -sSf "${BASE_URL}/api/roles")
echo "${ROLES}" | python3 -c '
import sys, json
data = json.load(sys.stdin)
assert isinstance(data, list), "Roles response is not a list"
assert len(data) == 10, f"Expected 10 roles, got {len(data)}"
print(f" Passed: exactly {len(data)} roles returned")
'

# 3. Skills autocomplete check
echo "3. Checking GET /api/skills?q=pyth is non-empty..."
SKILLS=$(curl -sSf "${BASE_URL}/api/skills?q=pyth")
echo "${SKILLS}" | python3 -c '
import sys, json
data = json.load(sys.stdin)
assert isinstance(data, list), "Skills response is not a list"
assert len(data) > 0, "Skills response is empty"
assert any("python" in s.get("name", "").lower() for s in data), "Expected Python in suggestions"
print(f" Passed: {len(data)} skills returned")
'

# 4. Persona 1 check
echo "4. Checking Persona 1 (python, sql, pandas -> Data / BI Analyst)..."
P1=$(curl -sSf -X POST "${BASE_URL}/api/analyze" \
-H "Content-Type: application/json" \
-d '{"skills":["python","sql","pandas"],"desired_role":"Data / BI Analyst"}')
echo "${P1}" | python3 -c '
import sys, json
data = json.load(sys.stdin)
match = data.get("match", {})
top_match = match.get("matches", [{}])[0]
role = top_match.get("role")
assert role == "Data / BI Analyst", f"Expected Data / BI Analyst, got {role}"
prob = round(top_match.get("probability", 0), 4)
assert prob == 0.4313, f"Expected match prob 0.4313, got {prob}"

readiness = data.get("readiness", {})
r_prob = round(readiness.get("probability", 0), 4)
assert r_prob == 0.4313, f"Expected readiness prob 0.4313, got {r_prob}"
band = readiness.get("band")
assert band == "Close", f"Expected band Close, got {band}"
cov = round(readiness.get("coverage", 0), 2)
assert cov == 0.1, f"Expected coverage 0.1, got {cov}"
print(" Passed: Persona 1 match 0.4313, readiness 0.4313, band Close, coverage 0.1")
'

# 5. Persona 2 check
echo "5. Checking Persona 2 (java, spring boot, mysql, docker -> Backend)..."
P2=$(curl -sSf -X POST "${BASE_URL}/api/analyze" \
-H "Content-Type: application/json" \
-d '{"skills":["java","spring boot","mysql","docker"],"desired_role":"Backend"}')
echo "${P2}" | python3 -c '
import sys, json
data = json.load(sys.stdin)
readiness = data.get("readiness", {})
r_prob = round(readiness.get("probability", 0), 4)
assert r_prob == 0.6942, f"Expected readiness prob 0.6942, got {r_prob}"
band = readiness.get("band")
assert band == "Close", f"Expected band Close, got {band}"
cov = round(readiness.get("coverage", 0), 2)
assert cov == 0.15, f"Expected coverage 0.15, got {cov}"
print(" Passed: Persona 2 readiness 0.6942, band Close, coverage 0.15")
'

# 6. Persona 3 check
echo "6. Checking Persona 3 (react, javascript, html, css -> Full Stack)..."
P3=$(curl -sSf -X POST "${BASE_URL}/api/analyze" \
-H "Content-Type: application/json" \
-d '{"skills":["react","javascript","html","css"],"desired_role":"Full Stack"}')
echo "${P3}" | python3 -c '
import sys, json
data = json.load(sys.stdin)
match = data.get("match", {})
top_match = match.get("matches", [{}])[0]
role = top_match.get("role")
assert role == "Frontend", f"Expected Frontend, got {role}"
prob = round(top_match.get("probability", 0), 4)
assert prob == 0.7072, f"Expected match prob 0.7072, got {prob}"

readiness = data.get("readiness", {})
r_prob = round(readiness.get("probability", 0), 4)
assert r_prob == 0.2588, f"Expected readiness prob 0.2588, got {r_prob}"
band = readiness.get("band")
assert band == "Not yet", f"Expected band Not yet, got {band}"
print(" Passed: Persona 3 match Frontend 0.7072, readiness 0.2588, band Not yet")
'

# 7. Unrecognized skills 400 check
echo "7. Checking unrecognized skills returns 400..."
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST "${BASE_URL}/api/analyze" \
-H "Content-Type: application/json" \
-d '{"skills":["foo","bar"],"desired_role":"Data / BI Analyst"}')
if [ "${HTTP_STATUS}" -ne 400 ]; then
echo " Failed: Expected HTTP 400 for unrecognized skills, got ${HTTP_STATUS}"
exit 1
fi
echo " Passed: HTTP 400 returned for unrecognized skills"

echo "All smoke tests passed successfully against ${BASE_URL}."
7 changes: 7 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"functions": {
"app.py": {
"excludeFiles": "{frontend/**,tests/**,docs/**,data/**,scripts/**,fixtures/**,.github/**,**/*.parquet,**/*.pkl,**/*.xlsx}"
}
}
}
Loading