Continue creating boosted Server Side Rendering implementation. In the first part we that lets choose the best technologies for our Web Server. prepared ReactJS Application with SSR script Choosing Tech Stack for the SSR Web server Rust has the most powerful combination of safety and hight speed for today (you can check out here why - ). In addition, Actix-web framework is the fastest one according . www.rust-lang.org TechEmpower Framework Benchmark So, let’s use the best technologies for our forced Web Server. Setup Rust App It is easy to setup Rust on your computer - just go to website and install CLI in just one step. rustup.rs rustup Next step is initialisation a new app. Cargo, Rust package manager can help with it: run inside repository folder. cargo init The Cargo.toml file for each package is called its manifest. It contains settings and dependencies. New one should look like that: = = = [ ] = [package] name "rust-ssr-webserver" version "0.1.0" authors "Alex Tkachuk <alex@pagespeed.green>" edition "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] Now we can add our dependencies: = { version = , features = [ ] } = = = = = = = = actix-web "^2.0.0" "rustls" actix-rt "^1.0.0" actix-files "^0.2.1" env_logger "^0.7.1" futures "^0.3.4" mime_guess "^2.0.1" serde_json "^1.0.40" lazy_static "^1.4.0" rustls "^0.16.0" Using actix-web is qute easy to create web server. Firstly, we need to read SSL keys for supporting HTTPS and HTTP/2: config = ServerConfig::new(NoClientAuth::new()); cert_file = & BufReader::new(File::open( ).unwrap()); key_file = & BufReader::new(File::open( ).unwrap()); cert_chain = certs(cert_file).unwrap(); keys = rsa_private_keys(key_file).unwrap(); config.set_single_cert(cert_chain, keys.remove( )).unwrap(); let mut let mut "cert.pem" let mut "key.pem" let let mut 0 Be aware of using unwrap() in production - if it fails, the app will crash (panic). We are ready for actually Web Server code now: HttpServer::new(|| { App::new() .wrap(middleware::Logger:: ()) .service(Files::new( , )) .default_service( web::resource( ) .route(web::get().to(index)) .route( web::route() .guard(guard::Not(guard::Get())) .to(|| HttpResponse::MethodNotAllowed()), ), ) }) .bind_rustls( , config)? .run() .await default "/static" "static" "" "0.0.0.0:3001" This line: is for serving all static asserts that we created by running in previous article - ( ). For handling HTML-files requests from ReactJs App we need to use with serving all routes by using with empty string. The function is handler for such requests: .service(Files::new("/static", "static") npm build:ssr How To Improve React App Performance with SSR and Rust [Part I: SSR] .default_service() web::resource("") index async (req: HttpRequest) -> Responder { path_req = req.match_info().query( ).get( ..).unwrap_or_default().trim().clone(); path = path_req.len() == { } { ROUTES.get(path_req) { (r) => r, => } }; std::fs::File::open( ( , path)) { ( file) => { contents = ::new(); file.read_to_string(& contents).unwrap_or_default(); HttpResponse:: () .content_type( ) .header( , ) .header( , ) .header( , ) .body(contents) }, (e) => { } } } fn index impl let "tail" 1 let if 0 "home_page" else match Some None "index" match format! "static/{}.html" Ok mut let mut String mut Ok "text/html; charset=utf-8" "Cache-Control" "no-cache, no-store, max-age=0, must-revalidate" "pragma" "no-cache" "x-ua-compatible" "IE=edge, Chrome=1" Err // error handling The function implements the routing logic, so our web server can return right HTML file (React server rendered) by a route. The constant is basically contains data from that was generated on React side. ROUTES routes.json One improvement that you can do for this implementation is using a cash instead of directly reading a file from disk. Finally, copy folder dist/web to static, obveously, it should be automatic step, and run our Web Server by cargo r Full example is located in the . GitHub repository The final article of Server Side Rendering is about testing performance between this solution vs Node.js You can check how fast this approach in production by getting Google PageSpeed Insights Performance score for website. PageSpeed Green Happy coding! * Website vector created by slidesgo - www.freepik.com