- TypeScript 97.4%
- Dockerfile 1.2%
- CSS 1.1%
- JavaScript 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| public | ||
| src | ||
| .dockerignore | ||
| .env.example | ||
| .gitignore | ||
| AGENTS.md | ||
| Dockerfile | ||
| eslint.config.mjs | ||
| next.config.ts | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
| tsconfig.json | ||
Resume desk
Keep your resumes and write cover letters for job listings.
Upload a resume as a PDF, paste a link to a job posting (typically spb.hh.ru),
pick which resume to write from, and get a draft cover letter grounded in the
text of that resume. Accounts are local (email + password); resumes, extracted
text, generated letters, and provider keys are all kept locally in data/
(gitignored) and scoped to the account that created them.
Getting started
pnpm install
pnpm dev
Then open http://localhost:3000, create an account, and go to Settings to
paste an API key for at least one provider. No .env.local is required — keys
are entered in the app and stored encrypted in the local database.
Accounts
Register with an email and password; there is no email verification and nothing
is sent off the machine. Passwords are stretched with scrypt
(src/lib/password.ts) and only the hash is stored. A session is a random
256-bit token kept in an httpOnly cookie; the database stores only its SHA-256
digest, so a copy of data/app.db does not hand out live logins.
Every row of user data carries a user_id, and the Data Access Layer
(src/lib/auth.ts) resolves the signed-in user on every read and write. A
src/proxy.ts gate redirects signed-out visitors to /login before rendering,
but that is only an optimistic check — the real authorization happens next to
the data, so one account can never read another's resumes, letters, or keys.
Sign out from the header. Sessions last 30 days.
Providers
The app talks to any OpenAI-compatible Chat Completions endpoint. Two are wired
up out of the box; adding another means copying a block in
src/lib/ai.ts (PROVIDER_DEFINITIONS).
| Provider | Base URL | Notes |
|---|---|---|
| Ollama Cloud | https://ollama.com/v1 |
gemma4:31b is included in the free plan. The DeepSeek models require usage credits. |
| Timeweb AI Gateway | https://api.timeweb.ai/v1 |
Standard OpenAI-compatible gateway; works with the OpenAI SDK. |
A provider shows up in the model picker once your key is saved on the Settings
page. API keys are encrypted with AES-256-GCM before they are written to
data/app.db; the Settings page only ever shows a masked tail (••••1a2b), and
each account has its own set of keys and model choices.
Once a key is saved, the Settings page calls the provider's GET /models and
lists what it offers. Tick the models the cover-letter form should offer and mark
one as the default; the choice is stored in provider_settings. Nothing is
cached — the list is fetched each time Settings is opened, so a provider that is
down shows an error and falls back to the models already saved.
Reasoning models answer in two steps: a chain of thought, then the letter. On
Timeweb that thinking is billed against the same completion budget, and
zai/glm-5.3-flash can spend several thousand tokens on it, so a reply that
comes back as reasoning alone — an empty content with a length finish — is
retried with a larger budget (8k, then 32k) before the generation is reported as
failed.
Web search while writing
When an Ollama key is saved, the model can call two tools while drafting a letter:
web_search(query)— current facts about a company, role, or product.fetch_page(url)— opens a page and returns its text plus links on the same site, so a URL you put in the notes can be read and its same-origin links followed.
Both use Ollama's native web_search / web_fetch endpoints under the saved
Ollama key, so no extra credential is needed. Without an Ollama key — or if the
chosen model or gateway rejects tools — generation simply runs without them. The
number of tool round-trips per letter is capped.
API keys at rest
The encryption master key is read from RESUME_APP_SECRET when set. Otherwise a
32-byte key is generated once and kept at data/secret.key (mode 0600), beside
the database — fine for a laptop, but for a shared or hosted deployment set
RESUME_APP_SECRET to a value from your secret store. Changing or losing the
master key makes previously saved API keys undecryptable; delete them on the
Settings page and enter them again.
Non-secret configuration
Only provider endpoints stay in environment variables. Copy .env.example to
.env.local to override one:
OLLAMA_BASE_URL=https://ollama.com/v1
TIMEWEB_BASE_URL=https://api.timeweb.ai/v1
OLLAMA_SEARCH_URL=https://ollama.com/api/web_search
OLLAMA_FETCH_URL=https://ollama.com/api/web_fetch
Model ids may contain colons (for example ollama:gemma4:31b); only the first
colon separates the provider from the model.
Timeouts are in milliseconds and only need changing for a model or host that is slower than the defaults:
GENERATION_TIMEOUT_MS=600000 # one model call during a background first draft (10 min)
CHAT_TIMEOUT_MS=180000 # one model call while revising a letter (3 min, synchronous)
A first draft is written in the background, so it is allowed the long budget; a revision still answers the browser's request, so it keeps the shorter one.
Docker
docker build -t resume-app .
docker run -d --name resume-app -p 3000:3000 \
-v resume-app-data:/app/data \
-e RESUME_APP_SECRET="$(openssl rand -base64 32)" \
resume-app
/app/data holds the SQLite database (accounts, resumes, letters, keys), the
uploaded PDFs, and (unless RESUME_APP_SECRET is set) the encryption key, so
mount a volume there or the container starts empty and forgets its accounts and
keys. Create an account and add API keys from the Settings page once it is
running. .env* and data/ are excluded from the build context, so no keys or
resumes end up baked into an image layer; the container runs as the non-root
node user.
The image needs no C++ toolchain: better-sqlite3 ships prebuilt binaries and
its build scripts are declined in pnpm-workspace.yaml.
How it works
- Accounts (
src/lib/auth.ts,src/lib/users.ts,src/lib/password.ts) register and sign users in with scrypt-hashed passwords and database-backed sessions.src/lib/auth.tsis the Data Access Layer:getCurrentUser()is the one place the session is read, and every page and Server Action goes through it. - Uploads (
src/app/actions.ts) go through a Server Action, are parsed withunpdf, and the extracted text is stored in SQLite (better-sqlite3) underdata/app.db; the PDF is written todata/uploads/. - Keys (
src/lib/credentials.ts) are encrypted persrc/lib/crypto.tsand stored in theprovider_credentialstable, keyed by user and provider. They are decrypted only when a model is called or a provider is listed. - Models (
src/lib/provider-settings.ts) record which of a provider's models are offered and which is the default, per user. The list to choose from is fetched live from the provider on the Settings page; only the choice is stored. - Listings (
src/lib/job-listing.ts) are fetched server-side. hh.ru blocks its JSON API from many networks and answers non-browserAcceptheaders with406, so the vacancy is read from the entity-encoded JSON that hh.ru embeds in the page. Other hosts fall back to stripped page text. - Letters (
src/lib/generate.ts) are produced by prompting the selected model with the posting and the resume. The system prompt forbids inventing facts and asks for the language of the posting. When an Ollama key is present the model is also offeredweb_search/fetch_pagetools (src/lib/web-tools.ts), and the tool loop lives inchat(). - Letter length is a per-user preference (
letter_settings, chosen under Settings → Cover letter length). The selected range is copied onto each letter when it is queued, so the first draft and later revisions keep it; letters written before the setting existed fall back to the current preference. - Generation runs in the background (
src/lib/letter-jobs.ts). The form's Server Action only creates an empty letter row, queues it inletter_jobs, and schedules the work withafterbefore redirecting to the letter page — so a model call that takes minutes cannot hold the request open or be cut off by a gateway timeout. The page shows a "writing" panel and polls itself while the job is queued or running, and shows the error with a Try again button if it fails. Becauseafter()is bound to the process, a job left running by a restart is marked failed when the database is next opened, so a letter never spins forever. - Chat on a letter's page (
src/components/letter-chat.tsx,src/lib/generate.ts'sreviseCoverLetter) sends a request to the same model and rewrites the letter from it; each reply is stored inletter_messagesand the letter'sbodyis updated. The first draft's reasoning and web lookups (letter_traces, when the provider exposes thinking) and every reply's own thinking and lookups are shown inline in that conversation. Letters are saved and can be edited or copied from the letter page.
Notes
data/holds personal documents, the accounts, and the encryption key; it is gitignored. Back it up if it matters — and keep the backup private.- A
data/app.dbwritten before accounts existed has nouser_idcolumns. The app refuses to open it and tells you to deletedata/and start again. - Cover letters are drafts. Read them before sending.