A comprehensive Node.js backend for an AI-powered resume analysis and job application platform.
- User Authentication: JWT-based authentication with user registration and login
- Resume Processing: Upload and parse PDF/DOCX resumes with text extraction
- AI-Powered Analysis: Resume analysis using OpenAI GPT-4 for ATS optimization
- Cover Letter Generation: AI-generated personalized cover letters
- Resume Optimization: AI-powered resume improvement suggestions
- Job Application Management: Track and manage job applications
- Dashboard Analytics: Usage statistics and activity tracking
- Subscription Management: Free and Pro tier support
- Runtime: Node.js 18+
- Framework: Express.js
- Database: PostgreSQL with Knex.js ORM
- Authentication: JWT (jsonwebtoken)
- File Processing: multer, pdf-parse, mammoth
- AI Integration: OpenAI GPT-4 API
- Validation: Joi
- Security: Helmet, CORS, Rate Limiting
- Node.js 18 or higher
- PostgreSQL 12 or higher
- OpenAI API key
-
Clone the repository
git clone <repository-url> cd resume-ai-backend
-
Install dependencies
npm install
-
Set up environment variables
cp env.example .env
Update the
.env
file with your configuration:# Server Configuration PORT=3000 NODE_ENV=development # Database Configuration DB_HOST=localhost DB_PORT=5432 DB_NAME=resume_ai_db DB_USER=your_db_user DB_PASSWORD=your_db_password # JWT Configuration JWT_SECRET=your_super_secret_jwt_key_here JWT_EXPIRES_IN=7d # OpenAI Configuration OPENAI_API_KEY=your_openai_api_key_here # File Upload Configuration MAX_FILE_SIZE=10485760 UPLOAD_PATH=./uploads
-
Set up the database
# Create the database createdb resume_ai_db # Run migrations npm run migrate
-
Start the development server
npm run dev
POST /api/auth/register
- User registrationPOST /api/auth/login
- User loginGET /api/auth/profile
- Get user profilePUT /api/auth/profile
- Update user profilePUT /api/auth/change-password
- Change passwordPOST /api/auth/logout
- Logout
POST /api/resume/upload
- Upload resume (PDF/DOCX)POST /api/resume/analyze
- Analyze resume with AIPOST /api/resume/optimize
- Optimize resume (Pro only)GET /api/resume
- Get user's resumesGET /api/resume/:id
- Get specific resumeGET /api/resume/:id/text
- Get resume textDELETE /api/resume/:id
- Delete resume
POST /api/job-application
- Create job applicationPOST /api/job-application/:id/cover-letter
- Generate cover letterGET /api/job-application
- Get job applicationsGET /api/job-application/:id
- Get specific applicationPUT /api/job-application/:id
- Update applicationDELETE /api/job-application/:id
- Delete applicationGET /api/job-application/:id/cover-letter
- Get cover letter
GET /api/dashboard/overview
- Dashboard overviewGET /api/dashboard/ai-usage
- AI usage statisticsGET /api/dashboard/subscription
- Subscription statusGET /api/dashboard/activity
- Recent activity feed
id
(UUID, Primary Key)email
(String, Unique)password_hash
(String)first_name
(String)last_name
(String)subscription_type
(Enum: 'free', 'pro')subscription_expires_at
(Timestamp)is_active
(Boolean)created_at
(Timestamp)updated_at
(Timestamp)
id
(UUID, Primary Key)user_id
(UUID, Foreign Key)original_filename
(String)file_path
(String)file_type
(String)file_size
(Integer)extracted_text
(Text)analysis_results
(JSON)is_processed
(Boolean)created_at
(Timestamp)updated_at
(Timestamp)
id
(UUID, Primary Key)user_id
(UUID, Foreign Key)resume_id
(UUID, Foreign Key)company_name
(String)position_title
(String)job_description
(Text)application_url
(String)application_deadline
(Timestamp)status
(Enum: 'draft', 'applied', 'interview', 'rejected', 'accepted')notes
(Text)cover_letter_data
(JSON)created_at
(Timestamp)updated_at
(Timestamp)
id
(UUID, Primary Key)user_id
(UUID, Foreign Key)request_type
(Enum: 'resume_analysis', 'cover_letter_generation', 'resume_optimization')input_data
(JSON)response_data
(JSON)status
(String)tokens_used
(Integer)cost
(Decimal)created_at
(Timestamp)updated_at
(Timestamp)
- 3 resume uploads
- 5 job applications
- 10 AI requests per month
- Basic resume analysis
- Cover letter generation
- Unlimited resume uploads
- Unlimited job applications
- Unlimited AI requests
- Advanced resume analysis
- Resume optimization
- Priority support
- JWT-based authentication
- Password hashing with bcrypt
- Rate limiting
- CORS protection
- Helmet security headers
- Input validation with Joi
- File type and size validation
Comprehensive error handling with:
- Structured error responses
- HTTP status codes
- Error codes for client handling
- Detailed logging
- Graceful degradation
# Run in development mode
npm run dev
# Run migrations
npm run migrate
# Run seeds
npm run seed
# Run tests
npm test
- Set up PostgreSQL database
- Configure environment variables
- Run database migrations
- Start the application with PM2 or similar process manager
# Production start
npm start
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT License - see LICENSE file for details