Build saas fast. Repeat.
saasbase
provides a range of functionality useful for building saas web
applications, covering many things from user management and auth, to
payments and invoice generation.
It is quite opinionated and channels decisions made based on core motivations: simplicity, extendability and development speed.
It focuses on the hypermedia-based approach with server-side generated html, champions embedded key-value databases for data storage and targets a deployment model of single all-in-one binary per application.
At the most basic level, saasbase
library defines a concrete data model
specifically targeting saas applications. Here one can find notions of
User
s, Product
s, Payment
s, subscription Plan
s and more.
The provided data model aims to fit most common use-cases for simple saas applications.
saasbase
provides an extensive set of operations for working with
application state as defined with the data model.
This logic is referred to as common as it remains framework-agnostic. It can be found in the respective top-level modules.
saasbase
takes it upon itself to provide building blocks for use with
selected web frameworks. This includes middleware, extractors and
ready-made endpoints.
Framework-specific functionality is provided in respective feature-gated
modules. Note that currently only the axum
web framework is supported.
In terms of provisioned endpoints, you'll find that most of the
functionality that doesn't need a custom html response is included. That's
everything from /login
form submit to common /api
operations. Pages as
well as html parts to be injected dynamically must be created by library
user. See the examples
directory for example usage.
The fastest way to get started is to build and run the provided demo. Clone
the repo, navigate to ./demo
and simply run cargo run
.
The demo should now be accessible at localhost:8000
. If that port is
unavailable on your machine simply modify the address
field of the
./demo/saasbase.toml
file.
For a more involved example application using saasbase
see the
ruda
project.
Examples showing off particular aspects of the library are also provided.
While you already have the repository cloned you can try running the
saasbase-cli
tool. Navigate to ./cli
and do cargo run
. With
saasbase-cli
you'll be able to inspect and mutate application state, either
on-line or off-line.
Pull in saasbase
dependency into your project, putting the following into
your Cargo.toml
[dependencies]
:
saasbase = "0.1.0"
As saasbase
tends to be opinionated and encourages employing certain
solutions for the sake of efficiency, the default feature set is meant to
be sensible for most use-cases.
That said, crate features can provide additional and/or alternative solutions in some cases (for example different database storages). Feel free to make use of them as needed.
saasbase = { version = "0.1.0", default-features = false, features = ["axum", "fjall"] }
saasbase
is organized into modules based on type of functionality they
provide.
Common usage pattern involves defining a configuration (or loading it from
file) and using it to generate a saasbase
router to be merged with the
main application router.
Assets and templates should be provided alongside Rust code. Assets can either be read from the filesystem at runtime or embedded into the application binary to enhance portability.
Deployment of a saasbase
-based application can be as easy as compiling
down to a single binary and exposing the web server listener to the outside
world. They only requirement on the system is a Rust installation and
a network connection.