This repository presents a seed for creating backend Rust applications -- with preset libs, UIs, services & design patterns.
Most likely you'll need only a subset of the features provided by this template:
- Additional Runtimes:
- Tokio
- Ogre-Workers, for event-driven / iterator-driven / stream-based programming
- Services:
- Web, through
Rocket- Angular UI app -- demo featuring the backend services API exploration (more details bellow)
- Angular backend app -- exposing metrics, logs, statistics. The demo exposes Tokio data and you may add your own
- embedded static & pre-compressed files -- including all Angular apps -- for blazing fast speeds
- Telegram, through
Teloxide- stateless & stateful bot examples (with navigation)
- application initiated message sending
- messaging framework inspired on InstantVAS' Microservice pattern
- Socket Server, with async Streams & Reactive pipelines
- Textual protocols (like FIX)
- Binary protocols
- Hooks for your own Service
- async with
Tokio
- async with
- Web, through
- UIs:
- Console -- logging through
slogwith stdout and file sink options - Terminal --
tui+crossterm; - GUI --
egui-
lottieanimations withrlottie - charts with
plotters
-
- Integrated & embedded Angular UI application
- Angular Universal, automatically pre-rendering parameter-less routes
- Google Material theming & components
- Example app to test the web services provided in
src/frontend/web/api, with flexible components - Loading speeds of ~50ms, enabling it to be used as landing pages
- Dashboard (using
coreui-free-angular-admin-template-- Angular), containing:- Runtime metrics & stats
- Console -- logging through
- Configs:
- Application-wide
config pattern, tying all features together + customizable to include your business logic - Command Line parsing through
structopt, merging with the application-wide configs - Persistent config file using
ron-- easily serializing any Rust type + automated DOCs generation
- Application-wide
- Injection / Runtime Repository:
- Application-wide
runtime pattern, sharing runtime data to tie all features together + customizable to include your business logic - May be used as an
Injection Repository
- Application-wide
- Testing:
- Built-in example for Big-O analysis with
big-o-testcrate - Built-in example for Criterion bench
- Built-in example for Big-O analysis with
Tested in this environment:
- Rust 1.64
- Node 18.3.0 (18.9.0 & 18.10.0 are known to mess up with Angular Universal -- more details in the link at the end)
- Init the submodule for the
web-statsapp:git submodule update --init --remote - Build the angular web apps (you should have Angular & Node previously setup). Note that if any of those commands fail, building the app in Release mode won't be possible:
cd web-app/; npm i; npm run prerender; cd ..cd web-stats/; npm i; npm run build; cd .. - Build the Rust app (release, optimized for the local processor):
RUSTFLAGS="-C target-cpu=native" cargo build --release - Inspect the command line options (with
--help) to pick up which UI to run. Bellow, how to run the standard console / daemon mode:./target/release/kickass-app-template console daemon
- Click
Use this template, at the top right of this github page - Edit
Cargo.tomland clean it up from the dependencies you don't need + associated code, then, failing to compile - Remodel
src/config&src/command_linemodules to your needs -- then go ahead and do it forsrc/runtimeas well - Add all modules for your business logic
- Elect parts of your code for Big O analysis tests and update
tests/big-o-analysis-- then do the same for Criterion inbench/ - Inspect & adjust the
src/frontendmodule & submodules - Share back (through a PR) any improvements you do to the template
(only 44ms needed to show the content -- 13ms to load index.html + 31ms to render it. After being presented, Angular is loaded and after 664ms we have a fully working website)
- https://update.angular.io
- (remember to add Universal, like this
ng update @angular/core@14 @angular/cli@14 @nguniversal/express-engine@14) - 2022-10-07: bug no recent Node versions: https://pullanswer.com/questions/prerendering-fails-on-node-js-18-9-but-succeeds-on-node-18-8






