| Build & Test & Fmt & Clippy |
|---|
| [Test, Clippy, Rustfmt, Code coverage, Benchmark, clippy] |
Connectify-RS is a modular backend service built in Rust using the Axum web framework. Designed as a Cargo workspace, it integrates various external services—Twilio for communication, Google Calendar for scheduling, Stripe and Payrexx for payments—and includes an internal fulfillment service to coordinate post-payment actions.
- Project Overview
- Features
- Workspace Structure
- Prerequisites
- Configuration
- Building and Running
- API Documentation (Swagger UI)
- Crate Details
- Testing
- Security Considerations
- Contributing
- License
Connectify-RS serves as a backend hub, enabling seamless integration with various third-party services. Its modular architecture, built using a Cargo workspace, allows features to be selectively enabled or disabled, making it ideal for applications requiring communication, scheduling, and payment processing. The core is an Axum-based web server exposing API endpoints for these integrations.
- Modular Design: Enable or disable integrations via Cargo features and runtime flags.
- Centralized Configuration: Unified management with
config-rsand.envsupport. - Twilio Integration: Generate Twilio Video access tokens.
- Google Calendar Integration: Check availability and book events with a Service Account.
- Payment Processing:
- Stripe: Stripe Checkout Sessions & webhooks.
- Payrexx: Payment links & webhooks.
- Fulfillment Service: Internal API for post-payment actions (e.g., calendar booking).
- API Documentation: Auto-generated OpenAPI/Swagger UI via
utoipa.
connectify_rs/
├── Cargo.toml # Root workspace manifest
├── config/
│ └── default.yml # Default configuration values
├── crates/ # Modular libraries and executables
│ ├── connectify_config # Config loader and models (core)
│ ├── connectify_common # Shared utilities (placeholder)
│ ├── connectify_payrexx # Payrexx integration
│ ├── connectify_stripe # Stripe integration
│ ├── connectify_twilio # Twilio integration
│ ├── connectify_gcal # Google Calendar integration
│ ├── connectify_calendly # Calendly integration (WIP)
│ ├── connectify_fulfillment# Fulfillment workflows
│ ├── connectify_firebase # Firebase Cloud Messaging integration
│ └── services/
│ ├── connectify_backend# Main Axum API service
│ └── rustdis/ # Experimental placeholder service
└── cross_build_on_mac.sh # Cross-compilation helper script
- Rust & Cargo: Latest stable toolchain.
- Credentials & Accounts:
- Twilio: Account SID, API Key SID & Secret.
- Google Calendar: Service Account JSON key with Calendar API.
- Stripe: API Secret Key & Webhook Signing Secret.
- Payrexx: Instance Name & API Secret.
- (Optional) ngrok: For webhook testing.
Configuration is layered (file → environment):
Create a .env in the workspace root (add to .gitignore):
RUN_ENV(e.g.,development, defaults todebug).PREFIX(env var prefix for config, defaultHTR).- Secrets (must not be committed):
TWILIO_API_KEY_SECRETSTRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRETPAYREXX_API_SECRETGOOGLE_SERVICE_ACCOUNT_KEY_PATHFULFILLMENT_SHARED_SECRET- Other prefixed vars:
HTR_GCAL__CALENDAR_ID, etc.
config/default.yml: Base settings.config/{RUN_ENV}.yml: Environment-specific overrides.
These map to the AppConfig in connectify_config (fields like use_twilio, twilio, gcal, etc.).
All commands run from the workspace root.
- Build all crates with all features:
cargo build --all-features --release
- Build only the backend with specific features:
cargo build -p connectify-backend --features twilio,gcal,stripe,payrexx,fulfillment,openapi --release
The connectify-backend executable:
cargo run -p connectify-backend --features twilio,gcal,stripe,payrexx,fulfillment,openapi -- .env- The
-- .envargument specifies a dotenv path forensure_dotenv_loaded(defaults to.env). - The console will show the bind address (e.g.,
http://127.0.0.1:8080).
- Compile-time:
--featuresflags for integrations andopenapi. - Runtime:
use_XXX: boolin config (e.g.,use_twilio: true). Routes are active only if both compile- and run-time flags are enabled.
With openapi enabled, access Swagger UI at:
http://<host>:<port>/api/docs
The raw OpenAPI JSON is at /api/docs/openapi.json.
Documentation includes all compiled feature endpoints.
See individual crate READMEs under crates/ for full API and configuration specifics.
The connectify_firebase crate provides integration with Firebase Cloud Messaging (FCM) for sending push notifications to mobile devices. It includes a DeviceRegistrationRepository for storing and retrieving device registration tokens.
The DeviceRegistrationRepository is used to store and retrieve device registration tokens for push notifications. There are two ways to configure it:
- Direct Configuration:
// Create a database client
let db_client = DbClient::new("sqlite:example.db").await?;
// Create the SQL repository
let sql_repo = SqlDeviceRegistrationRepository::new(db_client);
// Create the Firebase repository wrapper
let firebase_repo = DeviceRegistrationRepository::new(sql_repo);
// Configure the Firebase client with the repository
let firebase_client = FirebaseClient::new(firebase_config)
.with_repository(firebase_repo);
- Lazy Initialization:
// Create the factories
let db_client_factory = DbClientFactory::new();
let repository_factory = DeviceRegistrationRepositoryFactory::new();
// Configure the Firebase client with lazy repository initialization
let firebase_client = FirebaseClient::new(firebase_config)
.with_lazy_repository(
Arc::new(app_config),
db_client_factory,
repository_factory
);
The repository requires the database feature to be enabled:
# In Cargo.toml
connectify_firebase = { version = "0.1.0", features = ["database"] }
When the database feature is enabled, the Firebase client can store and retrieve device registration tokens. Without this feature, methods that require database access will return an error.
- Run tests per crate:
cargo test -p <crate> --features <features>. - Run all tests:
cargo test --all-features. - Use
ngrokor Stripe CLI for webhook testing.
- Secrets: Never commit secrets; use env vars.
- Webhook Verification: Validate signatures for Stripe/Payrexx.
- Internal API Security: Protect fulfillment endpoints with
X-Internal-Auth-Secret. - HTTPS: Use TLS in production.
- Dependencies: Keep up-to-date; run
cargo audit.
- Fork the repo and create a feature branch.
- Run
cargo fmt,cargo clippy, and tests. - Update relevant README(s) and this overview.
- Submit a pull request.
This project is licensed under MIT OR Apache-2.0 (see crates' Cargo.toml).