A Node.js server built with tRPC that provides an AI-powered CV and job description matching service. The service analyzes both documents and provides insights about candidate's fit for the position.
- PDF processing for CVs and job descriptions
- AI-powered analysis using Gemini 1.5 Flash
- Candidate strengths and weaknesses identification
- Job fit evaluation
- Type-safe API using tRPC
- Rate limiting protection
- Comprehensive error handling
- File upload management
- Node.js 18 or higher (required for global fetch)
- npm or pnpm package manager
- Access to Gemini AI API
- Clone the repository:
git clone [your-repository-url]
cd [repository-name]- Install dependencies:
npm install
# or if using pnpm
pnpm install- Configure environment variables:
cp env.example .envEdit .env file with your configuration:
AI_API_TOKEN=your_api_token_here
AI_API_ENDPOINT=https://intertest.woolf.engineering/invoke
MAX_REQUESTS_PER_MINUTE=20
MAX_REQUESTS_PER_HOUR=300
PORT=3000
UPLOAD_DIR=files
MAX_FILE_SIZE=5242880
NODE_ENV=developmentnpm run devThis will start both the server and client in development mode with hot reloading.
npm run build
npm run startEndpoint: match.analyzePdfs
Description: Analyzes a CV and job description to evaluate candidate fit.
Input Parameters:
cv: PDF file containing the candidate's CVvacancy: PDF file containing the job description
Response Format:
{
result: {
score: number; // Overall match score (0-100)
strengths: string[]; // List of candidate's strengths
weaknesses: string[]; // List of candidate's weaknesses
recommendations: string[]; // Improvement suggestions
}
}- 20 requests per minute
- 300 requests per hour
The API returns structured error responses in the following format:
{
code: string; // Error code
message: string; // Human-readable error message
details?: unknown; // Additional error details if available
}Common Error Codes:
RATE_LIMIT_EXCEEDED: Request exceeds rate limitINVALID_FILE_FORMAT: Uploaded file is not a valid PDFFILE_TOO_LARGE: File size exceeds maximum limitAI_SERVICE_ERROR: Error from AI analysis servicePARSE_ERROR: Error parsing PDF content
- File uploads are limited to 5MB
- Only PDF files are accepted
- Temporary files are automatically cleaned up
- Rate limiting prevents abuse
- Environment variables for sensitive configuration
Run the test suite:
npm run testFor development testing with hot reload:
npm run test-dev├── src/
│ ├── client/ # Client-side code
│ ├── server/ # Server implementation
│ │ ├── config/ # Configuration
│ │ ├── middleware/# Express middleware
│ │ ├── routers/ # tRPC routers
│ │ ├── services/ # Business logic
│ │ ├── types/ # TypeScript types
│ │ └── utils/ # Utility functions
│ └── shared/ # Shared types and utilities
├── test/ # Test files
├── files/ # Temporary file storage
└── logs/ # Application logs
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For support, please open an issue in the GitHub repository or contact the maintainers.