How saurabh27kashyap/time works
Purpose and runtime
Memento is a TypeScript/React life-planning application: it visualizes remaining life in weeks, tracks life aspects and time thieves, supports dated “horizons” (goals), and provides an AI coach to turn goals into plans. It runs as a TanStack Start SSR application with a Node 22+ server runtime, Vite build pipeline, Tailwind v4, and shadcn/ui primitives.
Key startup and routing surfaces:
• src/start.ts
• src/server.ts
• src/router.tsx
• src/routes/__root.tsx
Route-level application shell
TanStack file routes define the product’s primary pages and API boundary. The root route supplies the shared application shell; route generation is represented by src/routeTree.gen.ts.
Primary user entry points:
• Dashboard/life overview: src/routes/index.tsx
• AI coach: src/routes/coach.tsx
• Goal horizon planning: src/routes/horizon.tsx
• Per-aspect detail: src/routes/aspects.$aspect.tsx
• Time-thief tracking and settings: src/routes/time-thieves.tsx, src/routes/settings.tsx
Client state and life-domain model
The application’s central client-side state is managed in src/lib/store.tsx. Domain modules separate calculations and typed concepts for life timeline, aspects, horizons, and distracting activities:
• src/lib/life.ts
• src/lib/aspects.ts
• src/lib/horizon.ts
• src/lib/thieves.ts
UI routes and components consume this shared model to derive calendar/life-grid views, remaining-week statistics, goals, and category-specific planning. This is a client-state boundary: the supplied tree shows no database, persistence adapter, or authentication layer.
Life visualization and dashboard composition
The dashboard composes timeline-oriented visual components around the life model. Its main presentation stages are:
1. Establish calendar/life anchors.
2. Render near-term and whole-life week grids.
3. Show current metrics and live countdown.
4. Surface goals and coaching guidance.
Core components:
• src/components/CalendarAnchors.tsx
• src/components/NearTermGrid.tsx
• src/components/WeeksGrid.tsx
• src/components/LiveTicker.tsx
• src/components/StatsStrip.tsx
• src/components/GoalCard.tsx
Horizon planning workflow
Horizons are dated planning objects, represented in the domain layer and managed through dedicated creation, card, and timeline views. Users can create a horizon, inspect its timeline, and relate it to life aspects and coach-generated plans.
Relevant boundaries:
• Horizon model/calculation: src/lib/horizon.ts
• Horizon page: src/routes/horizon.tsx
• Creation and visualization: src/components/HorizonCreator.tsx, src/components/HorizonCard.tsx, src/components/HorizonTimeline.tsx
AI coach and server API boundary
AI functionality is server-only. The chat route receives coach requests, assembles structured user/life context, invokes AI tools/functions, and returns generated coaching or plans. Browser components should interact through the API route rather than import the provider directly.
Core paths:
• HTTP endpoint: src/routes/api/chat.ts
• Provider and Groq credential access: src/lib/ai-provider.server.ts
• Context construction: src/lib/coach-context.ts
• Coach tools/functions: src/lib/coach.functions.ts
• Coach UI: src/components/CoachMessage.tsx, src/routes/coach.tsx
Groq is the sole identified external service, accessed via Vercel AI SDK. GROQ_API_KEY remains server-side; absent configuration degrades only AI features.
Cross-cutting interaction and failure handling
Navigation is organized through the application sidebar, while onboarding initializes or guides the user into the life-planning experience. Error capture/page modules provide a distinct failure-handling boundary for route or application errors.
• src/components/AppSidebar.tsx
• src/components/Onboarding.tsx
• src/lib/error-capture.ts
• src/lib/error-page.ts
Main entry points: __root.tsx Application shell · store.tsx Life planning state · index.tsx Life dashboard · chat.ts Coach chat API
Components 22
SSR runtime & routing
- Application startup
src/start.ts - Node SSR server
src/server.ts - Router
src/router.tsx - Application shell · Shared shell for all product routes.
src/routes/__root.tsx - Generated route tree
src/routeTree.gen.ts - Error handling · Captures and renders route or application failures.
src/lib/error-capture.ts
Client life planning
- Navigation & onboarding
src/components/AppSidebar.tsx - Life dashboard
src/routes/index.tsx - Life timeline visuals · Anchors, week grids, live ticker, and statistics.
src/components/WeeksGrid.tsx - Goal cards
src/components/GoalCard.tsx - Life planning state · Central in-memory state boundary; no persistence or auth layer is identified.
src/lib/store.tsx - Life & aspects model · Timeline calculations and life-aspect concepts.
src/lib/life.ts - Horizon model
src/lib/horizon.ts - Time-thief model
src/lib/thieves.ts - Planning routes · Horizon, aspect detail, time-thief, and settings pages.
src/routes/horizon.tsx - Horizon workflow UI · Creation, cards, and timeline visualization.
src/components/HorizonCreator.tsx
AI coach
- Coach page
src/routes/coach.tsx - Coach messages
src/components/CoachMessage.tsx - Coach chat API · Server-only boundary for coaching requests and generated plans.
src/routes/api/chat.ts - Coach context
src/lib/coach-context.ts - Coach tools
src/lib/coach.functions.ts - Groq provider · Uses server-side GROQ_API_KEY via Vercel AI SDK.
src/lib/ai-provider.server.ts
Connections 26
- Application startup → Node SSR server: starts
- Node SSR server → Router: serves SSR requests
- Router → Generated route tree: uses
- Generated route tree → Application shell: resolves routes
- Application shell → Navigation & onboarding: hosts
- Application shell → Life dashboard: renders
- Application shell → Planning routes: renders
- Application shell → Coach page: renders
- Application shell → Error handling: handles failures with
- Life dashboard → Life timeline visuals: composes
- Life dashboard → Goal cards: surfaces
- Life dashboard → Life planning state: reads
- Life timeline visuals → Life & aspects model: derives timeline from
- Life planning state → Life & aspects model: manages
- Life planning state → Horizon model: manages
- Life planning state → Time-thief model: manages
- Planning routes → Horizon workflow UI: hosts horizon planning
- Horizon workflow UI → Horizon model: creates and visualizes
- Planning routes → Life planning state: reads and updates
- Coach page → Coach messages: renders
- Coach page → Coach chat API: sends coach requests · Browser access stays behind the API boundary.
- Coach chat API → Coach context: assembles context
- Coach chat API → Coach tools: invokes tools
- Coach chat API → Groq provider: generates coaching with
- Coach context → Life & aspects model: uses life data
- Coach context → Horizon model: uses goals