Skip to content

Commit

Permalink
Merge branch 'master' into fix/cli-snipdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
sectore committed Sep 17, 2024
2 parents c5cae48 + 9451924 commit 5fa37a2
Show file tree
Hide file tree
Showing 421 changed files with 8,726 additions and 86,942 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci-generators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
run: cargo install sea-orm-cli

- name: scaffold
run: cargo run -- generate scaffold car name:string year:int && cargo build
run: cargo run -- generate scaffold --htmx car name:string year:int && cargo build
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
Expand All @@ -69,7 +69,7 @@ jobs:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres_test

- name: controller
run: cargo run -- generate controller post && cargo build && cargo test requests::post
run: cargo run -- generate controller pages about && cargo build && cargo test pages
working-directory: ./examples/demo
env:
REDIS_URL: redis://localhost:${{job.services.redis.ports[6379]}}
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:

- name: test ${{ matrix.field_type }} scaffold field type
run: |
cargo run -- generate scaffold room \
cargo run -- generate scaffold --api room \
uuid_uniq:uuid \
uuid_null:uuid_col \
uuid:uuid_col! \
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
* fix: introduce secondary binary for compile-and-run on Windows. [https://github.com/loco-rs/loco/pull/727](https://github.com/loco-rs/loco/pull/727)
* Add fallback behavior. [https://github.com/loco-rs/loco/pull/732](https://github.com/loco-rs/loco/pull/732)
* Add Scheduler Feature for Running Cron Jobs. [https://github.com/loco-rs/loco/pull/735](https://github.com/loco-rs/loco/pull/735)
* Add `--html`, `--htmx` and `--api` flags to scaffold CLI command. [https://github.com/loco-rs/loco/pull/749](https://github.com/loco-rs/loco/pull/749)
* Add base template for scaffold generation. [https://github.com/loco-rs/loco/pull/752](https://github.com/loco-rs/loco/pull/752)



## v0.8.0
Expand Down
70 changes: 39 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<img src="https://github.com/loco-rs/loco/assets/83390/992d215a-3cd3-42ee-a1c7-de9fd25a5bac"/>

<h1>Loco</h1>
<h1>Welcome to Loco</h1>

<h3>
<!-- <snip id="description" inject_from="yaml"> -->
Expand All @@ -18,51 +18,66 @@

English · [中文](./README-zh_CN.md)

# Loco

> Loco is strongly inspired by Rails. If you know Rails and Rust, you'll feel at home. If you only know Rails and new to Rust, you'll find Loco refreshing. We do not assume you know Rails.
## What's Loco?
`Loco` is strongly inspired by Rails. If you know Rails and Rust, you'll feel at home. If you only know Rails and new to Rust, you'll find Loco refreshing. We do not assume you know Rails.

To get started quickly and see Loco in action, check out our [casts video](https://loco.rs/casts/). It's a great way to familiarize yourself with the framework and see some of its key features in use.
For a deeper dive into how Loco works, including detailed guides, examples, and API references, check out our [documentation website](https://loco.rs).

## Quick Start

## Features of Loco:

* `Convention Over Configuration:` Similar to Ruby on Rails, Loco emphasizes simplicity and productivity by reducing the need for boilerplate code. It uses sensible defaults, allowing developers to focus on writing business logic rather than spending time on configuration.

* `Rapid Development:` Aim for high developer productivity, Loco’s design focuses on reducing boilerplate code and providing intuitive APIs, allowing developers to iterate quickly and build prototypes with minimal effort.

* `ORM Integration:` Model your business with robust entities, eliminating the need to write SQL. Define relationships, validation, and custom logic directly on your entities for enhanced maintainability and scalability.

* `Controllers`: Handle web requests parameters, body, validation, and render a response that is content-aware. We use Axum for the best performance, simplicity, and extensibility. Controllers also allow you to easily build middlewares, which can be used to add logic such as authentication, logging, or error handling before passing requests to the main controller actions.

* `Views:` Loco can integrate with templating engines to generate dynamic HTML content from templates.

* `Background Jobs:` Perform compute or I/O intensive jobs in the background with a Redis backed queue, or with threads. Implementing a worker is as simple as implementing a perform function for the Worker trait.

* `Scheduler:` Simplifies the traditional, often cumbersome crontab system, making it easier and more elegant to schedule tasks or shell scripts.

* `Mailers:` A mailer will deliver emails in the background using the existing loco background worker infrastructure. It will all be seamless for you.

* `Storage:` In Loco Storage, we facilitate working with files through multiple operations. Storage can be in-memory, on disk, or use cloud services such as AWS S3, GCP, and Azure.

* `Cache:` Loco provides an cache layer to improve application performance by storing frequently accessed data.

So see more Loco features, check out our [documentation website](https://loco.rs/docs/getting-started/tour/).



## Getting Started
<!-- <snip id="quick-installation-command" inject_from="yaml" template="sh"> -->
```sh
cargo install loco-cli
cargo install sea-orm-cli # Only when DB is needed
```
<!-- </snip> -->

Now you can create your new app (choose "`SaaS` app").
Now you can create your new app (choose "`SaaS` app").


<!-- <snip id="loco-cli-new-from-template" inject_from="yaml" template="sh"> -->
```sh
❯ loco new
✔ ❯ App name? · myapp
✔ ❯ What would you like to build? · SaaS app (with DB and user auth)
✔ ❯ Select a DB Provider · Sqlite
✔ ❯ Select your background worker type · Async (in-process tokyo async tasks)
✔ ❯ Select an asset serving configuration · Client (configures assets for frontend serving)

🚂 Loco app generated successfully in:
myapp
```
<!-- </snip> -->


To configure a database , please run a local postgres database with loco:loco and a db named [insert app]_development.
<!-- <snip id="postgres-run-docker-command" inject_from="yaml" template="sh"> -->
```sh
docker run -d -p 5432:5432 \
-e POSTGRES_USER=loco \
-e POSTGRES_DB=myapp_development \
-e POSTGRES_PASSWORD="loco" \
postgres:15.3-alpine
myapp/
```
<!-- </snip> -->


A more advanced set of `compose.yaml` and `Dockerfiles` that include Redis and the `mailtutan` mailer are available for [each starter on GitHub](https://github.com/loco-rs/loco/blob/master/starters/saas/.devcontainer/compose.yaml).

Now `cd` into your `myapp` and start your app:

<!-- <snip id="starting-the-server-command-with-output" inject_from="yaml" template="sh"> -->
<!-- <snip id="starting-the-server-command-with-output" inject_from="yaml" template="sh"> -->
```sh
$ cargo loco start

Expand All @@ -86,13 +101,6 @@ listening on port 5150
```
<!-- </snip> -->

## Project Status
+ Stateless APIs
+ Complete `SaaS` products with user authentication
+ Purpose-built services such as ML inference endpoints
+ Full stack projects with separate frontend project integrated with Loco
+ Hobby projects full-stack with backend and HTML frontend

## Powered by Loco
+ [SpectralOps](https://spectralops.io) - various services powered by Loco
framework
Expand Down
1 change: 1 addition & 0 deletions docs-site/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
public/
node_modules/
Loading

0 comments on commit 5fa37a2

Please sign in to comment.