Skip to content

SoftGridAlex/graph-sync-cpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“Š Graph Sync Project: C++, Docker & Neo4j Integration

This project is a Backend-as-a-Service solution designed for user management within a graph-oriented database. It serves as a practical example of interconnecting a web frontend, a high-performance C++ server, and a NoSQL database.


๐Ÿ—๏ธ System Architecture

The system is modular and leverages cutting-edge technologies to ensure fast and secure communication:

  • Frontend (Web Interface): Located in Site_page, it collects data through intuitive forms.
  • Backend (C++ Server): Developed using the Crow framework. It processes HTTP requests, validates data, and constructs Cypher queries.
  • Database (Neo4j): Stores information as nodes and relationships, running within an isolated Docker environment.

๐Ÿš€ Installation & Setup Guide

To run this project locally, follow the steps below. The project is configured to be portable, allowing the use of any Neo4j instance.

1. Database Preparation (Neo4j)

The application requires a Neo4j container. You can start your own instance using Docker:

docker run -d \
    --name neo4j-project \
    -p 7474:7474 -p 7687:7687 \
    --env NEO4J_AUTH=neo4j/your_password_here \
    neo4j:4.4
2. Security Configuration (config.h)
For security reasons, authentication credentials are not included in the repository (they are ignored via .gitignore). You must manually create the configuration file:

Navigate to the include/ folder.

Create a file named config.h.

Add the following code, replacing the placeholder with your own Base64 token:

C++
#ifndef CONFIG_H
#define CONFIG_H
#include <string>

// Base64 Token formatted as "username:password"
const std::string NEO4J_AUTH_TOKEN = "INSERT_YOUR_TOKEN_HERE";
const std::string NEO4J_URL = "http://localhost:7474/db/data/transaction/commit";

#endif
3. Running the Frontend
The frontend is most efficiently served through an Nginx container, mapping the local Site_page folder:

Bash
docker run -d \
    --name frontend-site \
    -p 80:80 \
    -v $(pwd)/Site_page:/usr/share/nginx/html \
    nginx:latest
4. Compiling and Starting the Server (Backend)
The backend is compiled locally to utilize host system resources (WSL/Linux recommended):

Bash
# Compile with libcurl support
g++ main.cpp -o server -lcurl

# Start the server
./server
๐Ÿ”’ Security & Organization
Zero Secrets: No passwords or sensitive tokens are stored in the public source code.

Dockerized: Web components and the database are isolated, preventing system-wide conflicts.

Clean Code: Uses separate header files (include/) for easy maintenance and scalability.

๐Ÿ› ๏ธ Tech Stack
Backend: C++17, Crow Framework, libcurl

Frontend: HTML5, CSS3, JavaScript

DevOps: Docker, Nginx

Database: Neo4j (Cypher Query Language)

About

A practical demonstration of a C++ backend integrated with Neo4j and Docker, showcasing REST API communication and secure configuration management

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages