Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ DIFFBOT_API_KEY=
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=

# Analytics (required)
CLICKHOUSE_URL=http://localhost:8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=clickhouse
CLICKHOUSE_DATABASE=smry_analytics
# Analytics - PostHog (required)
POSTHOG_API_KEY=phc_xxx
POSTHOG_HOST=https://us.i.posthog.com
POSTHOG_PROJECT_ID=12345
POSTHOG_PERSONAL_API_KEY=phx_xxx
NEXT_PUBLIC_POSTHOG_KEY=phc_xxx
NEXT_PUBLIC_POSTHOG_HOST=https://us.i.posthog.com

# Alerting
ALERT_EMAIL=
Expand Down
5 changes: 3 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Article reader and summarizer with AI chat.
- **Backend**: Elysia (Bun-native web framework)
- **AI/LLM**: OpenRouter (Vercel AI SDK for streaming)
- **Auth**: Clerk (billing + JWT)
- **Database**: ClickHouse (analytics), Upstash Redis (rate limiting, chat thread storage)
- **Analytics**: PostHog (product analytics, session recording, heatmaps, LLM analytics)
- **Database**: Upstash Redis (rate limiting, chat thread storage)
- **Client Storage**: IndexedDB (offline-first chat threads), localStorage (article history, preferences)

## Project Structure
Expand All @@ -27,7 +28,7 @@ types/ Zod schemas and shared types
## Key Commands

```bash
bun dev # Start dev server (Next.js + Elysia + ClickHouse)
bun dev # Start dev server (Next.js + Elysia)
bun run build # Production build
bun run lint # ESLint
bun run typecheck # TypeScript check
Expand Down
21 changes: 11 additions & 10 deletions ONBOARDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Welcome to SMRY (internally "13ft") - an AI-powered article summarizer that bypa
bun install

# Start development environment
bun run dev # Starts ClickHouse + Elysia server + Next.js
bun run dev # Starts Elysia server + Next.js

# Or with full Docker stack
bun run dev:docker
Expand Down Expand Up @@ -58,7 +58,7 @@ SMRY fetches articles from behind paywalls using multiple extraction sources and
│ │ │
▼ ▼ ▼
┌─────────┐ ┌──────────┐ ┌──────────┐
│ Diffbot │ │OpenRouter│ │ClickHouse
│ Diffbot │ │OpenRouter│ │ PostHog
│ (API) │ │ (AI) │ │(Analytics)│
└─────────┘ └──────────┘ └──────────┘
Expand Down Expand Up @@ -98,7 +98,7 @@ SMRY/
│ └── validation/ # Zod schemas
├── types/ # TypeScript type definitions
├── tests/ # Unit and integration tests
├── docker/ # Docker and ClickHouse setup
├── docker/ # Docker setup
├── messages/ # i18n translation files
└── docs/ # Additional documentation
```
Expand All @@ -124,7 +124,7 @@ SMRY/
| Elysia | Lightweight TypeScript HTTP framework |
| Clerk | Authentication and billing |
| Upstash Redis | Serverless caching (with zlib compression) |
| ClickHouse | Analytics database |
| PostHog | Product analytics, session recording, heatmaps |
| OpenRouter | AI model access (300+ models) |
| Diffbot | AI-powered article extraction |

Expand Down Expand Up @@ -185,11 +185,13 @@ NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=
CLERK_SECRET_KEY=
CLERK_WEBHOOK_SECRET=

# Analytics
CLICKHOUSE_HOST= # ClickHouse for analytics
CLICKHOUSE_DATABASE=
CLICKHOUSE_USERNAME=
CLICKHOUSE_PASSWORD=
# Analytics (PostHog)
POSTHOG_API_KEY= # Server-side PostHog key
POSTHOG_HOST= # PostHog instance URL
POSTHOG_PROJECT_ID= # Project ID for HogQL queries
POSTHOG_PERSONAL_API_KEY= # Personal key for analytics dashboard
NEXT_PUBLIC_POSTHOG_KEY= # Client-side PostHog key
NEXT_PUBLIC_POSTHOG_HOST= # Client-side PostHog host

# Optional
NEXT_PUBLIC_API_URL= # API URL for client (default: /api)
Expand Down Expand Up @@ -427,7 +429,6 @@ bun run pages:deploy # Deploy to Cloudflare Pages
- [README.md](./README.md) - Project overview and motivation
- [DESIGN_PHILOSOPHY.md](./DESIGN_PHILOSOPHY.md) - UI/UX guidelines
- [MIGRATION_PLAN.md](./MIGRATION_PLAN.md) - Deployment guide
- [docs/clickhouse-schema.sql](./docs/clickhouse-schema.sql) - Analytics schema
- [docs/MEMORY_LEAK_FIX.md](./docs/MEMORY_LEAK_FIX.md) - Performance optimizations

---
Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@ DIFFBOT_API_KEY= # https://diffbot.com
UPSTASH_REDIS_REST_URL=
UPSTASH_REDIS_REST_TOKEN=

# Analytics - ClickHouse (use docker-compose for local dev)
CLICKHOUSE_URL=http://localhost:8123
CLICKHOUSE_USER=default
CLICKHOUSE_PASSWORD=
CLICKHOUSE_DATABASE=smry_analytics
# Analytics - PostHog
POSTHOG_API_KEY=
POSTHOG_HOST=
POSTHOG_PROJECT_ID=
POSTHOG_PERSONAL_API_KEY=
NEXT_PUBLIC_POSTHOG_KEY=
NEXT_PUBLIC_POSTHOG_HOST=

# Alerting - https://resend.com
RESEND_API_KEY=
Expand All @@ -250,7 +252,7 @@ pnpm install
2. **Set up environment variables**:
- Copy `.env.example` to `.env.local`
- Get API keys from: Clerk, OpenRouter, Diffbot, Upstash, Resend
- Run `docker-compose up -d clickhouse` for local analytics
- PostHog analytics is cloud-hosted (no local setup needed)

3. **Run development server**:
```bash
Expand Down
3 changes: 3 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import { ClerkProvider } from "@clerk/nextjs";
import { Toaster } from "@/components/ui/sonner";
import { getLocale } from 'next-intl/server';
import { JsonLd, organizationSchema, websiteSchema } from "@/components/seo/json-ld";
import { PostHogProvider } from "@/components/providers/posthog-provider";

// Root metadata - OG images are handled by file-based convention (opengraph-image.tsx)
// in each route segment for proper caching and to avoid robots.txt blocking issues
Expand Down Expand Up @@ -105,6 +106,7 @@ export default async function RootLayout({
<body
className={`${GeistSans.className} ${GeistSans.variable} ${syne.variable} ${literata.variable} ${atkinson.variable} ${merriweather.variable} bg-background text-foreground`}
>
<PostHogProvider>
<Databuddy
clientId="638f8e5f-f436-4d00-a459-66dee9152e3c"
trackPerformance
Expand All @@ -130,6 +132,7 @@ export default async function RootLayout({
</QueryProvider>
</NuqsAdapter>
</ThemeProvider>
</PostHogProvider>
</body>
</html>
</ClerkProvider>
Expand Down
Loading