This guide will help you set up and start developing with the spike.land codebase. It covers both local development and understanding the key components.
- Clone and Install
# Clone the repository
git clone https://github.com/zerdos/spike.land.git
cd spike.land
# Install dependencies
yarn install
- Configure Environment
# Create development variables for Cloudflare Workers
cat > .dev.vars << EOL
OPENAI_API_KEY=your_openai_key
ANTHROPIC_API_KEY=your_anthropic_key
CLERK_SECRET_KEY=your_clerk_secret
EOL
- Start Development Environment
# Start everything (frontend + workers)
yarn dev
# Or start components individually:
yarn dev:fe # Frontend only
yarn dev:workers # Workers only
spike.land/
├── packages/
│ ├── code/ # Frontend React application
│ ├── spike.land/ # Main Cloudflare Worker
│ ├── js.spike.land/ # Transpiler Worker
│ └── spike-land-renderer/ # Renderer Worker
├── docs/ # Documentation
└── devcontainers/ # Development containers
- React 19-based UI
- Real-time collaboration features
- Monaco Editor integration
- Service Worker capabilities
- Authentication and authorization
- Real-time collaboration backend
- Asset serving
- AI service integration
- Code transpilation service
- ESBuild integration
- Module bundling
- Server-side rendering
- Screenshot/PDF generation
- Puppeteer integration
# Start development servers
yarn dev
# Watch terminal output for:
- Vite development server
- Worker development output
- TypeScript compilation
- Frontend changes hot reload automatically
- Worker changes trigger automatic restart
- TypeScript errors show in real-time
# Run tests
yarn test # All tests
yarn test:e2e # End-to-end tests
yarn workspace @spike-npm-land/code test # Frontend tests
# Build everything
yarn build:all
# Build specific components
yarn build:fe # Frontend only
yarn build:workers # Workers only
# Deploy to development
yarn deploy:dev
# Deploy to production
yarn deploy:prod
vite.config.ts
- Vite configurationtsconfig.json
- TypeScript configurationtailwind.config.js
- Tailwind CSS configuration
wrangler.toml
- Cloudflare Worker configurationtsconfig.json
- TypeScript configuration
- Node.js (LTS version)
- Yarn
- Git
- Wrangler CLI (
npm install -g wrangler
)
- ESLint
- Prettier
- TypeScript and JavaScript
- Tailwind CSS IntelliSense
- Cloudflare Workers
- Create feature branch
git checkout -b feature/new-feature
- Make changes following the architecture patterns
- Add tests
- Update documentation
- Create pull request
# Update all dependencies
yarn up
# Update specific package
yarn up package-name
# Check all packages
yarn types:check
# Watch mode for development
yarn workspace @spike-npm-land/code types:watch
# Format all files
yarn fmt
# Lint check
yarn lint
-
Worker Development Issues
- Ensure Wrangler is installed and authenticated
- Check
.dev.vars
configuration - Verify worker permissions in Cloudflare dashboard
-
Frontend Development Issues
- Clear Vite cache:
rm -rf node_modules/.vite
- Check for TypeScript errors:
yarn types:check
- Verify module resolution:
yarn clean && yarn install
- Clear Vite cache:
-
Build Issues
- Clear build artifacts:
yarn clean
- Verify all dependencies:
yarn install
- Check for TypeScript errors:
yarn types:check
- Clear build artifacts:
-
Check documentation:
-
Use development tools:
- Chrome DevTools for frontend debugging
- Wrangler logs for worker issues
- TypeScript compiler output
-
Review common patterns:
- Component patterns in
packages/code/src/@/components
- Worker patterns in
packages/spike.land/src
- Test patterns in respective
__tests__
directories
- Component patterns in
- Review the Architecture Overview
- Explore the Frontend Architecture
- Understand the Workers Architecture
- Learn about Data Flow
- Study the State Management
See CONTRIBUTING.md for guidelines on:
- Code style and standards
- Pull request process
- Testing requirements
- Documentation updates