Skip to content

MaitreyeeDeshmukh/Arc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Arc

Arc is an AI-powered content strategy system built for startup founders. It turns weekly check-ins — 6 questions about what happened in your startup that week — into platform-native content plans with scripts, captions, and hashtags for Instagram, TikTok, and LinkedIn. Every plan is tailored to the founder's archetype, narrative phase, and historical performance data.


Stack

Layer Technology
Framework Next.js 14 (App Router)
Database Supabase (Postgres + Auth + Storage)
AI generation OpenAI GPT-4o / Anthropic Claude (fallback)
Background jobs Inngest
Payments Stripe
Email Resend + React Email
Rate limiting Upstash Redis
Analytics PostHog
Error tracking Sentry
Testing Vitest + Playwright
Deployment Vercel

Local Development

Prerequisites

  • Node.js 20+
  • npm
  • Supabase CLIbrew install supabase/tap/supabase
  • Active accounts: Supabase, OpenAI, Stripe, Resend, Upstash, Inngest, PostHog, Sentry

Setup

# 1. Clone and install dependencies
git clone https://github.com/MaitreyeeDeshmukh/arc.git
cd arc
npm install

# 2. Start Supabase locally
supabase start          # starts local Postgres + Auth + Storage
supabase db push        # applies migrations from supabase/migrations/

# 3. Configure environment variables
cp .env.example .env.local
# Edit .env.local — see the Environment Variables section below

# 4. Run the dev server
npm run dev

Open http://localhost:3000.

Test Supabase E2E (optional)

For E2E tests a separate Supabase project is recommended:

export PLAYWRIGHT_BASE_URL=http://localhost:3000
export NEXT_PUBLIC_SUPABASE_URL=https://your-test-project.supabase.co
# ... fill remaining test env vars
npm run test:e2e

Environment Variables

Copy .env.example to .env.local and fill in each value.

Supabase

Variable Where to find it
NEXT_PUBLIC_SUPABASE_URL Supabase dashboard → Settings → API → Project URL
NEXT_PUBLIC_SUPABASE_ANON_KEY Supabase dashboard → Settings → API → anon key
SUPABASE_SERVICE_ROLE_KEY Supabase dashboard → Settings → API → service_role key — never expose in browser

AI Providers

Variable Where to find it
OPENAI_API_KEY platform.openai.com → API Keys
ANTHROPIC_API_KEY console.anthropic.com → API Keys — used as GPT-4o fallback

Stripe

Variable Where to find it
STRIPE_SECRET_KEY Stripe dashboard → Developers → API keys → Secret key
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY Stripe dashboard → Developers → API keys → Publishable key
STRIPE_WEBHOOK_SECRET Stripe dashboard → Webhooks → your endpoint → Signing secret
STRIPE_PRO_PRICE_ID Stripe dashboard → Products → your Pro product → price ID (starts with price_)
STRIPE_FOUNDER_PRICE_ID Stripe dashboard → Products → your Founder product → price ID

Email

Variable Where to find it
RESEND_API_KEY resend.com → API Keys

Rate Limiting

Variable Where to find it
UPSTASH_REDIS_REST_URL upstash.com → your database → REST API
UPSTASH_REDIS_REST_TOKEN upstash.com → your database → REST API

Background Jobs

Variable Where to find it
INNGEST_EVENT_KEY inngest.com → your app → Manage → Event Keys
INNGEST_SIGNING_KEY inngest.com → your app → Manage → Signing Key

Encryption

Variable Description
ENCRYPTION_KEY 64-character hex string (32 random bytes). Generate with: node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Analytics & Monitoring

Variable Where to find it
NEXT_PUBLIC_POSTHOG_KEY posthog.com → your project → Settings → Project API Key
NEXT_PUBLIC_POSTHOG_HOST https://app.posthog.com (EU: https://eu.posthog.com)
SENTRY_DSN sentry.io → your project → Settings → Client Keys (DSN)
NEXT_PUBLIC_SENTRY_DSN Same value as SENTRY_DSN — safe to expose publicly

