AGENTS.md - Pages

Astro pages for the Baigon Portal. Marketing pages + authenticated portal pages.

Package Identity

Setup & Run

bun run dev     # Start dev server at localhost:4321
bun run build   # Build for production

Patterns & Conventions

Page Types

TypeLayoutAuthExamples
MarketingMarketingLayoutPublicindex.astro, about.astro, contact.astro
SolutionsMarketingLayoutPublicsolutions/founder.astro, solutions/c-level.astro
PortalPortalLayoutRequireddashboard.astro, admin.astro
AuthBaseLayoutPubliclogin.astro
FormsBaseLayoutPublicform.astro
LegalMarketingLayoutPubliclegal/terms.astro, legal/privacy.astro

File Organization

pages/
├── index.astro              # Homepage (marketing, packages from DB)
├── about.astro              # About page
├── contact.astro            # Contact form
├── how-it-works.astro       # Product explainer
├── login.astro              # OTP login flow
├── form.astro               # Registration/intake form
├── dashboard.astro          # User portal (protected)
├── admin.astro              # Admin panel (admin-only)
├── file/[fileId].astro      # File viewer (protected)
├── profile/[id].astro       # User profile (protected)
├── solutions/               # Solution pages by persona
│   ├── index.astro
│   ├── founder.astro
│   ├── strategist.astro
│   ├── c-level.astro
│   ├── solo-expert.astro
│   └── startup-ai.astro
├── legal/                   # Legal pages
│   ├── terms.astro
│   ├── privacy.astro
│   └── refund.astro
└── api/                     # [see api/AGENTS.md]

Page Template Pattern

---
// 1. Imports
import MarketingLayout from '../layouts/MarketingLayout.astro';

// 2. Data fetching (optional, server-side)
const db = Astro.locals.runtime?.env?.DB;
const { results } = await db?.prepare('SELECT * FROM table').all() ?? { results: [] };
---

<!-- 3. HTML with TailwindCSS -->
<MarketingLayout title="Page Title" description="SEO description">
  <div class="max-w-7xl mx-auto px-6 py-12">
    <!-- Content -->
  </div>
</MarketingLayout>

Do’s and Don’ts

Touch Points / Key Files

FileLinesPurposePattern
index.astro~1035Homepage with packagesDB fallback, Three.js effects
dashboard.astro~1258User portalPortal layout + sidebar + tabs
admin.astro~2441Admin panelRole check + admin tabs
login.astro~352OTP loginClient-side fetch to API
form.astro~1461Intake formMulti-step form + payment

JIT Index Hints

# Find marketing pages
rg -l "MarketingLayout" src/pages

# Find protected pages (portal)
rg -l "PortalLayout" src/pages

# Find pages that fetch from DB
rg -n "Astro.locals.runtime.*DB" src/pages

# Find prerendered (static) pages
rg -n "prerender = true" src/pages

# Find client-side API calls
rg -n "fetch\('/api/" src/pages

# Find dynamic routes
find src/pages -name "\[*\].*"

Common Gotchas

Pre-PR Checks

bun run build && bun run preview
# Then test the specific page you modified