Introduction to Enterprise Applications Link to heading
The term “enterprise” in the context of software development often elicits mixed reactions. However, for the purpose of this discussion, let’s define an enterprise application as a comprehensive, collaboratively developed solution that adheres to high standards of long-term maintenance. Such an application is characterized by its modular design, both internally and externally, ease of integration, and its ability to address complex business challenges efficiently and reliably.
If you have a suggestion for a more apt term that encapsulates these qualities, feel free to share, and we will consider adopting it.
Series Outline Link to heading
- Overview
- Framework analysis and selection: Delving into the specifics of framework selection and application.
- Core Components: Database management, modularization, internal RPC, AMQP.
- Web and API: Web Server, GraphQL API.
- Application Development: Web, CLI, desktop, and mobile app development.
- Miscellaneous Tools: Observability, logging, machine learning.
- Boilerplate project: A comprehensive guide including setup instructions for selected frameworks, architectural diagrams, and development environment configurations.
Context Link to heading
You are embarking on a project where Rust’s capabilities align well with your requirements. Your decision to use Rust encompasses several areas: embedded firmware, backend/APIs, web frontend, CLI tools, batch processing, and mobile library code. Flutter will complement Rust for the mobile applications themselves. Currently, you are evaluating Rust’s evolving ecosystem for your machine learning requirements.
Your team’s experience in developing enterprise-grade applications using integration patterns and modular designs in languages like Java and C# will guide your approach. Your familiarity with such tools and techniques is a key consideration in your selection process.
There will be a need for a primary backend (i.e., PostgreSQL), and also one or more secondary special-purpose backends, so an event-driven, CQRS approach is likely on the table.
This series will not delve into the reasons behind choosing Rust or your specific architectural preferences, as these topics are extensively covered by other resources on the web. The short answer is: you want the safety, static analysis, and performance.
Assumptions Link to heading
Design Principles Link to heading
- Adherence to the 12-factor methodology.
- When we modify data, announce a domain event.
- Ensuring graceful shutdowns for smooth deployment transitions.
- Resilient programming techniques shall be used whenever possible (retry, fallback, timeout, circuit breaker, etc)
- Prefer async/await interfaces wherever feasible.
Technology Stack Link to heading
- Rust
- Primary datastore: PostgreSQL.
- Secondary datastores: Redis, TBD analytics backend, more to come.
- IAM: Keycloak
- Message Bus: RabbitMQ or simliar (AMQP 0.9.1 or 1.0)
- Deployment targets: web, mobile, cli
Framework Selection Considerations Link to heading
Framework Options Link to heading
The following options are based on cursory research.
- Database Frameworks: diesel, sqlx, ormX, seaorm.
- Internal Modularization/M2M: tower, bevy_ecs, ecs-rust, sai, actix, actix_service, norpc, lapin, amiquip, amqprs, rabbitmq-stream-rust-client
- External API: actix-net, tonic, volo, zino, motore, cqrs, datacake-rpc.
- Web Frameworks: actix-web, axum, rocket, hyper, poem, salvo, warp.
- GraphQL: juniper, async-graphql.
- Machine Learning and Statistics: polars, linfa, RustLearn.
- GUI Frameworks (Web/Desktop/Mobile): dioxus, tauri, yew, egui, rinf, flutter-rs, flutter_rust_bridge
- CLI Frameworks: clap-rs, cliparser, dioxus
Cross cutting concerns Link to heading
- Observability: log, tracing, opentelemetry, etc.
Evaluation Metrics Link to heading
Frameworks will be evaluated based on criteria such as GitHub stars, recent activity, open issues, dependents on crates.io, online buzz, availability of documentation or books, ease of use post-tutorial, and compatibility with other chosen frameworks.
Research Link to heading
A collection of articles, links, and tutorials that provide insights into the various topics will be compiled. This will aid in informed decision-making and understanding the state of the Rust ecosystem in each area.
General Link to heading
- https://github.com/camsjams/rust-actix-graphql-sqlx-postgresql
- https://www.arewewebyet.org/
- https://www.fpcomplete.com/blog/axum-hyper-tonic-tower-part1/
- https://github.com/rust-unofficial/awesome-rust
Database Link to heading
- https://www.reddit.com/r/rust/comments/n8cu8z/what_ormalike_library_are_you_using_with_rust_for/
- https://rust-trends.com/posts/database-crates-diesel-sqlx-tokio-postgress/
- https://www.sea-ql.org/SeaORM/docs/internal-design/diesel/
Modularity Link to heading
Machine Learning Link to heading
- https://github.com/e-tornike/best-of-ml-rust
- https://www.arewelearningyet.com/
- https://github.com/diesel-rs/diesel/issues/399
AMQP Link to heading
- https://www.rabbitmq.com/devtools.html#rust-dev
- https://www.reddit.com/r/rust/comments/ld5ktl/rust_implementation_of_the_amqp_10/
- https://michaeljohnpena.com/blog/eventhubs-rust/
- https://medium.com/geekculture/event-driven-programming-with-rust-and-rabbitmq-using-crosstown-bus-c39c50ce6c98
- https://www.zupzup.org/rmq-in-rust/index.html
GUI Link to heading
- https://www.reddit.com/r/rust/comments/w7ydex/dioxus_vs_egui_vs_iced_vs_tauriyew/
- https://www.reddit.com/r/rust/comments/y9zhff/future_of_dioxus/
- https://monadical.com/posts/shades-of-rust-gui-library-list.html
Security Link to heading
Future consideration Link to heading
Future posts will explore topics such as distribution strategies for our code, and the potential segmentation of components into sub-services, akin to a microservices architecture.