Routing & Data
Routing
Routing — Routing & Data documentation for BCP Framework.
Last updated: 2026-08-29T01:11:41
Routing
BCP Framework uses the app/ directory as the routing source of truth.
Static routes
app/page.tsx /
app/about/page.tsx /aboutDynamic segments
app/users/[id]/page.tsxA request to /users/15 receives:
{
params: {
id: "15",
},
}Catch-all segments
app/docs/[...slug]/page.tsx/docs/guides/install receives:
params.slug // ["guides", "install"]A required catch-all must consume at least one URL segment.
Optional catch-all segments
app/catalog/[[...slug]]/page.tsxBoth /catalog and /catalog/hardware/keyboards match. The base route receives slug === undefined; nested paths receive a string array.
Route groups
app/(admin)/layout.tsx
app/(admin)/settings/page.tsxThe public URL is /settings. The (admin) segment participates in filesystem layout composition but is removed from the public pathname.
Priority
When multiple patterns can match, BCP prefers:
static
→ dynamic
→ catch-all
→ optional catch-allRoute discovery rejects ambiguous patterns and duplicate public paths instead of selecting a route nondeterministically.
Layouts
Layouts are inherited from the app root through nested directories and route groups. Client navigation preserves compatible layout identities so layout state can survive page changes.
Special files
BCP recognizes route-adjacent special files including:
layout.tsx
loading.tsx
error.tsx
not-found.tsxNavigation
Use Link, navigate or useRouter from bcp for client navigation.
import {
Link,
} from "bcp";
export default function Page() {
return (
<Link href="/about">
About
</Link>
);
}