next-route-graph 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +43 -276
  2. package/package.json +12 -2
package/README.md CHANGED
@@ -1,95 +1,52 @@
1
+ ````md
1
2
  # next-route-graph
2
3
 
3
- > Visualize and inspect the structure of a Next.js App Router project directly from your terminal.
4
+ > Visualize and inspect your Next.js App Router structure from the terminal.
4
5
 
5
- `next-route-graph` is a lightweight, fast, zero-config CLI tool for Next.js developers.
6
+ `next-route-graph` is a lightweight, zero-config CLI that scans your `app/` or `src/app/` directory and turns your routing structure into a clear overview.
6
7
 
7
- It scans your local App Router structure and provides useful information about routes, dynamic segments, rendering types, layouts, route handlers, and special Next.js files — without requiring any configuration or network requests.
8
+ Useful for quickly understanding unfamiliar projects, documenting routes in a GitHub README, onboarding developers, or giving AI coding tools a structured view of your project's routing architecture.
9
+
10
+ No configuration. No network requests. No Next.js runtime.
8
11
 
9
12
  ## Features
10
13
 
11
- - ⚡ **Zero-config** — Works out of the box with no configuration files.
12
- - 🚫 **Zero-network** — Analyzes your project locally without sending files or data anywhere.
13
- - 🎯 **App Router focused** — Automatically detects both `app/` and `src/app/`.
14
- - 📁 **Dynamic route support** — Detects dynamic, catch-all, and optional catch-all segments.
15
- - 🧩 **Advanced routing support** — Recognizes Route Groups, Parallel Routes, and Intercepting Routes.
16
- - 🖥️ **Rendering detection** — Identifies Server and Client components.
17
- - 📄 **Special files** — Detects Next.js App Router special files and route handlers.
18
- - 🔍 **Search & filter** — Quickly find routes matching a specific query.
19
- - 📊 **Multiple output formats** — Human-readable tree, flat route list, or machine-readable JSON.
20
- - 🚀 **Fast & lightweight** — No Next.js runtime or project configuration required.
14
+ - Detects static, dynamic, catch-all, and optional catch-all routes
15
+ - Supports Route Groups, Parallel Routes, and Intercepting Routes
16
+ - Detects Server/Client rendering
17
+ - Detects layouts, route handlers, and special App Router files
18
+ - Tree, flat, and JSON output
19
+ - Route search and filtering
20
+ - Lightweight and fast
21
21
 
22
22
  ## Installation
23
23
 
24
- ### Run with npx
25
-
26
- The easiest way to use `next-route-graph`:
27
-
28
24
  ```bash
29
25
  npx next-route-graph
30
26
  ```
27
+ ````
31
28
 
32
- ### Install globally
33
-
34
- You can also install it globally:
29
+ Or install globally:
35
30
 
36
31
  ```bash
37
32
  npm install -g next-route-graph
38
33
  ```
39
34
 
40
- Then run:
41
-
42
- ```bash
43
- next-route-graph
44
- ```
45
-
46
35
  ## Usage
47
36
 
48
- Run the CLI from the root of your Next.js project:
37
+ Run from your Next.js project:
49
38
 
50
39
  ```bash
51
40
  npx next-route-graph
52
41
  ```
53
42
 
54
- The CLI automatically detects your App Router directory:
55
-
56
- ```text
57
- app/
58
- ```
59
-
60
- or:
61
-
62
- ```text
63
- src/app/
64
- ```
65
-
66
- You can also provide a custom project path:
43
+ Analyze another project:
67
44
 
68
45
  ```bash
69
46
  npx next-route-graph ./my-next-app
70
47
  ```
71
48
 
72
- ## Example
73
-
74
- For a project with the following structure:
75
-
76
- ```text
77
- src/app/
78
- ├── [locale]/
79
- │ ├── about/
80
- │ │ └── page.tsx
81
- │ ├── concepts/
82
- │ │ ├── [category]/
83
- │ │ │ └── [slug]/
84
- │ │ │ └── page.tsx
85
- │ │ └── page.tsx
86
- │ └── page.tsx
87
- ├── api/
88
- │ └── route.ts
89
- └── layout.tsx
90
- ```
91
-
92
- `next-route-graph` produces a route overview such as:
49
+ Example output:
93
50
 
