346 private links
A framework similar to Express (JS) in API design
When JS tools are written in other programming languages, it increases the barrier to contribute in these tools. The contributors need to know a second language.
A rewrite in another language is already a rewrite, which means things will be better built.
Node performance is often slow, but it works without cache... Let's try export NODE_COMPILE_CACHE=1 first.
Moreover JS is easily debuggable.
Negative experience:
- the steep learning curve for Rust
- the bevy engine gets regressions in some releases, or the API is unstable.
Use types to enforce consistency.
Les Refinement Types sont des objets qui permettent de s'assurer de la cohérence des données en mathématique on appellerait ceci un sous-ensemble.
It can become useful someday
Option has zero cost with Some types in memory.
How the module system works in Rust
"Simple molecular dynamics"
On average, there are more than eight changes per hour in the source code, which has grown to over 40 million lines of code. Errors also occur: according to Kroah-Hartman, there are 13 CVE reports per week. Due to the widespread use of Linux, this number is alarming. Although errors are human, they require the source code to be checked by other developers. However, the use of Rust could reduce this workload.
- The HTTP layer is straightforward: it turns HTTP requests into structures to be used by the service layer and vice versa.
- The service layer contains all the business logic of the service: data validation, business invariants, etc...
- 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 therust_embedcrate.
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.mdNote that this tool is originally a fork of BurntSushi's xsv, but has been nearly entirely rewritten at that point, to fit SciencesPo's médialab use-cases, rooted in web data collection and analysis geared towards social sciences (you might think CSV is outdated by now, but read our love letter to the format before judging too quickly).