Skip to content

Commit 6c8fa57

Browse files
authored
feat: custom book covers per org (#105)
1 parent 9386fa6 commit 6c8fa57

20 files changed

Lines changed: 9826 additions & 8039 deletions

‎CLAUDE.md‎

Lines changed: 1 addition & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
A scalable, distributed system for extracting and transforming LibreTexts content (hosted on the Mindtouch/NICE CXOne platform) into export formats like PDF and EPUB. It runs as two separate workers: an Express API and a background job processor.
88

9-
## Commands
10-
11-
```bash
12-
# Development
13-
npm run dev:api # Run API worker with hot reload
14-
npm run dev:processor # Run processor worker with hot reload
15-
16-
# Build
17-
npm run build # Compile TypeScript to ./build (also copies src/styles)
18-
19-
# Lint
20-
npm run lint # ESLint check
21-
npm run lint-and-fix # ESLint with auto-fix
22-
npm run prettier # Format all .ts files
23-
24-
# Database
25-
npm run sync-db-schema # Sync Sequelize models to DB
26-
27-
# No tests are currently implemented
28-
```
29-
30-
### Docker Development
31-
32-
```bash
33-
# Start ephemeral MySQL only
34-
docker compose -f docker-compose-mysql.dev.yml up -d
35-
36-
# Start full stack (MySQL + API + Processor)
37-
docker compose -f docker-compose.dev.yaml up -d
38-
39-
# Build and run with local changes (uses run-dev-build.sh)
40-
./run-dev-build.sh
41-
```
42-
43-
### Test a job request
9+
## Test a job request
4410

4511
```bash
4612
curl --request POST \
@@ -73,18 +39,6 @@ GET /api/v1/download/:bookID/:format/:fileName
7339
→ DownloadController → CloudFront signed URL redirect
7440
```
7541

76-
### Key Directories
77-
78-
- **`src/api/`** — Express route definitions + Zod validation schemas
79-
- **`src/controllers/`** — HTTP request handlers (`job.ts`, `download.ts`)
80-
- **`src/services/`** — Core business logic: `job.ts` (orchestration), `book.ts` (page discovery), `pdf.ts` (Prince XML), `epub.ts` (EPUB packaging), `library.ts` (CXOne API client)
81-
- **`src/lib/`** — Infrastructure clients: `queueClient.ts` (SQS), `storageService.ts` (S3), `environment.ts` (env var access), `cxOneRateLimiter.ts`
82-
- **`src/util/`** — Stateless helpers (MathJax rendering, PDF utilities, licensing, page IDs)
83-
- **`src/CXOne/`** — LibreTexts CXOne Expert API integration
84-
- **`src/model/`** — Sequelize-TypeScript ORM models (`Job`)
85-
- **`src/lambda/`** — AWS Lambda for CloudWatch backlog-per-instance metrics
86-
- **`src/styles/`** — CSS copied into build output, used for PDF rendering
87-
8842
### Validation Pattern
8943

9044
All API routes use a shared `validateZod` middleware that attaches the validated payload to `req.data`. Handlers are typed as `ZodRequest<T>` for downstream type safety. Zod schemas live in `src/api/`.
@@ -100,13 +54,6 @@ All API routes use a shared `validateZod` middleware that attaches the validated
10054

10155
See `.env.example` for all variables. Key required vars: `AWS_REGION`, `BUCKET`, `CLOUDFRONT_*`, `SQS_*_QUEUE_URL`, `NODE_ENV`. Database vars (`DB_HOST`, `DB_USER`, `DB_PASSWORD`, `DB`) are optional and support read replicas (`*_READ` variants).
10256

103-
## Code Style
104-
105-
- TypeScript strict mode; decorators enabled for Sequelize models (`experimentalDecorators`, `emitDecoratorMetadata`)
106-
- Prettier: 120-char line width, single quotes, 2-space indent, trailing commas
107-
- `@typescript-eslint/no-explicit-any` is disabled — `any` is permitted
108-
- Commits follow Conventional Commits (enforced by commitlint + Husky)
109-
11057
## Code discovery
11158

11259
Before any Grep, Glob, or exploratory Read, call `codegraph_explore` with the

0 commit comments

Comments
 (0)