REST API (Node.js + TypeScript) for managing candidate profiles (CVs): JWT login, per-section CV management, multiple CV versions, public profile links, PDF/DOCX export (including an ATS-optimized template), and job application tracking. This is the backend for resume-vuejs-website.
- Features
- Quick start
- Running with Docker
- API documentation
- Common commands
- Troubleshooting
- Tech stack
- Contributing
- Author & License
- Authentication — JWT access/refresh (httpOnly cookie or Bearer), bcrypt, CSRF, token blacklist, log out of every device, refresh-token reuse detection, forgot/reset password, email verification, change password/email for a signed-in user (links emailed over SMTP)
- CV profile — candidate information, education, experience (with career breaks), projects, awards, certificates, references; soft delete and restore
- Multiple CV versions — each version is a subset of the entries, with its own public link and PDF
- Public profile — custom slug, public profile search, view statistics (country, traffic source, CV version)
- CV export — PDF / JSON / DOCX, several templates (
classic,modern,ats); self-scoring of the CV against 10 ATS criteria + keyword matching against a job description - CV import — from a LinkedIn export file (ZIP) or from an existing CV PDF
- Application tracking — applied / interview / offer / rejected, linked to the CV version that was sent
- Bilingual — Vietnamese/English via
Accept-Languageor?lang= - Operations — rate limit (Redis, falls back to in-memory when Redis is absent), daily Winston logs,
/health, Swagger at/api-docs
Requirements: Node.js >=20.19.0 <23.0.0 (see engines in package.json — newer Node drops Buffer.SlowBuffer, which a jsonwebtoken dependency still uses), MongoDB, Redis (optional).
npm install
npm run env:setup # cp .env.example .env, then fill in the values
npm run dev # → http://localhost:3001/healthMinimum environment variables in .env:
NODE_ENV=development
LOCAL_PORT=3001
MONGO_URI=... # or MONGOBD_USER + MONGOBD_PASSWORD
TOKEN_SECRET=... # 32+ characters
TOKEN_REFRESH=...
REDIS_URL=redis://localhost:6379 # optional
CORS_ORIGIN=https://your-frontend.example # required for the httpOnly cookie flow
Full list: .env.example. Redis on macOS: brew install redis && redis-server.
No need to install Node/Mongo locally — both run in containers (MongoDB 7, with a data volume). Redis is intentionally not containerized; the app uses in-memory storage when REDIS_URL is missing.
# Dev: hot reload, built-in dev secrets, no .env needed
docker compose up --build # → http://localhost:3001/health
# Prod: built image, needs real secrets in .env
cp .env.example .env
docker compose -f docker-compose.prod.yml up -d --build # → http://localhost:3008/health- Swagger UI:
/api-docs(JSON spec:/api-docs.json) — the complete and most up-to-date source for every endpoint. - Response/error standard:
API-STANDARD.md. - Every
/api/v1/...route requires a JWT, except the auth group. SendAuthorization: Bearer <token>or use the httpOnly cookie; when using the cookie only, state-changing requests must include a CSRF token. - Public profiles (
/api/me/...) need no login.
npm run dev # hot reload
npm run build # tsc + copy public → dist/
npm start # build + run production
npm test # Jest
npm run lint # ESLint (npm run lint:fix to autofix)| Problem | Fix |
|---|---|
| Can't connect to Mongo | Check MONGO_URI or MONGOBD_USER/MONGOBD_PASSWORD |
| No Redis | Install Redis, or unset REDIS_URL to use in-memory storage |
| CSRF error | Cookie-only requests (no Bearer) must include a CSRF token |
| Build succeeds but static files / uploads are missing | npm run copy |
| Need to read logs | The logs/ directory |
Node.js · Express 4 · TypeScript 5 (strict) · MongoDB + Mongoose 8 · Redis 4 · JWT + bcrypt · Joi · Puppeteer + pdf-lib + pdf-parse · docx · multer · Winston · Swagger · Jest · ESLint 9
mainandstagingare both GitHub-protected: no direct push, PRs required, CI must be green.- Branch off
staging, open PRs intostaging.mainonly receives code fromstagingthrough the release step; a push tomainauto-deploys to Render. - Details and rationale:
CONTRIBUTING.md. Code conventions for AI agents:CLAUDE.md. - Bug reports / suggestions: GitHub Issues.
Đạt Võ — @datvt243
License: ISC (declared in package.json; the repo has no LICENSE file yet).