Markdown Converter
Agent skill for markdown-converter
Aerobea Timeline is a Next.js application that visualizes fictional political timelines for imaginary countries. It displays interactive timelines showing presidents/leaders and monarchs with their terms, lifespans, and party affiliations. The app features AI-powered generation of leader names and p
Sign in to like and favorite skills
Aerobea Timeline is a Next.js application that visualizes fictional political timelines for imaginary countries. It displays interactive timelines showing presidents/leaders and monarchs with their terms, lifespans, and party affiliations. The app features AI-powered generation of leader names and portraits.
app/ # Next.js App Router ├── api/ # REST API routes │ ├── [country]/ # Dynamic country endpoints │ ├── admin/ # Admin CRUD endpoints │ ├── ai/ # AI generation endpoints (generate, edit, review) │ ├── bootstrap/ # Database initialization │ └── upload/ # File upload to Vercel Blob ├── admin/ # Admin dashboard UI ├── fog/ # Alternative "fog of war" timeline view ├── page.tsx # Main timeline visualization └── layout.tsx # Root layout components/ # React components ├── TimelineGrid.tsx # Grid of president cards ├── PresidentCard.tsx # Individual president card with visual bars ├── ProgressBar.tsx # Interactive timeline scrubber └── MusicControls.tsx # Web Audio synthesizer controls lib/ # Utilities and types ├── timeline.ts # Type definitions and helpers ├── prisma.ts # Prisma client singleton ├── serialize.ts # JSON serialization utilities └── adminValidation.ts # Input validation for admin endpoints data/ # Static bootstrap data ├── bootstrapCountries.ts # Pre-populated country data ├── exitReasons.ts # Presidential exit scenarios └── deathReasons.ts # Death cause descriptions prisma/ # Database schema and migrations scripts/ # Utility scripts (migration, testing)
pnpm dev # Start development server (localhost:3000) pnpm build # Generate Prisma types + build for production pnpm start # Run production build npx prisma generate # Generate Prisma client types npx prisma migrate dev # Run database migrations
DATABASE_URL # PostgreSQL connection string OPENAI_API_KEY # For GPT text generation FAL_API_KEY # For AI image generation VERCEL_BLOB_TOKEN # For file storage (optional for local dev)
interface President { id: string; name: string; party: string; birthDate: Date; deathDate?: Date; deathCause?: string; termStart: Date; termEnd?: Date; exitReason?: string; imageUrl?: string; } interface Monarch { id: string; name: string; birthDate: Date; deathDate?: Date; deathCause?: string; reignStart: Date; reignEnd?: Date; } interface Country { id: string; code: string; name: string; presidents: President[]; monarchs: Monarch[]; startYear: number; endYear: number; }
| Endpoint | Method | Purpose |
|---|---|---|
| GET | Fetch all countries with presidents & monarchs |
| GET | Fetch presidents for a country |
| POST | Create new country |
| PUT | Update country |
| POST | Generate president images via FAL AI |
| POST | Initialize database with bootstrap data |
isPresident(), isObject()) for runtime validation'use client' directive for interactive componentslib/prisma.ts (avoids connection leaks)lib/adminValidation.tsgrid-template-columns: repeat(auto-fill, minmax(150px, 1fr))The timeline plays back at ~90x speed (1 day per 4ms). Each PresidentCard shows:
Dates are stored as ISO strings in JSON but converted to Date objects when used:
// Serialization (lib/serialize.ts) president.birthDate = new Date(data.birthDate);
return NextResponse.json({ data }, { status: 200 }); return NextResponse.json({ error: message }, { status: 400 });
if (error instanceof Prisma.PrismaClientKnownRequestError) { if (error.code === 'P2002') // Unique constraint violation if (error.code === 'P2025') // Record not found }
No test suite currently implemented. Manual testing via:
/scripts/ for API testing (test-fal.ts, test-upload.ts)next.config.mjs (currently *.public.blob.vercel-storage.com)#countrycode)