Skip to content

Commit b9e685c

Browse files
committed
Update CLAUDE.md
1 parent 7244b7c commit b9e685c

File tree

1 file changed

+95
-4
lines changed

1 file changed

+95
-4
lines changed

CLAUDE.md

Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,42 @@
1-
This is the monorepo for Remix, a cutting edge web framework. All packages are contained in the `./packages` dir.
1+
This is the monorepo for Remix, a cutting edge web framework.
22

33
In addition to this file, see `CONTRIBUTING.md` for further guidelines about developing in this repository.
44

5+
## Package Structure
6+
7+
- All packages are contained in the `./packages` dir
8+
- Each package has its own isolated dependencies and build process
9+
- Common directory structure:
10+
- `src/` contains source files
11+
- `src/lib/` contains implementation files
12+
- Test files are named `*.test.ts` and located alongside source files
13+
- Each package contains a `README.md` with an introduction, goals, feature set, usage patterns, etc.
14+
- Each package contains a `CHANGELOG.md` that describes changes that have been made in each release
15+
- Unreleased changes go in a section with the `HEAD` heading
16+
517
## Development
618

7-
You should be able to run the tests without building first.
19+
All tests run directly on source files without building first.
20+
21+
When making changes to a package (adding new features or fixing bugs), include an accompanying entry in the package's `CHANGELOG.md` describing the change. Include a small snippet that demonstrates intended usage when applicable.
22+
23+
Also, check its `README.md` to ensure all examples are still relevant and up to date, and consider adding meaningful examples for new features.
24+
25+
## Common Commands
826

927
```sh
28+
# Install dependencies
29+
$ pnpm install
30+
1031
# Run all tests
1132
$ pnpm test
12-
# Run the tests for a specific package
33+
34+
# Run tests for a specific package
1335
$ pnpm --filter @remix-run/headers run test
1436

1537
# Build all packages
1638
$ pnpm run build
39+
1740
# Build a specific package
1841
$ pnpm --filter @remix-run/headers run build
1942
```
@@ -22,6 +45,10 @@ $ pnpm --filter @remix-run/headers run build
2245

2346
- Use `node:test` and `describe/it` style to organize test suites
2447
- Make assertions using `node:assert/strict`
48+
- Test files are named `*.test.ts` and located alongside source files
49+
- Run tests with: `pnpm --filter <package-name> run test`
50+
- Tests automatically clean up test directories in `afterEach` hooks
51+
- Always verify that tests pass after making changes
2552

2653
## Releasing
2754

@@ -34,11 +61,75 @@ To cut a release:
3461
```sh
3562
# To bump the headers package to the next minor release
3663
$ pnpm run tag-release headers minor
64+
3765
# Then publish it using the newly created tag
3866
$ pnpm run publish-release [email protected]
3967
```
4068

41-
## Code Style
69+
## Code Patterns and Style
4270

4371
- Prefer `let` for all variables, unless they are defined in global or module-level scope
4472
- Only make comments to explain unusual code, do not comment on obvious code
73+
- Use private fields with `#` prefix for class internals (e.g., `#dirname`)
74+
- Imports: Use `node:` prefix for Node.js built-in modules (e.g., `node:fs`, `node:path`)
75+
- TypeScript: Define explicit types for function parameters and return values
76+
77+
## Package-Specific Notes
78+
79+
### @remix-run/fetch-proxy
80+
81+
- Creates fetch-like functions that forward requests to target servers with automatic URL path concatenation
82+
- Built-in cookie rewriting for proper domain/path handling in proxy contexts
83+
- Preserves all request properties and optionally adds X-Forwarded headers
84+
- Useful for building API gateways, reverse proxies, or request forwarding scenarios
85+
86+
### @remix-run/file-storage
87+
88+
- LocalFileStorage stores files in hash-based subdirectories (using first 2 chars of SHA-256 hash)
89+
- Each file has two parts: `.dat` (data) and `.meta.json` (metadata)
90+
- Empty directories should be cleaned up after file removal
91+
- The storage directory structure prevents filesystem limitations with too many files in one directory
92+
93+
### @remix-run/form-data-parser
94+
95+
- Handles multipart form data parsing
96+
- Integrates with file storage implementations for handling file uploads
97+
98+
### @remix-run/headers
99+
100+
- Utilities for working with HTTP headers
101+
102+
### @remix-run/lazy-file
103+
104+
- Provides `LazyFile` and `LazyBlob` classes that defer content loading until needed, ideal for large files
105+
- Seamlessly extends native `File`/`Blob` APIs - can be used anywhere regular File/Blob objects are expected
106+
- Filesystem integration via `openFile()` and `writeFile()` functions that stream content
107+
- Efficient slicing with byte ranges without loading data into memory
108+
109+
### @remix-run/multipart-parser
110+
111+
- Universal JavaScript with zero dependencies, works in any JS environment (Node, Deno, Bun, Workers)
112+
- Streaming architecture yields parts as found rather than buffering entire request
113+
- Built-in file size protection with configurable limits (maxFileSize, maxHeaderSize)
114+
- High-level `parseMultipartRequest()` API automatically validates and parses multipart requests
115+
116+
### @remix-run/node-fetch-server
117+
118+
- Build Node.js HTTP servers using web-standard Request/Response objects instead of req/res
119+
- Drop-in compatible with http.createServer(), https.createServer(), and HTTP/2
120+
- Built-in streaming support for efficient handling of large payloads
121+
- Optional access to client connection info (IP, port) and custom hostname configuration
122+
123+
### @remix-run/route-pattern
124+
125+
- Full URL matching beyond just pathnames - includes protocol, hostname, pathname, and search params
126+
- Rich pattern features: params (:name), globs (\*name), optionals (pattern), and enums {jpg,png,gif}
127+
- Zero dependencies and runtime agnostic - works everywhere
128+
- Smart pattern parsing automatically detects URL components based on pattern structure
129+
130+
### @remix-run/tar-parser
131+
132+
- Streaming-first architecture built on Web Streams API, processes without buffering entire archive
133+
- Comprehensive format support: POSIX (ustar), GNU (with long filenames), and PAX formats
134+
- Simple async handler API - each TarEntry provides header metadata and body stream
135+
- Zero dependencies and platform agnostic - runs in any JavaScript environment

0 commit comments

Comments
 (0)