| Crates.io | nexus-webapi |
| lib.rs | nexus-webapi |
| version | 0.4.1 |
| created_at | 2025-07-01 10:08:46.687711+00 |
| updated_at | 2025-07-01 11:45:33.593488+00 |
| description | Nexus API exposes a social-media-like API capable of powerful Web-of-Trust inference |
| homepage | https://github.com/pubky/pubky-nexus |
| repository | https://github.com/pubky/pubky-nexus |
| max_upload_size | |
| id | 1733028 |
| size | 534,250 |
Nexus API is a RESTful API server built on top of Axum that serves as the core backend for Pubky App. It integrates with two databases: Neo4j graph database and Redis cache, and it supports distributed tracing and interactive API documentation.
Nexus API is designed to handle endpoints related to:
The crate leverages the shared nexus_common library for database interactions and common types. Its modular architecture ensures that each responsibility is neatly encapsulated within dedicated modules.
builder, config, error, mock, models, and routes.toml files with sensible defaults provided by the ApiConfig struct.To add Nexus API to your project, include it in your Cargo.toml dependencies:
cargo add nexus-webapi
Below is a simple example to start the Nexus API server:
use nexus_webapi::builder::NexusApi;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Build and run the Nexus API server
NexusApi::builder().run().await?;
Ok(())
}
Alternatively, if you prefer to load the configuration from a file:
use nexus_watcher::builder::NexusWatcher;
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
NexusApi::start_from_path(PathBuf::from("path/to/config/folder")).await?;
Ok(())
}
For more advanced scenarios, use the builder pattern via NexusApi::builder() to adjust parameters such as the public address, logging level, file paths, and database settings
This project is licensed under the MIT License.