Coder Social home page Coder Social logo

orhun / avid-rustacean Goto Github PK

View Code? Open in Web Editor NEW

This project forked from tylerbloom/avid-rustacean

0.0 1.0 0.0 216 KB

This repo contains the code for my blog, The Avid Rustacean

Home Page: https://avid-rustacean.shuttleapp.rs/

License: GNU Affero General Public License v3.0

Rust 98.84% HTML 1.16%

avid-rustacean's Introduction

GitHub Workflows Deployment Maintenance

The Avid Rustacean

This repo contains all of the code for my blog, The Avid Rustacean. The blog is fully Rust (front and back ends) and is split into three crates, backend, model, and frontend.

The backend uses Axum as its REST framework and MongoDB as its database. When deployed, the backend's build script compiles the frontend assets (the HTML index, the WASM module, and the JS bridge code) and statically binds them into the server executable.

The frontend uses a combination of Yew and Ratatui to provide a TUI aesthetic in the broswer. To see how this is done, check out the article that I wrote about its creation.

Lastly, the model crate contains common code between the front and back ends (and a bit extra). For example, the markdown AST definition is found here as well as the server-side parsing code and syntax highlighting code.

Contributions

Feel free to make suggestions, bring up things that would make the site easier to use, or to fork this repo to make your own blog. All that I ask is for derived works to also be AGPL-licensed. The point of this project (both blog code and blog posts) is to share what I've created and thought about. I ask that others approach this project with the same desire.

Development

If you'd like to run a local version of this project for development, there are a few requirements.

First, let's get the backend compiling. The backend uses Shuttle for deployment, which has a local deployment option. Install shuttle via cargo with cargo install cargo-shuttle. Shuttle uses docker, so make sure that it is installed and running.

Next, the frontend. You'll need to make sure you have the wasm32-unknown-unknown target installed via rustup (or however you manage your Rust toolchains). For local deployments, you will need Trunk, which you can install via cargo with cargo install trunk.

For running everything, you'll launch the front and back ends seperately. In the backend directory, simply run cargo shuttle run. This will compile and run the backend server, which will listen to requests on port 8000. If you change the backend, you will need to re-run this. In the frontend directory, run trunk serve. Trunk acts like a frontend proxy that serves the frontend assets and proxies any other calls to the backend. The Trunk.toml file contains this config. By default, Trunk serves assets on port 8080. If you make code changes to the frontend, Trunk will automatically recompile and re-deploy the frontend without you needing to reload the page.

To access the app on the machine that's deploying it, simply go to http://localhost:8080, and you'll see it. If you'd like to access it from another device (like a phone), make sure both the host and client devices are on the same network. When you launch Trunk, you'll see a few output like this:

    ๐Ÿ  http://127.0.0.1:8080
    ๐Ÿ’ป http://192.168.202.218:8080
    ๐Ÿ’ป http://172.0.0.1:8080

The middle one contains your local IP address. On the client device, go to that address and you'll see your app.

Future Plans

Currently, this project stands is an MVP. It works and is relatively easy to use (on desktop), but there is a lot of room for improvement.

avid-rustacean's People

Contributors

tylerbloom avatar dependabot[bot] avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.