Skip to content

dmgolembiowski/kickass-app-template

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Production-ready seed & template for Rust Backend & Long Runner Applications

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:

  1. Additional Runtimes:
    • Tokio
    • Ogre-Workers, for event-driven / iterator-driven / stream-based programming
  2. 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
  3. UIs:
    • Console -- logging through slog with stdout and file sink options
    • Terminal -- tui + crossterm;
    • GUI -- egui
      • lottie animations with rlottie
      • 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
  4. 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
  5. 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
  6. Testing:
    • Built-in example for Big-O analysis with big-o-test crate
    • Built-in example for Criterion bench

Running the default version

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)
  1. Init the submodule for the web-stats app: git submodule update --init --remote
  2. 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 ..
  3. Build the Rust app (release, optimized for the local processor): RUSTFLAGS="-C target-cpu=native" cargo build --release
  4. 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

How to use it

  • Click Use this template, at the top right of this github page
  • Edit Cargo.toml and clean it up from the dependencies you don't need + associated code, then, failing to compile
  • Remodel src/config & src/command_line modules to your needs -- then go ahead and do it for src/runtime as 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 in bench/
  • Inspect & adjust the src/frontend module & submodules
  • Share back (through a PR) any improvements you do to the template

Screenshots

Angular

rust+angular+material 1.png rust+angular+material 2.png (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)

Stats

rust+angular+internal_stats.png

Terminal

terminal-ui.png

EGui

egui-fractal-clock-example.png egui-lottie-animations.jpg

Telegram

telegram-bot.png

Command-Line options example

command-line-examples.png

Config .ron example

config-example.png

Notes on Angular upgrades for web-app

About

Bloated template for production applications featuring Tokio, Rocket & Console, Terminal, Egui, Angular & Telegram UIs + a Configuration Pattern to tie them all together with business logic

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Rust 82.1%
  • TypeScript 11.1%
  • HTML 5.8%
  • Other 1.0%