How secondsaturday/second-saturday works
1. Overall shape
- This is a Next.js 15 App Router frontend backed by a Convex serverless backend, with Clerk handling identity and Capacitor packaging the same app for iOS and Android.
- The runtime boundary is split between:
- src/ for UI, routing, client-side state, and browser/mobile integration
- convex/ for database access, business logic, scheduled jobs, storage, and HTTP/webhook handlers
2. Primary user-facing flows
- The app is organized around a few product domains: circles, submissions, newsletters, notifications, and invites.
- Route groups under src/app/dashboard/... and src/app/invite/... map directly to those workflows, while src/app/sign-in, src/app/sign-up, and src/app/complete-profile cover onboarding and auth completion.
3. Frontend composition
- src/app/ contains the route-level pages and layouts.
- src/components/ holds reusable UI and feature components, with subfolders for dashboard, circles, submissions, newsletter, and auth.
- src/screens/ contains more screen-oriented compositions, such as the multi-circle submission experience.
4. State and integration boundary in the UI
- Client-side behavior is concentrated in src/hooks/ and src/providers/.
- Providers wire up cross-cutting services such as PostHog, OneSignal, and Capacitor.
- Hooks manage concerns like auth analytics, upload blocking, countdown timers, timezone sync, media query responsiveness, and debouncing.
5. Backend architecture
- convex/schema.ts defines the persistent data model.
- Feature modules such as circles.ts, memberships.ts, submissions.ts, newsletters.ts, notifications.ts, videos.ts, files.ts, users.ts, and prompts.ts implement the application’s server-side business logic as Convex functions.
- convex/_generated/ is the typed client/server interface consumed by the Next.js app.
6. Data and business flow
- The frontend calls Convex queries/mutations/actions to read and modify state.
- Typical flows are:
- user authenticates through Clerk
- app loads profile/circle data from Convex
- user creates or joins circles, submits content, or reads newsletters
- Convex persists the change and triggers downstream effects like notifications or emails
7. Media and video pipeline
- Media handling is split across src/lib/image.ts, src/lib/video.ts, and upload-oriented components like MediaUploader.
- The backend includes dedicated files for videoActions.ts, videos.ts, and files.ts, indicating that media is not just stored in the UI layer but processed through Convex-backed workflows.
- test/integration/mux-upload.test.ts and test/integration/mux-webhooks.test.ts show that Mux is a core external service for video upload and webhook-driven state updates.
8. Email and newsletter subsystem
- Email generation lives in src/emails/ and backend delivery logic is in convex/emails.ts, convex/newsletters.ts, convex/newsletterEmails.ts, and convex/newsletterReads.ts.
- This suggests a pipeline where Convex assembles recipient/engagement state, renders email content, and sends via Resend.
- Newsletter reading and engagement are modeled server-side rather than as purely presentational UI.
9. Notifications and push delivery
- Push notification integration spans src/lib/onesignal.ts, src/providers/onesignal-provider.tsx, and backend modules like convex/notificationPush.ts and convex/notifications.ts.
- The architecture likely uses Convex as the source of truth for notification events, with OneSignal as the external delivery channel.
10. Auth and routing boundaries
- Clerk is the identity boundary for both client and server flows.
- src/middleware.ts likely enforces route protection and session-aware redirects.
- The app has dedicated sign-in/sign-up routes and a complete-profile step, implying that authentication and profile completion are intentionally separated.
11. External webhooks and operational ingress
- src/app/api/webhooks/... contains Next.js route handlers for PostHog, Sentry, and Vercel webhooks.
- On the backend side, convex/http.ts is the Convex HTTP entrypoint, which is where service webhooks and custom endpoints typically terminate.
- This creates a clear separation between browser requests and service-to-service callbacks.
12. Observability
- sentry.client.config.ts, sentry.server.config.ts, and sentry.edge.config.ts show Sentry is wired across execution environments.
- src/lib/analytics.ts and the PostHog provider indicate product analytics are a first-class part of the client architecture.
- instrumentation.ts suggests Next.js-level startup instrumentation is also in place.
13. Mobile packaging
- ios/ and android/ are native shells around the same web app using Capacitor.
- capacitor.config.ts is the bridge between the web build and the native projects.
- The native projects are thin wrappers: the business logic remains in Next.js/Convex, while mobile-specific setup lives in platform directories.
14. Testing and delivery pipeline
- test/ contains unit and integration tests around the business domains and integrations, including submissions, newsletters, notifications, auth, and Mux.
- e2e/ contains Playwright end-to-end tests for the full user journey.
- GitHub Actions in .github/workflows/ci.yml enforce lint, type check, build, unit, and E2E verification before merge.
- The repo is therefore architected with strong separation between UI behavior tests, backend integration tests, and full-flow browser tests.
Main entry points: app App Router · test Tests · dashboard Dashboard · convex Domain Logic
Components 18
Frontend
Next.js App Router UI, shared components, and client-side integrations
- App Router · Route-level pages, layouts, auth, dashboard, invites, and API webhooks
src/app - Dashboard · Authenticated product surfaces for circles, submissions, newsletters, and notifications
src/app/dashboard - Auth Flow · Sign-in, sign-up, and profile completion routes
src/app/sign-in - Invites · Invite acceptance entrypoint and onboarding path
src/app/invite - UI Components · Reusable dashboard, circle, submission, newsletter, auth, and base UI components
src/components - Submission Screen · Multi-circle submission composition and workflow
src/screens/submissions - Client Hooks · Debounce, countdown, timezone sync, auth analytics, upload blocking, and responsiveness
src/hooks - Providers · App-wide wiring for PostHog, OneSignal, and Capacitor
src/providers - Client Lib · Analytics, dates, image/video utilities, newsletter helpers, and push support
src/lib
Backend
Convex schema, functions, and server-side workflows
- Schema · Persistent Convex data model and auth config
convex/schema.ts - Domain Logic · Circles, memberships, submissions, newsletters, notifications, users, prompts, files, videos, and media actions
convex - Convex API · Typed client/server interface consumed by the Next.js app
convex/_generated - HTTP Entry · Convex HTTP endpoint for external callbacks and custom handlers
convex/http.ts
Platform
Mobile shells, observability, and external ingress
- Native Shells · Thin iOS and Android wrappers around the web app
ios - Capacitor Bridge · Build-time bridge between Next.js and mobile shells
capacitor.config.ts - External Services · Clerk, Mux, Resend, OneSignal, PostHog, Sentry, and Vercel callbacks
- Observability · Sentry configs, instrumentation, and analytics wiring
sentry.client.config.ts
Quality
Tests and verification across UI, backend, and end-to-end flows
- Tests · Unit, integration, E2E, and CI coverage across core flows and integrations
test
Connections 22
- App Router → Dashboard: routes · Dashboard and product workflow pages live under the App Router
- App Router → Auth Flow: auth pages · Dedicated sign-in, sign-up, and profile-completion routes
- App Router → Invites: invite pages · Invite acceptance route group
- App Router → Providers: wraps · Root layout installs app-wide providers
- Dashboard → UI Components: renders · Dashboard screens compose reusable UI and feature components
- Dashboard → Client Hooks: uses · Interactive dashboard pages rely on client hooks
- Submission Screen → UI Components: composes · Submission experience is built from shared submission components
- Submission Screen → Client Hooks: uses · Screen behavior depends on countdown, upload, and sync hooks
- Providers → Client Lib: initializes · Providers wire analytics, push, and mobile integration helpers
- Client Lib → External Services: connects · Browser-side helpers integrate with external vendors
- App Router → Convex API: calls · Route handlers and client pages consume typed Convex APIs
- UI Components → Convex API: calls · Feature components read and mutate backend state through Convex
- Domain Logic → Schema: persists · Feature functions operate on the shared data model
- Domain Logic → External Services: drives · Backend workflows trigger emails, push, video, and identity-related side effects
- HTTP Entry → External Services: receives callbacks · Webhook and service ingress terminates in Convex HTTP handlers
- Observability → External Services: reports to · Client and server observability flows send telemetry externally
- Native Shells → Capacitor Bridge: uses · Native shells are configured through the Capacitor bridge
- Capacitor Bridge → App Router: packages · Mobile apps wrap the same Next.js frontend
- Tests → App Router: covers · UI tests validate route behavior and user journeys
- Tests → Domain Logic: covers · Integration tests exercise business logic and side effects
- Tests → External Services: simulates · Tests include Mux, webhook, and delivery integrations
- Tests → Observability: verifies · Observability-related behavior is exercised in test coverage