Skip to content

Cartons is a project of projects I built while learning Rust. It has async SSH pools, an ORM, a REST API with auth & database migrations, a gRPC API, CLI tools, and more!

Notifications You must be signed in to change notification settings

jmsdnns/cartons

Repository files navigation

Cartons

Animation of a happy milk carton doing a little jig

🦀 Hello, and welcome to Cartons!

This project is where I store Rust implementations of ideas I build while learning Rust. My hope in sharing them is that they can act as a kind of Rosetta stone for experienced programmers that are curious about Rust.

Relevant Tools

  • just: Super handy tool to save and run commands. Some of the projects have .justfile that shows what commands I use with the project. Especially handy when using containers or VMs.
  • containerd: The best way to manage to containers. It has completely replaced docker for me.
  • limavm: My favorite way to manage local VMs during development. I use it in both Linux and macOS.

The List

Each carton is an independent Rust project. Many of them exist to express common ideas succinctly in Rust. Some of them are significantly more complex and incorporate several of the smaller ideas to achieve something bigger.

  • Feature Demos: Showcases how to use Rust's core features. There are implementations for iterators, type conversions, using enums, pattern matching, etc. Captures some of Rust's eccentricies nicely.
  • Dates, Times, and Timezones: Simple examples of how to use the Chrono library to create and read various formats of dates and times.
  • Reading & Writing JSON: Using the Serde library to read and write JSON.
  • Config Files: Using Serde for toml config files.
  • CLI Tools: Multiple CLI tools, all built using the Clap library.
  • Numpy-style Arrays: Numpy users will feel right at home with Rust's ndarray.
  • Async SSH Pools: Demonstrates how to run the same command on multiple remote machines simultaneously. Reads a toml config file for information about the remote machines. Includes a .justfile that knows how use Lima VMs for the remotes.
  • Micro Macros: Examples of different kinds of macros.
  • Signed Tokens: Creates signed JWT tokens and demonstrates how validation of JWT fields is automatic.
  • Async Password Hashing: Password hashing where the actual hashing is done in a background thread to keep the cpu bound work off the main thread.
  • Async Postgres w/ DB Migrations: Concise example of how to asynchronously query and manage Postgres. Includes a compose file for running Postgres with the project
  • MiniORM: A fully functional, though quite basic, implementation of a SQLite ORM using procedural macros.
  • Async REST API: An authenticated, database backed REST API built with the Axum framework. Includes compose files for Postgres and an app containers.
  • Async gRPC: Multiple servers and clients demonstrating increasing complexity, all built the Tonic framework for async gRPC.

Code Comments

It is rare for the code to have comments. At some point a carton will show up that covers how to do comments using Rust's conventions. Until then, it's just raw code.

About

Cartons is a project of projects I built while learning Rust. It has async SSH pools, an ORM, a REST API with auth & database migrations, a gRPC API, CLI tools, and more!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published