A personal website powered by Astro and ATProto
ATproto Personal Website#
A personal website built with Astro that uses your ATproto repository as a CMS. Features full type safety, real-time updates, and automatic component routing.
Features#
- Type-Safe Content: Automatic TypeScript type generation from ATproto lexicon schemas
- Real-Time Updates: Live content streaming via ATproto Jetstream
- Component Registry: Type-safe mapping of lexicon types to Astro components
- Dynamic Routing: Automatic component selection based on record types
- Blog Support: Full blog post rendering with markdown support
- Gallery Display: Image galleries with EXIF data and hover effects
- Pagination: Fetch more than 100 records with cursor-based pagination
Quick Start#
-
Configure Environment:
cp env.example .env # Edit .env with your ATproto handle and DID -
Install Dependencies:
npm install -
Add Lexicon Schemas:
- Place JSON lexicon schemas in
src/lexicons/ - Update
src/lib/config/site.tswith your lexicon sources - Run
npm run gen:typesto generate TypeScript types
- Place JSON lexicon schemas in
-
Create Components:
- Create Astro components in
src/components/content/ - Register them in
src/lib/components/registry.ts - Use
ContentDisplay.astrofor automatic routing
- Create Astro components in
-
Start Development:
npm run dev
Lexicon Integration#
The system provides full type safety for ATproto lexicons:
- Schema Files: JSON lexicon definitions in
src/lexicons/ - Type Generation: Automatic TypeScript type generation
- Component Registry: Type-safe mapping of lexicon types to components
- Content Display: Dynamic component routing
See LEXICON_INTEGRATION.md for detailed instructions.
Available Scripts#
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production buildnpm run discover- Discover collections from your reponpm run gen:types- Generate TypeScript types from lexicon schemas
Project Structure#
src/
├── components/content/ # Content display components
├── lib/
│ ├── atproto/ # ATproto client and utilities
│ ├── components/ # Component registry
│ ├── config/ # Site configuration
│ ├── generated/ # Generated TypeScript types
│ ├── services/ # Content services
│ └── types/ # Type definitions
├── lexicons/ # Lexicon schema files
└── pages/ # Astro pages
Configuration#
The system is configured via environment variables and src/lib/config/site.ts:
ATPROTO_HANDLE- Your Bluesky handleATPROTO_DID- Your DID (optional, auto-resolved)SITE_TITLE- Site titleSITE_DESCRIPTION- Site descriptionSITE_AUTHOR- Site author
Adding New Content Types#
- Create a lexicon schema in
src/lexicons/ - Add it to
lexiconSourcesin site config - Run
npm run gen:types - Create a component in
src/components/content/ - Register it in
src/lib/components/registry.ts
The system will automatically route records to your components with full type safety.
Development#
- Debug mode shows component routing information
- Generic fallback for unknown record types
- Real-time updates via Jetstream
- Type-safe component registry
- Automatic type generation from schemas
License#
MIT