Skip to main content

Prerequisites

Before you begin, ensure you have the following installed:
  • Node.js 20+ (LTS version recommended)
  • npm (comes with Node.js)
  • Git for version control

Initial Setup

1

Clone the repository

git clone <repository-url>
cd pulse-content
2

Install dependencies

npm install
This installs all required packages including:
  • React 18.2.0
  • TypeScript 5.4.2
  • Vite 5.1.6
  • Wrangler 4.54.0 (Cloudflare Workers CLI)
  • TipTap rich text editor
  • Testing libraries (Vitest, Testing Library)
3

Configure environment variables

Create a .dev.vars file in the root directory for local development:
# Sanity CMS
SANITY_PROJECT_ID=your-project-id
SANITY_DATASET=production
SANITY_API_TOKEN=your-token-with-editor-role

# AI Services
ANTHROPIC_API_KEY=your-anthropic-key
OPENROUTER_API_KEY=your-openrouter-key

# Vector Database
PINECONE_API_KEY=your-pinecone-key
PINECONE_HOST=https://your-index.svc.region.pinecone.io

# Image Generation
KIEAI_API_KEY=your-kie-api-key

# LinkedIn Scraper
RAPIDAPI_KEY=your-rapidapi-key

# Authentication
JWT_SECRET=your-random-32-byte-hex-string

# Email (Password Reset)
RESEND_API_KEY=re_xxx
RESEND_FROM_EMAIL="Pulse Studio <[email protected]>"
APP_BASE_URL=http://localhost:5173

# Media Processing
ASSEMBLYAI_API_KEY=your-assemblyai-key
GOOGLE_DRIVE_SA_KEY=base64-encoded-service-account-json

# Optional: YBH Sales Integration
YBH_SALES_API_URL=https://api.youvebeenheard.com
YBH_SALES_API_KEY=your-shared-api-key
Generate a secure JWT_SECRET:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
4

Create first admin user

SANITY_API_TOKEN=your-token npx tsx scripts/create-admin.ts
This creates the initial admin user for the @popularit.net domain.
5

Start development servers

npm run dev
This starts two concurrent processes:
  • Vite dev server on http://localhost:5173 (frontend)
  • Cloudflare Pages Functions on http://localhost:8788 (backend API)

Development Commands

# Start dev server (Vite + Cloudflare Workers)
npm run dev

# Start only Vite (frontend)
npm run dev:vite

# Start only Cloudflare Functions (backend)
npm run dev:functions

Project Structure

pulse-content/
├── src/                      # Frontend React app
│   ├── components/          # React components
│   ├── routes/              # Page routes
│   ├── services/            # API clients (Sanity, Pinecone, Kie.ai)
│   ├── hooks/               # Custom React hooks
│   ├── utils/               # Utility functions
│   └── types/               # TypeScript types
├── functions/               # Cloudflare Pages Functions (backend)
│   └── api/                 # API endpoints
├── public/                  # Static assets
├── scripts/                 # Utility scripts
└── sanity/                  # Sanity CMS schemas

Accessing the App

Once the dev server is running:
  1. Open http://localhost:5173 in your browser
  2. Sign in at /login with your admin credentials
  3. Start creating episodes and generating content
The Vite dev server proxies /api/* requests to the Cloudflare Workers server at http://localhost:8788.

Troubleshooting

If port 5173 or 8788 is already in use:
# Kill process on port 5173
lsof -ti:5173 | xargs kill -9

# Kill process on port 8788
lsof -ti:8788 | xargs kill -9
Try clearing node_modules and reinstalling:
rm -rf node_modules package-lock.json
npm install
Ensure you have the latest Wrangler CLI:
npm install -g wrangler@latest
Verify your Sanity credentials and ensure the API token has Editor role permissions.

Next Steps

Architecture

Understand the system architecture and data flow

Testing

Learn about the testing strategy

Contributing

Read the contributing guidelines

Deployment

Deploy to production

Build docs developers (and LLMs) love