Setting up the repository
This guide walks you through setting up the DeepIntShield repository for local development, from prerequisites to running your first development server.
Prerequisites
Section titled “Prerequisites”Before setting up the repository, ensure you have the following tools installed:
- Go (1.25.5)
- Node.js (>= 18.0.0) and npm
- Make
- Docker (optional, for containerized development)
- Air (for hot reloading, auto-installed by Makefile when needed)
- golangci-lint (optional, for linting)
- goimports (optional, for code formatting)
Clone the Repository
Section titled “Clone the Repository”# Clone the repositorygit clone https://github.com/maximhq/deepintshield.gitcd deepintshield
# Verify the repository structurels -laYou should see the main directories: core/, framework/, transports/, ui/, plugins/, docs/, etc.
Repository Structure
Section titled “Repository Structure”DeepIntShield uses a modular architecture with the following structure:
deepintshield/├── core/ # Core functionality and shared components│ ├── providers/ # Provider-specific implementations (OpenAI, Anthropic, etc.)│ ├── schemas/ # Interfaces and structs used throughout DeepIntShield│ └── deepintshield.go # Main DeepIntShield implementation├── framework/ # Framework components for common functionality│ ├── configstore/ # Configuration storages│ ├── logstore/ # Request logging storages│ └── vectorstore/ # Vector storages├── transports/ # HTTP gateway and other interface layers│ └── deepintshield-http/ # HTTP transport implementation├── ui/ # Web interface for HTTP gateway├── plugins/ # First party plugins├── docs/ # Documentation and guides└── tests/ # Comprehensive test suitesThe system uses a provider-agnostic approach with well-defined interfaces in core/schemas/ for easy extension to new AI providers.
Learn More About the Architecture:
- Request Flow - Deep dive into how requests are processed from transport to provider
- Plugin System - How plugins extend functionality
- Framework Components - Shared storage and utilities
- MCP Integration - Model Context Protocol implementation
Development Environment Setup
Section titled “Development Environment Setup”Quick Start (Recommended)
Section titled “Quick Start (Recommended)”The fastest way to get started is using the complete development environment:
# Start complete development environment (UI + API with hot reload)make devThis command will:
- Install UI dependencies automatically
- Install Air for hot reloading
- Set up the Go workspace with local modules
- Start the Next.js development server (port 3000)
- Start the API server with UI proxy (port 8080)
Access the application at: http://localhost:8080
Manual Setup (Alternative)
Section titled “Manual Setup (Alternative)”If you prefer to set up components manually:
1. Install UI Dependencies
Section titled “1. Install UI Dependencies”# Install UI dependencies and toolsmake install-ui2. Install Air for Hot Reloading
Section titled “2. Install Air for Hot Reloading”# Install Air if not already installedmake install-air3. Set Up Go Workspace
Section titled “3. Set Up Go Workspace”# Set up Go workspace with all local modulesmake setup-workspaceThis creates a go.work file that links all local modules for development.
4. Build the Application
Section titled “4. Build the Application”# Build UI and binarymake build
# Build with local go.work modules (for development)make build LOCAL=1
# Build with specific versionmake build VERSION=1.0.0
# Cross-compile for different platformsmake build GOOS=linux GOARCH=amd64
# Build with dynamic linking (Linux only)make build DYNAMIC=15. Run the Application
Section titled “5. Run the Application”# Run without hot reloadmake run
# Or with hot reload (development)make devAvailable Make Commands
Section titled “Available Make Commands”The Makefile provides numerous commands for development:
Development Commands
Section titled “Development Commands”make dev # Start complete development environment (recommended)make build # Build UI and deepintshield-http binarymake run # Build and run (no hot reload)make clean # Clean build artifactsTesting Commands
Section titled “Testing Commands”make test # Run deepintshield-http testsmake test-core # Run all core testsmake test-core PROVIDER=openai # Run specific provider testsmake test-core PROVIDER=openai TESTCASE=SpeechSynthesisStreamAdvanced/MultipleVoices_Streaming/StreamingVoice_echo # Run specific test casemake test-plugins # Run plugin testsmake test-governance # Run governance testsmake test-governance TESTCASE=TestVKBudgetExceeded # Run specific governance testmake test-governance PATTERN=Budget # Run governance tests matching patternmake test-all # Run all testsmake clean-test-reports # Clean test reportsmake generate-html-reports # Convert XML to HTML reportsWorkspace Management
Section titled “Workspace Management”make setup-workspace # Set up Go workspace for local developmentmake work-clean # Remove local go.work filesUI Commands
Section titled “UI Commands”make install-ui # Install UI dependenciesmake build-ui # Build UI for productionDocker Commands
Section titled “Docker Commands”make build-docker-image # Build Docker imagemake docker-run # Run Docker containerDocumentation
Section titled “Documentation”make docs # Start local documentation serverCode Quality
Section titled “Code Quality”make lint # Run linter for Go codemake fmt # Format Go codeTool Installation
Section titled “Tool Installation”make install-gotestsum # Install gotestsum for test reportingmake install-junit-viewer # Install junit-viewer for HTML reportsEnvironment Variables
Section titled “Environment Variables”You can customize the development environment with these variables:
# Server configurationHOST=localhost # Server host (default: localhost)PORT=8080 # Server port (default: 8080)
# LoggingLOG_STYLE=json # Logger format: json|pretty (default: json)LOG_LEVEL=info # Logger level: debug|info|warn|error (default: info)
# PrometheusPROMETHEUS_LABELS="env=dev" # Labels for Prometheus metrics
# App directoryAPP_DIR= # App data directory (empty by default, /app/data recommended for containers)
# Build configurationVERSION=dev-build # Build version (default: dev-build)LOCAL= # Use local go.work for builds (e.g., make build LOCAL=1)Example with custom settings:
PORT=3001 LOG_STYLE=pretty LOG_LEVEL=debug APP_DIR=/app/data make devUnderstanding DeepIntShield Architecture
Section titled “Understanding DeepIntShield Architecture”Before diving into development, it’s helpful to understand how DeepIntShield works internally. The architecture documentation provides detailed insights into:
Core Components
Section titled “Core Components”- Request Flow - How requests flow through the system from transport to provider and back
- Concurrency - Worker pools and threading model
- MCP Integration - Model Context Protocol implementation
- Plugin System - How plugins extend core functionality
Framework Layer
Section titled “Framework Layer”- What is Framework - Shared storage and utilities overview
- Config Store - Configuration persistence patterns
- Log Store - Request logging and analytics
- Vector Store - Semantic search and caching
Plugins & Transports
Section titled “Plugins & Transports”- Plugin Architecture - Plugin development patterns and execution model
- Transport Layer - HTTP and other transport implementations
Development Workflow
Section titled “Development Workflow”1. Start Development Environment
Section titled “1. Start Development Environment”make dev2. Make Your Changes
Section titled “2. Make Your Changes”- Core changes: Edit files in
core/ - API changes: Edit files in
transports/deepintshield-http/ - UI changes: Edit files in
ui/ - Plugin changes: Edit files in
plugins/
3. Test Your Changes
Section titled “3. Test Your Changes”# Run all testsmake test-all
# Run specific provider testsmake test-core PROVIDER=openai
# Run specific test case (TESTCASE must be a slash-delimited nested path matching the test hierarchy)make test-core PROVIDER=elevenlabs TESTCASE=SpeechSynthesisStreamAdvanced/MultipleVoices_Streaming/StreamingVoice_echo
# Run HTTP transport testsmake test
# Run plugin testsmake test-plugins
# View test reports (after running tests)open test-reports/index.html4. Verify Code Quality
Section titled “4. Verify Code Quality”# Format codemake fmt
# Run lintermake lint5. Build for Production
Section titled “5. Build for Production”# Build everythingmake build
# Or build Docker imagemake build-docker-imageTroubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”Go workspace issues:
# Reset the workspacemake work-cleanmake setup-workspaceUI dependency issues:
# Clean and reinstall UI dependenciesrm -rf ui/node_modules ui/.nextmake install-uiPort conflicts:
# Use different portsPORT=9090 make devIf an process is running on a port you need to use, you may need to terminate or kill it first:
# Kill the process on port 8080kill -9 $(lsof -t -i:8080)Hot reload not working:
# Ensure Air is installedwhich air || go install github.com/air-verse/air@latest
# Check if .air.toml exists in transports/deepintshield-http/ls transports/deepintshield-http/.air.tomlGetting Help
Section titled “Getting Help”- Check logs: Development logs appear in your terminal
- Verify prerequisites: Ensure Go, Node.js, and make are properly installed
- Clean build: Run
make cleanand try again - Discord: Join our Discord community for real-time help
Next Steps
Section titled “Next Steps”Once your development environment is running:
- Explore the UI: Visit http://localhost:8080 to see the web interface
- Make API calls: Test the API endpoints at http://localhost:8080/v1/
- Understand the architecture: Read our request flow documentation to understand how DeepIntShield works internally
- Read the documentation: Check out our complete documentation
- Review contribution guidelines: See our code conventions and PR guidelines
Quick Reference
Section titled “Quick Reference”# Essential commands for daily developmentmake dev # Start development environmentmake test-all # Run all testsmake fmt # Format codemake clean # Clean build artifactsmake help # Show all available commandsHappy coding! 🚀