94
51
  ```text
95
52
  Project my-next-app
@@ -100,268 +57,78 @@ Routes
100
57
  ────────────────────────────────────────
101
58
  ├── /[locale] page.tsx [dynamic]
102
59
  ├── /[locale]/about page.tsx [dynamic]
103
- ├── /[locale]/concepts page.tsx [dynamic]
104
- ├── /[locale]/concepts/[category] page.tsx [dynamic]
105
- ├── /[locale]/concepts/[category]/[slug] page.tsx [dynamic]
60
+ ├── /[locale]/blog page.tsx [dynamic]
61
+ ├── /[locale]/blog/[slug] page.tsx [dynamic]
106
62
  └── /api route.ts
107
63
 
108
64
  Summary
109
65
  ────────────────────────────────────────
110
- Routes 6
111
- Dynamic 5
66
+ Routes 5
67
+ Dynamic 4
112
68
  Client 0
113
- Server 6
69
+ Server 5
114
70
  Layouts 1
115
- Loading 0
116
- Errors 0
117
-
118
- ✓ Analysis completed in 18ms
119
71
  ```
120
72
 
121
- ## CLI Options
73
+ ## CLI
74
+
75
+ ```text
76
+ next-route-graph
77
+ next-route-graph <projectPath>
78
+ next-route-graph --flat
79
+ next-route-graph --json
80
+ next-route-graph --search <query>
81
+ next-route-graph --help
82
+ next-route-graph --version
83
+ ```
122
84
 
123
85
  ### `--flat`
124
86
 
125
- Output only route paths as a flat list.
87
+ Show only route paths:
126
88
 
127
89
  ```bash
128
90
  npx next-route-graph --flat
129
91
  ```
130
92
 
131
- Example:
132
-
133
- ```text
134
- /[locale]
135
- /[locale]/about
136
- /[locale]/concepts
137
- /[locale]/concepts/[category]
138
- /api
139
- ```
140
-
141
- This format is useful when you only need the route paths without additional metadata.
142
-
143
93
  ### `--json`
144
94
 
145
- Output the complete analysis as machine-readable JSON.
95
+ Output structured JSON for scripts, automation, AI tools, or CI:
146
96
 
147
97
  ```bash
148
98
  npx next-route-graph --json
149
99
  ```
150
100
 
151
- This is useful for scripts, automation, CI workflows, and other development tools.
152
-
153
- ### `--search <query>`
101
+ ### `--search`
154
102
 
155
- Filter routes using a search query.
103
+ Filter routes:
156
104
 
157
105
  ```bash
158
106
  npx next-route-graph --search blog
159
107
  ```
160
108
 
161
- For example:
162
-
163
- ```text
164
- /blog
165
- /blog/[slug]
166
- /blog/archive
167
- ```
168
-
169
- Search can be combined with other output modes:
170
-
171
- ```bash
172
- npx next-route-graph --search blog --flat
173
- ```
174
-
175
- or:
109
+ Options can be combined:
176
110
 
177
111
  ```bash
178
112
  npx next-route-graph --search blog --json
179
113
  ```
180
114
 
