What is path/case?
path/case is a naming convention where words are separated by forward slashes (/) and all letters are lowercase. It mirrors the structure of file system paths and URL paths.
Examples:
user/profile/settings
api/v1/users
app/components/button
home/documents/filesWhen to Use path/case
- File paths: Directory and file structures (/home/user/documents)
- URL paths: Website routing (example.com/blog/post-title)
- API endpoints: RESTful API routes (/api/v1/users)
- Route definitions: In web frameworks (Next.js, React Router)
- Module paths: Importing files and modules
- Breadcrumb trails: Navigation hierarchies
Examples in Code
File System Paths:
/home/user/documents/report.pdf
/var/www/html/index.html
./src/components/Header.tsxURL Routing:
https://example.com/blog/getting-started
https://api.example.com/v1/users/123
/dashboard/settings/profileNext.js App Router:
app/dashboard/page.tsx
app/blog/[slug]/page.tsx
app/api/users/route.tsCommon Use Cases
Web Development
URL structures for clean, SEO-friendly paths and RESTful API endpoints.
File Systems
Navigating directories and organizing files in a hierarchical structure.
Module Imports
Referencing files and modules in programming projects.
Best Practices
- ✓ Use for hierarchical structures
- ✓ Keep paths concise and meaningful
- ✓ Use lowercase for consistency
- ✓ Avoid special characters in paths
- ✗ Don't make paths too deep (limit nesting)
- ✗ Avoid spaces or special characters