agentleFS
golid-aigolid-ai/golid/.cursor/rules/solidstart-routing.mdc

golid / rules

Cursor rule40 starsChanged 6 months agoMITView on GitHub

SolidStart route groups, layout boundaries, and auth chrome for (private) and (public) routes

The file

We split this solidstart-routing.mdc into the rules it gives an agent

6 rules. About 0 are common, 3 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do not duplicate the same URL under both groups.

    line 34
  2. Distinctive:

    When adding a protected page:

    line 43
  3. Very specific:

    Place it under frontend/src/routes/(private)/.

    line 45
  4. Very specific:

    Add the path to PRIVATE_ROUTES in frontend/src/lib/constants.ts — SSR auth redirects won't work without this.

    line 46
  5. Very specific:

    Use redirectTo (not return, next, or redirect) for login redirects.

    line 48
  6. Distinctive:

    After routing or chrome changes, reproduce in a real browser.

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
solidstart-routing.mdc
---
description: SolidStart route groups, layout boundaries, and auth chrome for (private) and (public) routes
globs: frontend/src/app.tsx,frontend/src/routes/**/*.tsx,frontend/src/lib/constants.ts,frontend/src/components/organisms/navigation/**/*.tsx
alwaysApply: false
---

# SolidStart Routing and Layout Boundaries

> **Thesis:** Route groups `(private)` and `(public)` organize auth boundaries
> without adding URL segments. Layout files and `PRIVATE_ROUTES` must stay in
> sync so SSR and SPA navigation agree.

**Reference files:** `frontend/src/routes/(private).tsx`,
`frontend/src/routes/(public).tsx`, `frontend/src/lib/constants.ts`,
`frontend/src/app.tsx`, navigation components under `frontend/src/components/organisms/navigation/`.

## Route Groups Do Not Change URLs

SolidStart groups like `(private)` and `(public)` are path-transparent.
Files under `frontend/src/routes/(private)/dashboard/index.tsx` serve `/dashboard`,
not `/(private)/dashboard`.

```tsx
// Layout boundary — auth required
frontend/src/routes/(private).tsx

// Page — URL is /dashboard
frontend/src/routes/(private)/dashboard/index.tsx

// Public auth pages — URL is /login
frontend/src/routes/(public)/login/index.tsx
```

Do not duplicate the same URL under both groups. One route file owns each path.

## Private vs Public Layouts

- **`(public).tsx`** — no auth required. Landing (`/`) is full-bleed; auth pages
  use constrained width.
- **`(private).tsx`** — auth required. SSR middleware redirects unauthenticated
  users; client-side effect in the layout is a safety net for SPA navigation.

When adding a protected page:

1. Place it under `frontend/src/routes/(private)/`.
2. Add the path to `PRIVATE_ROUTES` in `frontend/src/lib/constants.ts` — SSR auth
   redirects won't work without this.
3. Use `redirectTo` (not `return`, `next`, or `redirect`) for login redirects.

## Audit The Whole Shell

`app.tsx` root layout wraps every route. When changing auth or navigation:

- Navbar links and active states
- Sidebar visibility (private routes only)
- Footer variants
- Root layout spacing tied to private-route detection

A page can render correctly while global chrome still shows wrong links or
sidebar state for the route group.

## Auth Guards in Layout vs Page

- **Layout-level:** `(private).tsx` blocks unauthenticated access to all child routes.
- **Page-level:** role or resource checks (e.g., admin-only) belong in the page
  component. Prefer `<Show when={...} fallback={...}>` over early returns before
  reactive setup — early returns skip signal creation and break re-renders when
  async guards later pass.

## Verify In A Browser

After routing or chrome changes, reproduce in a real browser. Architecture tests
can assert imports and source shape, but Solid Router interception, layout
persistence, and global shell behavior are runtime facts.

## Related rules

- `solidjs-pages` — page data fetching and content-state patterns inside routes.
- `codebase-standards` — `PRIVATE_ROUTES`, `redirectTo`, `Switch/Match` guardrails.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.