Deploy to Vercel

  1. Import your GitHub repository at vercel.com/new.

  2. Set all environment variables in the Vercel dashboard (Settings → Environment Variables). Copy every key from .env.example.

  3. Supabase: In Supabase dashboard → Authentication → URL Configuration:

    • Site URL: https://your-domain.vercel.app
    • Redirect URLs: https://your-domain.vercel.app/auth/callback
  4. Deploy — Vercel auto-deploys on every push to main.

  5. After first deployment, register the Stripe webhook and connect Inngest (see sections below).


Stripe Webhook Setup

After deploying to Vercel:

  1. Stripe dashboard → Developers → Webhooks → Add endpoint
  2. Endpoint URL: https://your-domain.vercel.app/api/webhooks/stripe
  3. Events to listen for:
    • checkout.session.completed
    • invoice.payment_succeeded
    • invoice.payment_failed
    • customer.subscription.deleted
    • customer.subscription.updated
  4. Click Add endpoint, then reveal the Signing secret
  5. Copy it to the STRIPE_WEBHOOK_SECRET environment variable in Vercel and redeploy

Local testing: Use the Stripe CLI:

stripe listen --forward-to localhost:3000/api/webhooks/stripe

Inngest Setup

  1. Create a free account at inngest.com
  2. Create a new app — copy Event KeyINNGEST_EVENT_KEY and Signing KeyINNGEST_SIGNING_KEY
  3. In Vercel, add both keys as environment variables and redeploy
  4. In the Inngest dashboard → Apps → Sync app → enter your Vercel URL
  5. Inngest will call https://your-domain.vercel.app/api/inngest to register functions

Local development: Run the Inngest Dev Server:

npx inngest-cli@latest dev

Then open http://localhost:8288 to trigger and inspect background jobs.

Registered functions:

  • generate-content-plan — triggered by checkin/submitted
  • compute-performance-summary — cron every night at 02:00 UTC
  • weekly-reminder — cron every Monday at 08:00 UTC

Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run test         # Run unit + integration tests (Vitest)
npm run test:watch   # Watch mode
npm run test:coverage # Coverage report
npm run test:e2e     # End-to-end tests (Playwright)

Production Checklist

Before going live, verify each item:

  • All 19 environment variables set in Vercel dashboard
  • Supabase Site URL and Redirect URLs updated to production domain
  • Supabase email templates customised (Auth → Email Templates)
  • Stripe webhook endpoint registered with correct events and signing secret
  • Stripe products created with STRIPE_PRO_PRICE_ID and STRIPE_FOUNDER_PRICE_ID
  • Stripe billing portal configured (dashboard.stripe.com/settings/billing/portal)
  • Inngest app synced to production URL
  • Resend domain verified with DNS (SPF + DKIM records at resend.com/domains)
  • PostHog project created, key + host set in Vercel env
  • Sentry project created, DSN set in Vercel env
  • Google OAuth redirect URI added: https://your-domain.vercel.app/auth/callback (Google Cloud Console)
  • ENCRYPTION_KEY set in Vercel env (generate fresh key, do not reuse dev key)
  • npm run test passes (CI blocks merge on failure)
  • Run through full user flow: signup → onboarding → check-in → plan → view → log performance

Architecture Notes

  • Auth: Supabase Auth with cookie-based sessions via @supabase/ssr
  • Middleware: protects /dashboard, /checkin, /plans, /settings; redirects incomplete onboarding to /onboarding/3
  • AI Pipeline: GPT-4o → extract story → generate plan → scripts → captions → eval; Claude fallback for extraction step
  • Free tier: 1 content plan per month, 2 posts per plan (enforced in API + pipeline)
  • Prompt injection protection: check-in answers sanitised before AI injection via lib/sanitize.ts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors