Daily Shaarli

All links of one day in a single page.

April 7, 2025

Human Name Variations in Databases – Becoming A Data Scientist

About the many possible scenarios. Assumption on human names are false in the large majority of cases.

Architecting and building medium-sized web services in Rust with Axum, SQLx and PostgreSQL
  1. The HTTP layer is straightforward: it turns HTTP requests into structures to be used by the service layer and vice versa.
  2. The service layer contains all the business logic of the service: data validation, business invariants, etc...
  3. The repository wraps the database queries

Then come some strategies:

  • Cron jobs
  • Caching is done at the service layer because the repository layer must stay dumb and the business rules often impact caching.
  • logging with tracing
  • Serving SPAs and static assets with a custom axum handler and a fallback URL for everything outside of the /api. Static assets can be served with the rust_embed crate.

The project structure looks like:

cmd/
    my-server/
        migrations/
            0001.sql
        Cargo.toml
        main.rs
        server.rs
        scheduler.rs
        worker.rs
        webapp.rs
libs/
    mailer/
        Cargo.toml
        mailer.rs
    queue/
        Cargo.toml
        queue.rs
    stripe/
        Cargo.toml
        stripe.rs
services/
    users/
        repository/
            users.rs
            sessions.rs
        service/
            get_user.rs
            get_session.rs
        Cargo.toml
        errors.rs
        model.rs
        repository.rs
        service.rs
Cargo.toml <- Cargo.toml for the workspace
Dockerfile.my-server
Makefile
README.md
GifCities