Skip to content

kyle-rader/rust-web-app

Repository files navigation

RustWebApp

Welcome to RustWebApp! An early-stage but solid template repository for building modern web applications using Rust on the server and SvelteJS on the frontend with an islands architecture.

Architecture

This template implements a modern web application architecture with:

  • Backend: Rust with Axum web framework, providing high-performance API endpoints
  • Frontend: SvelteJS with TypeScript, offering reactive UI components
  • Database: PostgreSQL with Diesel ORM for type-safe database operations
  • Authentication: JWT-based authentication system
  • Deployment: Docker containerization with Fly.io deployment support
  • Development: Hot reload for both frontend and backend development

The template follows an islands architecture pattern, allowing for server-side rendering with selective client-side hydration where needed.

Developer Setup

This template provides a solid foundation for building web applications with Rust backend and SvelteJS frontend. While still in early development, it includes the essential components needed to get started. It can be developed locally on your host of choice, or entirely on Docker. We minimally use Docker to run local development databases.

🪟 Windows - I highly recommend using WSL - the Windows Subsystem for Linux, which Docker can also use for it's backend.

See setup WSL

Install Tools

Install the following for your platform first.

Host Development Tools

These tools are already installed in our base docker image.

  • Rust - the language used for the back end server

  • NodeJS + TypeScript - for the front end client

    Recommend using an installation manager

Get the code

Authentication

I recommend using SSH auth with GitHub.

See GitHub SSH Docs for details.

TL;DR

~> ssh-keygen -t RSA -C YOUR_EMAIL -b 4096
# enter
# enter

# Keys created in ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub

# Copy ~/.ssh/id_rsa.pub
# Go to https://github.com/settings/keys
# Add New SSH Key
# Paste Key

# Test auth by running
~> ssh [email protected] -T

# If it works you should see
Hi YOUR_USER_NAME! You've successfully authenticated, but GitHub does not provide shell access.

Clone the repo

git clone [email protected]:kyle-rader/rustwebapp.git
cd rustwebapp

Quick Start

  1. Clone the repository (see above)
  2. Set up your development environment (see Developer Setup below)
  3. Start the development servers:
    docker-compose up
  4. Access your application:
  5. Customize the template:
    • Update the application name and branding
    • Modify the database schema in server/migrations/
    • Add new API endpoints in server/src/web/routes/
    • Create new Svelte components in client/src/lib/components/

⚠️ Note: This template is still in early development. While it provides a solid foundation, you may encounter rough edges or missing features. Contributions and feedback are welcome!

Develop

On Docker

# Launch with all logs attached in the foreground
docker-compose up

# Launch in the background and then attach to logs
docker-compose up -d

Go to

http://localhost:3000

You should be redirected to http://localhost:5173. In development we do not bundle assets and run a separate front-end live reload server with Vite.

Host Development

About

A template for building web applications with Rust and Svelte

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published