- Go: 1.23 or later
- Node.js: 20 or later
- Kubernetes cluster: With Crossplane installed
- kubectl: Configured with cluster access
- Docker: For containerization
- Helm: For deployment
- make: For running common tasks
crossplane-spy/
├── backend/ # Go backend
│ ├── cmd/
│ │ └── server/ # Main application
│ ├── internal/
│ │ ├── api/ # REST API handlers
│ │ ├── k8s/ # Kubernetes client
│ │ └── models/ # Data models
│ └── pkg/ # Public packages
├── frontend/ # Next.js frontend
│ ├── app/ # Next.js App Router
│ ├── components/ # React components
│ ├── lib/ # Utilities and API client
│ └── types/ # TypeScript types
├── helm/ # Helm chart
├── docs/ # Documentation
└── Makefile # Build automation
git clone https://github.com/gravitek/crossplane-spy.git
cd crossplane-spy# Install dependencies
cd backend
go mod download
# Run backend server
go run cmd/server/main.go
# Or use make
make run-backendThe backend API will be available at http://localhost:8080.
# Install dependencies
cd frontend
npm install
# Create environment file
cp .env.local.example .env.local
# Run development server
npm run dev
# Or use make
make run-frontendThe frontend will be available at http://localhost:3000.
# From project root
make dev- Define handler in
backend/internal/api/handlers.go - Register route in
backend/internal/api/router.go - Add client method in
frontend/lib/api.ts - Create TypeScript types in
frontend/types/crossplane.ts
cd frontend
npx shadcn@latest add <component-name>Example:
npx shadcn@latest add button
npx shadcn@latest add table
npx shadcn@latest add badge- Follow standard Go conventions
- Use
gofmtfor formatting - Run
go vetbefore committing - Document exported functions
make lint-backend- Use ESLint configuration
- Follow React best practices
- Use TypeScript strict mode
- Document complex components
make lint-frontendcd backend
go test -v ./...
# With coverage
go test -v -cover ./...cd frontend
npm test# Build everything
make build
# Build backend only
make build-backend
# Build frontend only
make build-frontend# Build Docker image
make docker-build
# Run in Docker
make docker-runUse your IDE's Go debugger or add logging:
import "log"
log.Printf("Debug info: %+v", variable)Use React DevTools and browser console:
console.log('Debug info:', variable);# Using kind
kind create cluster --name crossplane-test
# Install Crossplane
helm install crossplane crossplane-stable/crossplane --namespace crossplane-system --create-namespace
# Run crossplane-spy
make dev# Backend logs
kubectl logs -f deployment/crossplane-spy -c backend
# Frontend logs
kubectl logs -f deployment/crossplane-spy -c frontend# View all available commands
make help
# Install dependencies
make deps
# Run linters
make lint
# Clean build artifacts
make clean
# Run tests
make test- Ensure
KUBECONFIGis set correctly - Check cluster access:
kubectl cluster-info - Verify RBAC permissions
- Check
NEXT_PUBLIC_API_URLin.env.local - Ensure backend is running on correct port
- Check CORS configuration
# Reset backend dependencies
cd backend
rm go.sum
go mod tidy
# Reset frontend dependencies
cd frontend
rm -rf node_modules package-lock.json
npm install