This file provides guidance to an AI coding tool when working with code in this repository.
Apache HugeGraph is a fast-speed and highly-scalable graph database that supports billions of vertices and edges. It is compliant with Apache TinkerPop 3 and supports both Gremlin and Cypher query languages.
Technology Stack:
This is a Maven multi-module project with 7 main modules:
Client Layer (Gremlin/Cypher queries, REST APIs) ↓ Server Layer (hugegraph-server) ├─ REST API Layer (hugegraph-api): GraphAPI, SchemaAPI, GremlinAPI, CypherAPI, AuthAPI ├─ Graph Engine Layer (hugegraph-core): Schema management, traversal optimization, task scheduling └─ Backend Interface: Abstraction over storage backends ↓ Storage Layer (pluggable backends) ├─ RocksDB (default, embedded) ├─ HStore (distributed, production) └─ Legacy: MySQL, PostgreSQL, Cassandra, ScyllaDB, HBase, Palo
For production distributed deployments:
All inter-service communication uses gRPC with Protocol Buffers.
BackendStore interface, allowing new backends without modifying core code*/grpc/ directories)hugegraph-api/opencypher# Verify Java version (11+ required) java -version # Verify Maven version (3.5+ required) mvn -version
# Clean build with all modules mvn clean install -DskipTests # Build with tests mvn clean install # Build specific module (e.g., server only) mvn clean install -pl hugegraph-server -am -DskipTests
# Unit tests (memory backend) mvn test -pl hugegraph-server/hugegraph-test -am -P unit-test # Core tests with specific backend mvn test -pl hugegraph-server/hugegraph-test -am -P core-test,memory mvn test -pl hugegraph-server/hugegraph-test -am -P core-test,rocksdb mvn test -pl hugegraph-server/hugegraph-test -am -P core-test,hbase # API tests with backend mvn test -pl hugegraph-server/hugegraph-test -am -P api-test,rocksdb # TinkerPop compliance tests (for release branches) mvn test -pl hugegraph-server/hugegraph-test -am -P tinkerpop-structure-test,memory mvn test -pl hugegraph-server/hugegraph-test -am -P tinkerpop-process-test,memory
# Build and test hugegraph-struct first (dependency) mvn install -pl hugegraph-struct -am -DskipTests # Test PD module mvn test -pl hugegraph-pd/hg-pd-test -am # Test Store module mvn test -pl hugegraph-store/hg-store-test -am
# License header check (Apache RAT) mvn apache-rat:check # Code style check (EditorConfig) mvn editorconfig:check # Compile with warnings mvn clean compile -Dmaven.javadoc.skip=true
Scripts are located in hugegraph-server/hugegraph-dist/src/assembly/static/bin/:
# Initialize storage backend bin/init-store.sh # Start server bin/start-hugegraph.sh # Stop server bin/stop-hugegraph.sh # Gremlin console bin/gremlin-console.sh # Enable authentication bin/enable-auth.sh
# Build distribution tarball (auto-enabled by default) mvn clean package -DskipTests # Skip assembly creation (if needed) mvn clean package -DskipTests -Dskip-assembly-hugegraph # Output: install-dist/target/hugegraph-<version>.tar.gz
hugegraph-server/hugegraph-dist/src/assembly/static/conf/hugegraph.properties - Main server configurationrest-server.properties - REST API settingsgremlin-server.yaml - Gremlin server configurationhugegraph-pd/hg-pd-dist/src/assembly/static/conf/hugegraph-store/hg-store-dist/src/assembly/static/conf/hugegraph-pd/hg-pd-grpc/src/main/proto/hugegraph-store/hg-store-grpc/src/main/proto/hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/hugegraph-server/hugegraph-{backend}/ (e.g., hugegraph-rocksdb)Configure your IDE to use .editorconfig for code style and style/checkstyle.xml for Checkstyle rules
When adding third-party dependencies:
install-dist/release-docs/licenses/install-dist/release-docs/LICENSEinstall-dist/release-docs/NOTICE (if upstream has NOTICE)install-dist/scripts/dependency/known-dependencies.txt (run regenerate_known_dependencies.sh)When working on storage backends:
hugegraph-server/hugegraph-core abstractionsBackendStore interfacehugegraph-server/hugegraph.properties via the backend propertyWhen modifying .proto files:
*/grpc/ packages (excluded from Apache RAT checks)mvn clean compile to regenerate gRPC stubstarget/generated-sources/protobuf/Authentication is optional and disabled by default:
bin/enable-auth.sh or configurationhugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/auth/# Use Maven's -Dtest parameter mvn test -pl hugegraph-server/hugegraph-test -am -P core-test,memory -Dtest=YourTestClass
For distributed development:
mvn install -pl hugegraph-struct -am -DskipTestsmvn clean package -pl hugegraph-pd -am -DskipTestsmvn clean package -pl hugegraph-store -am -DskipTestsmvn clean package -pl hugegraph-server -am -DskipTestsSee Docker Compose example: hugegraph-server/hugegraph-dist/docker/example/
hugegraph-server/hugegraph-dist/src/assembly/static/conf/log4j2.xmlbin/dump-conf.sh to view effective configurationbin/monitor-hugegraph.shThe project uses multiple GitHub Actions workflows:
server-ci.yml: Server module tests (memory, rocksdb, hbase backends)pd-store-ci.yml: PD and Store module testscommons-ci.yml: Commons module testscluster-test-ci.yml: Distributed cluster integration testslicence-checker.yml: Apache RAT license validationhugegraph-commons is a shared dependency for all moduleshugegraph-struct must be built before PD and Storehugegraph-core${revision} property (currently 1.7.0)