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.varsfile inchat-worker/with required secrets
Clone and Install
bash
git clone git@github.com:Anshul-Homelab/portfolio.git
cd portfolio
npm installRun the Site Locally
bash
npm run devThe site runs at http://localhost:6173.
Run the Chat Worker Locally
The chat system runs as a separate Cloudflare Worker. To develop it locally:
- Generate the knowledge base (required before first run):
bash
npm run generate-kb- Create
chat-worker/.dev.varswith 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>- Start the worker:
bash
cd chat-worker
npm install
npm run devThe worker runs at http://localhost:8787.
Run Tests
bash
# E2E tests (Playwright)
npm test
# With UI mode
npm run test:uiUseful Scripts
| Script | Description |
|---|---|
npm run dev | Start Next.js dev server on port 6173 |
npm run build | Production build |
npm run lint | Run ESLint |
npm run typecheck | Run TypeScript type checking |
npm test | Run Playwright E2E tests |
npm run generate-kb | Generate chatbot knowledge base |
npm run optimize-images | Optimize 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 pipelinesSee Directory Structure for a detailed breakdown.