Cursor rule
.cursor/rules/astro-ssr-patterns.mdcAstro server-side rendering best practices and patterns
Cursor rules
Quality
49/100
Scores the file, not the repository.Length
240 words
4 headings · 1 code blocksRepository
0
— · pushed 262 days agoLast changed
3 days ago
First indexed 3 days ago.123456# Astro SSR Best Practices78## Prefer Server-Side Rendering Over Client-Side910- **Always prefer SSR**: Use Astro frontmatter for data fetching instead of client-side JavaScript when possible11- **Move API calls to frontmatter**: Fetch data during build/server time rather than in `<script>` tags12- **Eliminate loading states**: Server-rendered content appears immediately without spinners or skeleton screens13- **Improve SEO**: Search engines can index server-rendered content1415## Example Pattern1617```astro18---19// ✅ GOOD: Server-side data fetching20import { SomeService } from '../services/someService';2122const db = (Astro.locals.runtime?.env?.DB as D1Database) || null;23let data: { items: any[]; error?: string } = { items: [] };2425if (db) {26 try {27 const service = SomeService.getInstance(db);28 const items = await service.fetchData();29 data = { items };30 } catch (err) {31 data = { items: [], error: err instanceof Error ? err.message : 'Unknown error' };32 }33}34---3536<div>37 {data.error ? (38 <p class="text-red-500">Error: {data.error}</p>39 ) : data.items.length > 0 ? (40 <div>41 {data.items.map((item) => (42 <div>{item.name}</div>43 ))}44 </div>45 ) : (46 <p>No data available</p>47 )}48</div>4950<!-- ❌ AVOID: Client-side fetching for initial data -->51<!-- <script>52 fetch('/api/data').then(response => {53 // Don't do this for initial page data54 });55</script> -->56```5758## When to Use Client-Side JavaScript5960- **Interactive features**: User interactions, form submissions, dynamic updates61- **Real-time updates**: WebSocket connections, polling for live data62- **Progressive enhancement**: Adding interactivity to server-rendered content63- **Client-only APIs**: Browser APIs like geolocation, camera, etc.
Also in sferg989/fergfo.om
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| sferg989/fergfo.om.cursor/rules/astro-component-structure.mdc · 0 | Cursor rules | stylearchui | 58/100 | 3 days ago | |
| sferg989/fergfo.om.cursor/rules/astro-database-integration.mdc · 0 | Cursor rules | database | 50/100 | 3 days ago | |
| sferg989/fergfo.om.cursor/rules/astro-error-handling.mdc · 0 | Cursor rules | styledatabaseui | 58/100 | 3 days ago | |
| sferg989/fergfo.om.cursor/rules/astro-performance-patterns.mdc · 0 | Cursor rules | buildstyledatabaseperformance | 62/100 | 3 days ago | |
| sferg989/fergfo.om.cursor/rules/ts-typecheck.mdc · 0 | Cursor rules | do-not | 23/100 | 3 days ago | |
| sferg989/fergfo.om.cursor/rules/ts.mdc · 0 | Cursor rules | styletypesdo-notdocs | 55/100 | 3 days ago | |
| sferg989/fergfo.om.cursorrules · 0 | .cursorrules | do-not | 49/100 | 3 days ago | |
| sferg989/fergfo.omCLAUDE.md · 0 | CLAUDE.md | setupbuildteststyle+7 | 89/100 | 3 days ago |
Diff against .cursor/rules/astro-component-structure.mdc Diff against .cursor/rules/astro-database-integration.mdc Diff against .cursor/rules/astro-error-handling.mdc Diff against .cursor/rules/astro-performance-patterns.mdc Diff against .cursor/rules/ts-typecheck.mdc Diff against .cursor/rules/ts.mdc Diff against .cursorrules Diff against CLAUDE.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
