Skip to content

Demo for Rust, React, Typescript, Docker, Terraform and Kubernetes

License

Notifications You must be signed in to change notification settings

deefco/rust-react-typescript-demo

 
 

Repository files navigation

Build Status Dependabot Status

rust-react-typescript-demo [WIP]

This repository contains demo code for my YouTube programming learning series about Rust, React, TypeScript, Docker, Terraform and Kubernetes. For this project, we're creating foodi, a meal logging tool.

Please note, the project is not yet finished. If you'd like to follow along, ask questions, or participate:

When complete, this repo will have the following features:

  • Rust & Diesel based backend
  • React, Mobx, and TypeScript based frontend
  • Docker image with frontend & backend all-in-one
  • Terraform for managing a GKE cluster on GCP
  • Kubernetes manifest for running on GKE

You can find the videos on YouTube below:

In the series, we're building foodi, a web-based meal logger/tracking tool.

Compiling the Rust Backend Server

To build the Rust backend, you will need to install the Rust nightly build with rustup. First, go to https://rustup.rs/ and install rustup. Then, install Rust nightly:

$ rustup default nightly
...

Once you have the nightly build installed, you can build the backend.

Build the Backend

$ cd foodi-backend
$ cargo build
...

Run the Database Migration Scripts

To create the initial database schema, run the migration scripts using diesel:

$ cargo install diesel_cli --no-default-features --features sqlite
...
$ diesel migration run --database-url database.sqlite
...

Bulding the Backend Server

Lastly, you can now run the backend server:

$ cargo run

Running the Frontend Server

To build and run the frontend assets and server, you will need a recent version of Node.js and Yarn installed. Using homebrew on macOS, you can install it with homebrew:

$ brew install yarn
...

Install package dependencies

Install the frontend package dependencies using Yarn:

$ cd foodi-frontend
$ yarn install
...

Run the Frontend Server

Use parcel to run the frontend development server:

$ parcel index.html
...

Build and run the Docker image

Assuming you have Docker installed, run the build command from the top level of the repo:

$ docker build . -t foodi:latest
...

Once the build completes, run the container, and map port 80 from inside the container to outside the container on port 8080 (on your host machine):

$ docker run -p 8080:80 foodi:latest
...

🎉 Now you can open http://localhost:8080/ in your browser and test the app.

About

Demo for Rust, React, Typescript, Docker, Terraform and Kubernetes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 50.3%
  • Rust 40.4%
  • Dockerfile 7.7%
  • Other 1.6%