http://localhost:5001
All endpoints require Clerk authentication. Include the authentication token in your request headers.
POST /api/ai-insights/analyze/:studentId
Generates comprehensive AI insights about a student including strengths, areas for growth, college readiness, and career recommendations.
Response:
{
"success": true,
"studentId": "...",
"studentName": "...",
"insights": {
"overallAssessment": "...",
"strengths": ["...", "..."],
"areasForGrowth": ["...", "..."],
"collegeReadinessScore": { "score": 8, "justification": "..." },
"recommendedActions": ["...", "..."],
"potentialCareers": ["...", "..."]
},
"generatedAt": "2026-01-24T..."
}POST /api/ai-insights/college-recommendations/:studentId
Uses Gemini AI to analyze colleges and provide personalized recommendations with detailed reasoning.
Request Body (optional):
{
"collegeList": [] // Optional: provide specific colleges to analyze
}Response:
{
"success": true,
"studentId": "...",
"recommendations": [
{
"collegeName": "...",
"matchScore": 9,
"reasoning": "...",
"highlights": ["...", "..."]
}
]
}POST /api/ai-insights/growth-trajectory/:studentId
Analyzes student's historical milestones and predicts future development with suggested next steps.
Response:
{
"success": true,
"predictions": {
"trajectoryAnalysis": "...",
"predictedOutcomes": ["...", "..."],
"suggestedMilestones": [
{
"title": "...",
"description": "...",
"timeframe": "3 months",
"category": "Academic"
}
],
"riskFactors": ["..."],
"accelerationOpportunities": ["..."]
}
}POST /api/ai-insights/batch-analyze
Analyze multiple students at once for dashboard overview.
Request Body:
{
"studentIds": ["id1", "id2", "id3"]
}GET /api/colleges/search
Search for colleges by name, state, size, etc.
Query Parameters:
name- College name (partial match)state- Two-letter state code (e.g., "CA", "NY")minSize- Minimum enrollment sizemaxSize- Maximum enrollment sizepage- Page number (default: 0)perPage- Results per page (default: 20)
Example:
GET /api/colleges/search?state=CA&minSize=5000&maxSize=20000
GET /api/colleges/:collegeId
Get detailed information about a specific college.
Example:
GET /api/colleges/123456
GET /api/colleges/state/:state
Get all colleges in a specific state.
Query Parameters:
page- Page number (default: 0)perPage- Results per page (default: 20)
Example:
GET /api/colleges/state/TX?page=0&perPage=50
POST /api/colleges/match/:studentId
Find colleges that match a student's academic profile (GPA, estimated SAT, etc.).
Response:
{
"success": true,
"matchedColleges": [
{
"school.name": "...",
"school.city": "...",
"school.state": "...",
"matchScore": 8,
"admissions.admission_rate.overall": 0.45,
"latest.admissions.sat_scores.average.overall": 1250
}
],
"matchCriteria": {
"estimatedSAT": 1280,
"gpaRange": "3.3 - 4.3"
}
}GET /api/colleges/recommendations/:studentId
Get categorized college recommendations (reach, target, safety) without AI analysis for faster results.
Response:
{
"success": true,
"recommendations": {
"reach": [...],
"target": [...],
"safety": [...]
},
"summary": {
"totalMatches": 50,
"reachCount": 12,
"targetCount": 25,
"safetyCount": 13
}
}POST /api/colleges/compare
Compare multiple colleges side by side.
Request Body:
{
"collegeIds": [123456, 234567, 345678]
}Response:
{
"success": true,
"colleges": [...],
"comparison": {
"admissionRates": [...],
"tuitionCosts": [...],
"sizes": [...]
}
}// Example: Analyze a student
const analyzeStudent = async (studentId) => {
try {
const response = await fetch(
`http://localhost:5001/api/ai-insights/analyze/${studentId}`,
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${clerkToken}`
}
}
);
const data = await response.json();
console.log(data.insights);
} catch (error) {
console.error('Error:', error);
}
};
// Example: Search colleges
const searchColleges = async (state) => {
try {
const response = await fetch(
`http://localhost:5001/api/colleges/search?state=${state}`,
{
headers: {
'Authorization': `Bearer ${clerkToken}`
}
}
);
const data = await response.json();
console.log(data.colleges);
} catch (error) {
console.error('Error:', error);
}
};Ensure your .env file contains:
GEMINI_API_KEY=your_gemini_api_key
COLLEGE_SCORECARD_API_KEY=your_college_scorecard_api_key
MONGODB_URI=your_mongodb_connection_string
CLERK_SECRET_KEY=your_clerk_secret
Start the server:
npm run serverThe server will run on http://localhost:5001
Test the health endpoint:
curl http://localhost:5001/api/healthTest AI analysis (requires authentication and valid student ID):
curl -X POST http://localhost:5001/api/ai-insights/analyze/YOUR_STUDENT_ID \
-H "Authorization: Bearer YOUR_TOKEN"