181
- ### `<projectPath>`
182
-
183
- Analyze a specific Next.js project instead of the current directory.
184
-
185
- ```bash
186
- npx next-route-graph ./my-next-app
187
- ```
188
-
189
- ## Command Reference
190
-
191
- | Command / Option | Description |
192
- | -------------------------------- | ----------------------------------- |
193
- | `next-route-graph` | Analyze the current Next.js project |
194
- | `next-route-graph <projectPath>` | Analyze a specific project |
195
- | `--flat` | Output only route paths |
196
- | `--json` | Output machine-readable JSON |
197
- | `--search <query>` | Filter routes by search string |
198
- | `--help` | Show CLI help |
199
- | `--version` | Show the installed version |
200
-
201
- ## Supported Next.js Routing Features
202
-
203
- `next-route-graph` understands common Next.js App Router conventions, including:
204
-
205
- ### Static Routes
206
-
207
- ```text
208
- /about
209
- /dashboard
210
- /settings/profile
211
- ```
212
-
213
- ### Dynamic Routes
214
-
215
- ```text
216
- /[id]
217
- /products/[productId]
218
- ```
219
-
220
- ### Catch-all Routes
221
-
222
- ```text
223
- /docs/[...slug]
224
- ```
225
-
226
- ### Optional Catch-all Routes
227
-
228
- ```text
229
- /docs/[[...slug]]
230
- ```
231
-
232
- ### Route Groups
233
-
234
- ```text
235
- /(marketing)/about
236
- ```
237
-
238
- ### Parallel Routes
239
-
240
- ```text
241
- /dashboard/@analytics
242
- ```
243
-
244
- ### Intercepting Routes
245
-
246
- ```text
247
- (.)photo
248
- (..)photo
249
- (...)photo
250
- ```
251
-
252
- ### Route Handlers
253
-
254
- ```text
255
- /api/users/route.ts
256
- ```
257
-
258
- ### Special App Router Files
259
-
260
- The analyzer detects relevant Next.js App Router files such as:
261
-
262
- ```text
263
- layout.tsx
264
- page.tsx
265
- loading.tsx
266
- error.tsx
267
- not-found.tsx
268
- route.ts
269
- ```
270
-
271
- ## Output Formats
272
-
273
- `next-route-graph` currently provides three output modes.
274
-
275
- ### Tree
276
-
277
- The default output provides a human-readable overview of the project.
278
-
279
- ```bash
280
- npx next-route-graph
281
- ```
282
-
283
- ### Flat
284
-
285
- Outputs only route paths.
286
-
287
- ```bash
288
- npx next-route-graph --flat
289
- ```
290
-
291
- ### JSON
292
-
293
- Outputs structured data for programmatic use.
294
-
295
- ```bash
296
- npx next-route-graph --json
297
- ```
298
-
299
- ## Why next-route-graph?
300
-
301
- Next.js App Router projects can become difficult to navigate as the number of routes, layouts, dynamic segments, and special files grows.
302
-
303
- `next-route-graph` gives you a quick overview of the routing structure directly from your terminal.
304
-
305
- No configuration.
306
-
307
- No network requests.
308
-
309
- No Next.js runtime.
310
-
311
- Just run it and inspect your routes.
312
-
313
115
  ## Development
314
116
 
315
- Clone the repository:
316
-
317
117
  ```bash
318
118
  git clone https://github.com/Nima-sltn/next-route-graph.git
319
119
  cd next-route-graph
320
- ```
321
-
322
- Install dependencies:
323
-
324
- ```bash
325
120
  npm install
326
- ```
327
-
328
- Run tests:
329
-
330
- ```bash
331
121
  npm test
332
- ```
333
-
334
- Run type checking:
335
-
336
- ```bash
337
122
  npm run typecheck
338
- ```
339
-
340
- Build the project:
341
-
342
- ```bash
343
123
  npm run build
344
124
  ```
345
125
 
346
- ## Contributing
347
-
348
- Contributions, bug reports, feature requests, and improvements are welcome.
349
-
350
- If you find an issue or have an idea for improving `next-route-graph`, feel free to open an issue or submit a pull request.
351
-
352
- Before submitting a pull request, please make sure that:
353
-
354
- - Tests are passing.
355
- - Type checking passes.
356
- - The project builds successfully.
357
-
358
126
  ## License
359
127
 
360
- MIT © 2026 Next Route Map Contributors
128
+ MIT © 2026 Nima Soltanian
361
129
 
362
- See the [LICENSE](./LICENSE) file for the full license text.
130
+ [GitHub](https://github.com/Nima-sltn/next-route-graph) · [npm](https://www.npmjs.com/package/next-route-graph)
363
131
 
364
- ## Links
132
+ ```
365
133
 
366
- - **npm:** https://www.npmjs.com/package/next-route-graph
367
- - **GitHub:** https://github.com/Nima-sltn/next-route-graph
134
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-route-graph",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Visualize and inspect the structure of a Next.js App Router project from the terminal",
5
5
  "type": "module",
6
6
  "bin": {
@@ -28,8 +28,18 @@
28
28
  "route-map",
29
29
  "typescript"
30
30
  ],
31
- "author": "Next Route Map Contributors",
31
+ "author": {
32
+ "name": "Nima Soltanian",
33
+ "url": "https://github.com/Nima-sltn"
34
+ },
32
35
  "license": "MIT",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/Nima-sltn/next-route-graph.git"
39
+ },
40
+ "bugs": {
41
+ "url": "https://github.com/Nima-sltn/next-route-graph/issues"
42
+ },
33
43
  "dependencies": {
34
44
  "commander": "^12.1.0",
35
45
  "picocolors": "^1.1.0"