Tech Stack Overview
Shipr combines best-in-class tools to provide a complete SaaS foundation:| Layer | Technology | Purpose |
|---|---|---|
| Framework | Next.js 15 (App Router) | React framework with SSR/RSC |
| Auth | Clerk | User authentication & management |
| Database | Convex | Realtime backend & database |
| Styling | Tailwind CSS 4 | Utility-first CSS framework |
| UI Components | shadcn/ui + Base UI | Accessible component library |
| Analytics | PostHog + Vercel Analytics | Product & web analytics |
| Error Tracking | Sentry | Error monitoring & debugging |
| Payments | Clerk Billing | Subscription management |
| Resend | Transactional email delivery | |
| Fonts | Geist Sans/Mono/Pixel | Typography system |
| Deployment | Vercel | Hosting & edge deployment |
Provider Stack
Providers wrap the application in a specific order to ensure proper initialization and context availability. The stack is defined insrc/app/layout.tsx:106-149:
Why This Order Matters
- ThemeProvider comes first so all child components can access theme state
- PostHogProvider initializes before Clerk to ensure analytics are ready
- ClerkProviderWrapper provides authentication context
- PostHogIdentify runs after Clerk to link user identity
- ConvexClientProvider uses Clerk’s
useAuthhook for authenticated queries
Authentication Flow
Shipr uses Clerk as the single source of truth for authentication, with Convex syncing user data for database operations.Clerk → Convex Integration
The integration happens in two places: 1. Provider Setup (src/lib/convex-client-provider.tsx:16-22):
convex/auth.config.ts:1-15):
ctx.auth.getUserIdentity() in Convex functions.
User Sync Mechanism
TheuseSyncUser hook (src/hooks/use-sync-user.ts:18-51) keeps Clerk and Convex in sync:
Plan Detection
Billing plans are managed through Clerk Billing and detected via theuseUserPlan hook (src/hooks/use-user-plan.ts:24-42):
has() check and synced to Convex for server-side access.
Database Schema
Convex schema is defined inconvex/schema.ts:4-45 with four main tables:
Users Table
_id and _creationTime to every document.
Files Table
Chat Tables
API Routes
Shipr includes several API routes insrc/app/api/:
Health Check
Endpoint:GET /api/healthLocation:
src/app/api/health/route.tsPurpose: Server health monitoring
Rate Limit: 30 req/min per IP
Response:
POST /api/emailLocation:
src/app/api/email/route.tsPurpose: Send transactional emails via Resend
Auth: Clerk authentication required
Rate Limit: 10 req/min per IP
Templates:
welcome, plan-changed
Chat
Endpoint:POST /api/chatLocation:
src/app/api/chat/route.tsPurpose: AI chat streaming via Vercel AI SDK
Auth: Clerk authentication required
Rate Limit: Configurable (default 20 req/min)
Features: Tool calling, history persistence
Rate Limiting
Shipr includes an in-memory sliding window rate limiter atsrc/lib/rate-limit.ts:
Email System (Resend)
Transactional emails are managed insrc/lib/emails/:
Structure:
RESEND_API_KEY in .env. Optionally set RESEND_FROM_EMAIL to override the default sender address.
Blog System
Shipr uses a simple array-based blog system with no CMS or MDX needed: Location:src/lib/blog.tsStructure: Array of post objects in
BLOG_POSTSFeatures:
- Automatic blog index at
/blog - Individual post pages at
/blog/[slug] - Sitemap generation
- JSON-LD structured data
SEO & Structured Data
SEO configuration lives insrc/lib/constants.ts with structured data components in src/lib/structured-data.tsx.
Root Layout Metadata (src/app/layout.tsx:25-94):
File Organization
Key architectural files:| File | Purpose |
|---|---|
src/app/layout.tsx | Root layout, providers, metadata |
src/lib/convex-client-provider.tsx | Convex + Clerk integration |
src/hooks/use-sync-user.ts | Clerk to Convex user sync |
src/hooks/use-user-plan.ts | Plan gating hook |
convex/schema.ts | Database schema definition |
convex/users.ts | User CRUD mutations/queries |
convex/auth.config.ts | Clerk JWT config for Convex |
src/lib/constants.ts | SEO config, routes, structured data |
src/lib/rate-limit.ts | In-memory rate limiter |
src/lib/emails/ | Email templates & send helper |
src/lib/ai/tools/ | AI tool registry for chat |
src/lib/files/config.ts | File upload limits/types/formatting |
Next Steps
Project Structure
Explore the directory structure and file organization
Routing
Learn about route groups and navigation patterns
Providers
Deep dive into the provider stack configuration
Getting Started
Set up your development environment