Starters
Simplify your project setup with Loco's predefined boilerplates, designed to make your development journey smoother. To get started, install our CLI and choose the template that suits your needs.
Create a starter:
)
Available Starters
SaaS Starter
The SaaS starter is an all-included set up for projects requiring both a UI and a REST API. For the UI this starter supports a client-side app or classic server-side templates (or a combination).
UI
- Frontend starter built on React and Vite (easy to replace with your preferred framework).
- Static middleware that point on your frontend build and includes a fallback index. Alternatively you can configure it for static assets for server-side templates.
- The Tera view engine configured for server-side templates, including i18n configuration. Templates and i18n assets live in
assets/
.
Rest API
ping
andhealth
endpoints to check service health. See all endpoint with the following commandcargo loco routes
- Users table and authentication middleware.
- User model with authentication logic and user registration.
- Forgot password API flow.
- Mailer that sends welcome emails and handles forgot password requests.
Configuring assets for serverside templates
The SaaS starter comes preconfigured for frontend client-side assets. If you want to use server-side template rendering which includes assets such as pictures and styles, you can configure the asset middleware for it:
In your config/development.yaml
, uncomment the server-side config, and comment the client-side config.
# server-side static assets config
# for use with the view_engine in initializers/view_engine.rs
#
static:
enable: true
must_exist: true
precompressed: false
folder:
uri: "/static"
path: "assets/static"
fallback: "assets/static/404.html"
# client side app static config
# static:
# enable: true
# must_exist: true
# precompressed: false
# folder:
# uri: "/"
# path: "frontend/dist"
# fallback: "frontend/dist/index.html"
Rest API Starter
Choose the Rest API starter if you only need a REST API without a frontend. If you change your mind later and decide to serve a frontend, simply enable the static
middleware and point the configuration to your frontend
distribution folder.
Lightweight Service Starter
Focused on controllers and views (response schema), the Lightweight Service starter is minimalistic. If you require a REST API service without a database, frontend, workers, or other features that Loco provides, this is the ideal choice for you!