Servust

Generate quick templates of rust backend servers

crates.io version Crates.io Downloads crates.io license Github image

Introduction

Servust is a simple CLI tool to create a new project from a template, kind of like npx create-react-app but for rust frameworks project.

  • Multi framework/library support
  • Bare minimum setup
  • Lightweight and fast CLI (~2mb binary size)
  • Takes few seconds to generate a project

Example

servust --framework actix --orm diesel --database postgres my-server

CLI Run

Project Status

  • Heavily under development.
  • Supports only handful of frameworks and libraries (check Supported Frameworks/Libraries).
  • Currently no option to create server without ORM/Databases.

Getting Started

Quick Start

Installation

Currently, you can either download packages from the

GitHub releases page

or install from crates.io using

cargo install servust

Usage

servust --framework <framework_name> --orm <ORM_name> --database <database_name> my-server

--framework [REQUIRED]

--orm [REQUIRED]

--database [OPTIONAL] - default postgres

check Supported Frameworks for more details

Supported Frameworks and Libraries

Servers

ORMS

Databases

  • postgres
  • mysql
  • sqlite

Folder Structure

After Creating any project (Other than tonic), the folder structure will be as follows:

src
├── main.rs
├── db.rs

CARGO.toml

For tonic

src
├── lib.rs
├── db.rs
├── server.rs
├── client.rs

CARGO.toml

db.rs: Contains the code for the database connection pool. There is async call even on a synchronous function, but theoritically it should be fine. I am not sure if it is a good practice or not. Please let me know if it creates a problem.

Contributing

Issues

  • Please file issues on the GitHub issue tracker.
  • Feel free to send a PR if you have a fix for an issue.

Github Actions

  • Need help in getting the releases to target all platforms.

Documentation

  • Need help in writing documentation for the project.

Disclaimer

Basically I need help with everything. I am not a rust expert and I am not a good writer. I am just trying to learn. So if you are interested in helping out, please do reach out. I am also open to suggestions and ideas.

Thank You.

PS: above note was also a help from Github CoPilot xD.

TODO Outline

  • Add a non ORM and non database setup option
  • Make releases for all platforms
  • Make a better documentation