- Set up package.json (ESM, scripts), tsconfig.json, vitest.config.ts - Install runtime and dev dependencies - Add CLAUDE.md with architecture notes and code quality rules - Config module with env var parsing and JWT_SECRET validation - DB schema: users + files tables with FK cascade - DB queries: createUser, getUserBy*, createFile, getFileById, getFilesByUserId, deleteFile - Tests for config, db/users, db/files (15 tests passing) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
1005 B
Markdown
29 lines
1005 B
Markdown
# Nanodrop
|
|
|
|
Simple file-sharing platform. TypeScript + Fastify + SQLite.
|
|
|
|
## Commands
|
|
|
|
- `npm test` — Run all tests (vitest)
|
|
- `npm run dev` — Start dev server (tsx)
|
|
- `npm run build` — Compile TypeScript
|
|
- `npm run register-user -- --username <user> --password <pass>` — Create user
|
|
|
|
## Architecture
|
|
|
|
- ESM throughout (`"type": "module"`)
|
|
- Fastify with server-rendered HTML pages
|
|
- SQLite via better-sqlite3 for persistence
|
|
- JWT in httpOnly cookies for auth
|
|
- PRG pattern for HTML forms (no client-side JS except copy-to-clipboard)
|
|
- Dependency injection — DB/service functions take deps as params for testability
|
|
|
|
## Code Quality
|
|
|
|
- Review code after every change. Refactor for readability.
|
|
- Use TDD: write tests first, then implement.
|
|
- Build and test after every change.
|
|
- Break large functions into smaller ones, extract duplicate code.
|
|
- Search for duplicated code in tests and extract into reusable helpers.
|
|
- Commit after every logical set of changes. Keep commits small and focused.
|