API structure
All API routes are located inapp/api/ using Next.js 16 Route Handlers:
Parse resume endpoint
Parses PDF files to extract text content.Endpoint
Implementation
Request
Response
The parser is configured with
forceMethod: "batch" for serverless compatibility. Files are limited to 5MB to prevent timeouts.Extract info endpoint
Uses OpenRouter AI to structure resume text into JSON.Endpoint
Implementation
Request
Response
User endpoints
Get user data
Retrieves user information from Supabase. Endpoint:GET /api/user
Update user
Endpoint:PATCH /api/user/update
Publish resume
Endpoint:POST /api/user/publish-resume
Makes user’s website publicly accessible.
User image
Endpoint:GET /api/user-image
Retrieves a user’s profile image URL from Clerk.
app/api/user-image/route.ts
Error handling
All API routes follow consistent error handling:Authentication
API routes use Clerk for authentication via server-side helpers:Rate limiting
Consider implementing rate limiting for production:
Best practices
- Use TypeScript - Type all request/response payloads
- Validate inputs - Check file types, sizes, and data formats
- Handle errors - Return consistent error responses
- Log errors - Use
console.errorfor debugging - Set timeouts - Configure for serverless environments
- Secure secrets - Use environment variables, never hardcode
- Return proper status codes - 200, 400, 401, 404, 500, etc.