in development - actually only skeleton and idea
A Domain Driven Design (DDD) application for designing Neo4j graph schemas visually and generating corresponding SQL database schemas with full table structures, relationships, and constraints.
This project provides a comprehensive toolset for:
- Visual Graph Design: Interactive web-based designer for Neo4j graph schemas
- Schema Analysis: Analysis of existing Neo4j databases to understand structure
- SQL Generation: Automatic generation of SQL DDL scripts for multiple database engines
- Bidirectional Workflow: Integration with mysql-graph-visualizer for complete SQL β Neo4j ecosystem
- π¨ Interactive Graph Designer - Visual drag-and-drop interface for designing graph schemas
- π Neo4j Schema Analysis - Analyze existing Neo4j databases and infer optimal SQL structures
- ποΈ Multi-Database Support - Generate SQL for MySQL, PostgreSQL, SQLite
- β‘ Template Engine - Customizable SQL generation templates
- ποΈ DDD Architecture - Clean, maintainable, and extensible codebase
- π Multiple Interfaces - Web UI, CLI, GraphQL API
- π Real-time Preview - Live preview of generated SQL schemas
- Language: Go 1.22.5+
- Architecture: Domain Driven Design (DDD)
- Graph Database: Neo4j 4.4+
- Web Framework: Gorilla Mux
- Frontend: Vanilla JS with D3.js/Vis.js for graph visualization
- APIs: REST, GraphQL (gqlgen)
- Configuration: Viper + YAML
- Logging: Logrus
- Testing: Testify
neo4j-sql-generator/
βββ cmd/ # Application entry point
βββ internal/
β βββ domain/ # Domain Layer - Core business logic
β β βββ aggregates/ # Domain aggregates (Schema, Graph Design, Generation)
β β βββ entities/ # Domain entities
β β βββ value_objects/ # Value objects
β β βββ events/ # Domain events
β β βββ services/ # Domain services
β β βββ specifications/ # Business rules specifications
β βββ application/ # Application Layer - Use cases
β β βββ ports/ # Interface definitions (Ports)
β β βββ services/ # Application services
β β βββ commands/ # Command objects
β β βββ queries/ # Query objects
β β βββ dto/ # Data Transfer Objects
β βββ infrastructure/ # Infrastructure Layer - External concerns
β β βββ persistence/ # Repository implementations
β β βββ generators/ # SQL generation engines
β β βββ templates/ # Template engines
β β βββ middleware/ # HTTP middleware
β βββ interfaces/ # Interface Layer - External interfaces
β βββ web/ # Web interfaces (REST API, Static files)
β βββ cli/ # Command-line interface
β βββ graphql/ # GraphQL interface
βββ config/ # Configuration files
βββ docs/ # Documentation
βββ docker-compose.yml # Development services
- Go 1.22.5+
- Neo4j 4.4+ (Docker recommended)
- Modern web browser
# Clone the repository
git clone <repository-url>
cd neo4j-sql-generator
# Install dependencies
go mod tidy
# Start Neo4j (using Docker)
docker-compose up -d neo4j
# Run the application
go run cmd/main.go
# Access the web interface
open http://localhost:8080- Open
http://localhost:8080in your browser - Use the visual designer to create your graph schema
- Configure node types, relationships, and properties
- Preview the generated SQL in real-time
- Download the complete DDL scripts
# Analyze existing Neo4j database
./neo4j-sql-generator analyze --uri bolt://localhost:7687
# Generate SQL from design file
./neo4j-sql-generator generate --design ./my-design.json --target mysql
# Validate design
./neo4j-sql-generator validate --design ./my-design.json# Create a new design
mutation {
createDesign(input: {
name: "E-commerce Schema"
description: "Product catalog with users and orders"
}) {
id
name
}
}
# Generate SQL schema
mutation {
generateSchema(designId: "design-id", target: MYSQL) {
ddl
migrations
}
}server:
port: 8080
host: localhost
neo4j:
uri: bolt://localhost:7687
username: neo4j
password: password
generators:
mysql:
template_path: config/templates/mysql.yml
postgresql:
template_path: config/templates/postgresql.yml
sqlite:
template_path: config/templates/sqlite.yml
design:
auto_save: true
max_nodes: 100
max_relationships: 200This project follows Domain Driven Design (DDD) principles:
- Domain Layer: Contains pure business logic, isolated from external concerns
- Application Layer: Orchestrates use cases and workflows
- Infrastructure Layer: Implements technical details (databases, web servers)
- Interface Layer: Provides external access points (REST, GraphQL, CLI)
- Ports & Adapters (Hexagonal Architecture)
- CQRS (Command Query Responsibility Segregation)
- Repository Pattern
- Domain Events
- Aggregate Pattern
# Run all tests
go test ./...
# Run tests with coverage
go test -cover ./...
# Run integration tests
go test -tags=integration ./...# Build for current platform
go build -o neo4j-sql-generator cmd/main.go
# Cross-compile for Linux
GOOS=linux GOARCH=amd64 go build -o neo4j-sql-generator-linux cmd/main.goGET /api/designs- List all designsPOST /api/designs- Create new designGET /api/designs/{id}- Get design by IDPUT /api/designs/{id}- Update designPOST /api/generate- Generate SQL from designPOST /api/analyze- Analyze Neo4j database
design.updated- Design changedgeneration.completed- SQL generation finishedanalysis.completed- Database analysis finished
- mysql-graph-visualizer - Convert MySQL databases to Neo4j graphs
- Complete bidirectional ecosystem: SQL β Neo4j
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Follow DDD principles and existing code patterns
- Add tests for new functionality
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Core DDD domain model
- Neo4j analysis engine
- Visual graph designer (Web UI)
- MySQL SQL generator
- PostgreSQL SQL generator
- SQLite SQL generator
- CLI interface
- GraphQL API
- Template customization
- Real-time collaboration
- Schema versioning
- Migration scripts generation
- Integration with mysql-graph-visualizer
Status: π§ In Active Development
For questions and support, please open an issue in the GitHub repository.