Development Setup
This guide covers setting up a complete development environment for working with the LLM Platform.
Development Toolsβ
Required Toolsβ
- VS Code or Cursor IDE - Recommended editors
- Node.js 20+ and npm 9+
- PHP 8.3+ and Composer 2.x
- Docker Desktop or Colima
- DDEV for Drupal development
Recommended VS Code Extensionsβ
- PHP Intelephense
- Drupal Smart Snippets
- TypeScript/JavaScript
- ESLint
- Prettier
- GitLens
Project Structureβ
LLM/
βββ _CommonNPM/ # TypeScript/Node.js packages
βββ _DrupalSource/ # Drupal modules, themes, recipes
βββ llm-platform/ # DDEV development environment
βββ Models/ # AI models and training
βββ LLM-Tools/ # Infrastructure tools
βββ Helm-Charts/ # Kubernetes deployments
TypeScript Developmentβ
Setupβ
cd _CommonNPM/[package-name]
npm install
npm run build
npm test
Development Workflowβ
# Watch mode for development
npm run dev
# Run tests in watch mode
npm run test:watch
# Check TypeScript types
npm run typecheck
# Lint and format
npm run lint:fix
TDD Workflowβ
# Start TDD cycle
npx @bluefly/tddai tdd start
# Write failing test (RED)
npm run test
# Implement code (GREEN)
npm run test
# Refactor (REFACTOR)
npm run test
# Validate coverage
npx @bluefly/tddai validate
Drupal Developmentβ
DDEV Setupβ
cd llm-platform
ddev config --project-type=drupal10
ddev start
ddev composer install
ddev drush site:install --existing-config
Module Developmentβ
# Enable a module
ddev drush en module_name -y
# Clear cache
ddev drush cr
# Run updates
ddev drush updb
# Export configuration
ddev drush cex
Syncing Changesβ
After making changes in DDEV, sync back to source:
# Sync a module
cp -r web/modules/contrib/module_name/* ../../../_DrupalSource/Modules/module_name/
# Sync configuration
ddev drush cex
cp -r config/sync/* ../../../_DrupalSource/Config/
AI Provider Setupβ
Ollama (Local Development)β
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
# Start Ollama service
ollama serve
# Pull models
ollama pull llama3.2:7b
ollama pull nomic-embed-text
# Configure in .env
echo "OLLAMA_HOST=http://localhost:11434" >> .env
OpenAI (Alternative)β
# Set API key in .env
echo "OPENAI_API_KEY=your-key-here" >> .env
Database Setupβ
Qdrant Vector Databaseβ
# Using Docker
docker run -p 6333:6333 qdrant/qdrant
# Configure in .env
echo "QDRANT_URL=http://localhost:6333" >> .env
Testingβ
Run All Testsβ
# TypeScript packages
cd _CommonNPM
npm run test:all
# Drupal modules
cd llm-platform
ddev phpunit
Code Coverageβ
# Generate coverage report
npm run test:coverage
# View coverage
open coverage/index.html
Debuggingβ
TypeScript Debuggingβ
In VS Code, use the included .vscode/launch.json
:
{
"type": "node",
"request": "launch",
"name": "Debug TypeScript",
"program": "${workspaceFolder}/src/index.ts",
"preLaunchTask": "tsc: build",
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
}
PHP/Drupal Debuggingβ
# Enable Xdebug in DDEV
ddev xdebug on
# Configure IDE for port 9003
Git Workflowβ
Branch Namingβ
feature/description
- New featuresfix/description
- Bug fixesdocs/description
- Documentationtest/description
- Test additions
Commit Messagesβ
Follow conventional commits:
feat: add new AI provider
fix: resolve connection timeout
docs: update installation guide
test: add coverage for API endpoints
Performance Optimizationβ
Node.jsβ
# Profile performance
node --inspect src/index.js
# Memory analysis
node --trace-gc src/index.js
Drupalβ
# Enable development settings
ddev drush config:set system.performance css.preprocess 0
ddev drush config:set system.performance js.preprocess 0
# Profile with XHProf
ddev xhprof on
Troubleshootingβ
Common Issuesβ
- Port conflicts: Change ports in
.env
or DDEV config - Permission errors:
chmod -R 755 files/
- Module not found:
ddev composer require
- TypeScript errors:
npm run clean && npm run build
Getting Helpβ
- Check Troubleshooting Guide
- Search GitHub Issues
- Join Community Forum