Skip to content

leadspy-core/api

Repository files navigation

Leadspy API

Leadspy proprietary API, made with ❤️ in Rust.

codecov

Usage

Run the application locally with the following command:

cargo run

The 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 --release

The application binary can then be run from the release folder:

target/release/application

Packages

This 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.

API

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.

Application

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.

Domain

The domain package centralize the application domain logic. It defines generic types reused across the application.

Meta Advertiser

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

Meta Snapshot

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.

Mock Server

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors