Skip to content

Getting Started

Prerequisites

  • Node.js 20+ (LTS recommended)
  • npm 10+
  • Git

For the chat worker (local development):

  • Wrangler CLI (npm install -g wrangler)
  • A .dev.vars file in chat-worker/ with required secrets

Clone and Install

bash
git clone git@github.com:Anshul-Homelab/portfolio.git
cd portfolio
npm install

Run the Site Locally

bash
npm run dev

The site runs at http://localhost:6173.

Run the Chat Worker Locally

The chat system runs as a separate Cloudflare Worker. To develop it locally:

  1. Generate the knowledge base (required before first run):
bash
npm run generate-kb
  1. Create chat-worker/.dev.vars with the required secrets:
bash
GEMINI_API_KEY=<your-gemini-api-key>
RATE_LIMIT_BYPASS_TOKEN=<any-secret-string>
SLACK_BOT_TOKEN=<slack-bot-oauth-token>
SLACK_CHANNEL_ID=<slack-channel-id>
  1. Start the worker:
bash
cd chat-worker
npm install
npm run dev

The worker runs at http://localhost:8787.

Run Tests

bash
# E2E tests (Playwright)
npm test

# With UI mode
npm run test:ui

Useful Scripts

ScriptDescription
npm run devStart Next.js dev server on port 6173
npm run buildProduction build
npm run lintRun ESLint
npm run typecheckRun TypeScript type checking
npm testRun Playwright E2E tests
npm run generate-kbGenerate chatbot knowledge base
npm run optimize-imagesOptimize images with Sharp

Project Structure

portfolio/
├── src/                    # Next.js application source
│   ├── app/                # App router pages and layouts
│   ├── components/         # React components
│   ├── images/             # Static images
│   └── lib/                # Utilities and helpers
├── chat-worker/            # Cloudflare Worker for chat
│   ├── src/                # Worker source code
│   └── wrangler.toml       # Worker configuration
├── e2e/                    # Playwright E2E tests
├── scripts/                # Build and utility scripts
├── docs-site/              # This documentation site
└── .github/workflows/      # CI/CD pipelines

See Directory Structure for a detailed breakdown.