Leadspy proprietary API, made with ❤️ in Rust.
Run the application locally with the following command:
cargo runThe application configuration can be superseeded with environment variables:
HOST=0.0.0.0 # Expose the application on all IPv4 addresses on the local machine
PORT=80 # Expose the application on standard port 80
SENTRY_DSN=https://[id]@sentry.io/[key] # define the Sentry DSN for error reporting
See all configuration options in the config crate.
Build a release for the application with the following command:
cargo build --releaseThe application binary can then be run from the release folder:
target/release/applicationThis project is using Cargo Workspaces for separating units of logics in specialized packages. Here is a brief overview of the different packages and their afferent role.
The API package defines the types ([Rust Structs(https://doc.rust-lang.org/book/ch05-00-structs.html)) for describing the API schema. Because it exposes bindings for schema generation, it is externalized from the specialized packages as it operates at a higher level. Types are versioned under a crate for every version number. This allows to define a schema for a specific version and ensure consistency when releasing a new version of the API.
The application package is the main binary package. It runs and exposes an Actix Web server and is responsible for exposing the business domain logic through a secured server.
The domain package centralize the application domain logic. It defines generic types reused across the application.
The meta_advertiser package owns the logic of fetching advertisers from Meta. It is isolated in a separate package because the inner workings require a specific scrapping of the Meta Ad Library
The meta_snapshot package owns the logic of fetching advertisement snapshots from Meta. It is isolated in a separate package because the inner workings require a specific scrapping of advertisement snapshots.
The mock_server packages exposes a HTTP server, providing fixtures for a set of URLs matching URLs of third-party APIs used internally. It can be leveraged in tests to ensure the application can be fully tested without relying on external calls.