Crates.io | create-rust-app_cli |
lib.rs | create-rust-app_cli |
version | 11.0.0 |
source | src |
created_at | 2022-02-05 23:20:17.754028 |
updated_at | 2024-01-15 23:47:51.716448 |
description | Set up a modern rust+react web app by running one command. |
homepage | |
repository | https://github.com/Wulf/create-rust-app |
max_upload_size | |
id | 527617 |
size | 8,932,853 |
Set up a modern rust+react web app by running one command. Join us on discord.
diesel_cli
diesel_cli
with your system's libsqlite3
, you may run cargo install diesel_cli --no-default-features --features sqlite-bundled
.cargo install create-rust-app_cli
create-rust-app my-todo-app
# .. select backend framework, plugins, etc.
# Code-gen resources for your project
cd ./my-todo-app
create-rust-app
# .. select resource type / properties
create-rust-app create <project_name>
cargo fullstack
actix-web
poem
(support temporarily on hold, use version 9.2.2: cargo install create-rust-app_cli@9.2.2
)cargo dsync
in your project (see codegen section below)./views
folder contains all templates/frontend/bundles
folder contains all the bundles which can be included in your views via {{bundle(name="MyBundle.tsx")}}
create_rust_app::render_single_page_application("/app","your_spa.html")
(if you're using Poem, the parameters are slightly different, an example is provided in the function's documentation)cargo tsync
in your project folder; see codegen section below)react-router-dom
)react-query
hooks generation ($ cd my_project && create-rust-app
, then select "Generate react-query hooks")Authentication (+ Authorization) plugin
Auth
guardSocial authentication (OIDC) plugin
app.app_data(Data::new(AuthConfig {
oidc_providers: vec![GOOGLE(
"client_id",
"client_secret",
"/success/redirect",
"/error/redirect",
)],
}))
Then, redirect your users to start the flow!
<a href={"/api/auth/google"}>Login with Google</a>
Container plugin
Development plugin
localhost:3000/admin
(still in development)Storage plugin
Adds Storage
extractor which allows you to upload/download files from an S3-compatible object store
Seamlessly add single or multiple attachments to your models using Attachment::*
!
Here are some examples:
let s3_key = Attachment::attach("avatar", "users", user_id, AttachmentData {
file_name: "image.png",
data: bytes
})?;
let storage: Storage // retreive this via the appropriate extractor in your frameowrk of choice
let url = storage.download_uri(s3_key)?;
(note: see Attachment::*
and Storage::*
for more functionality!)
GraphQL plugin
localhost:3000/graphql
Utoipa plugin
http://localhost:3000/swagger-ui/
Tasks Plugin
fang
under the hood and all it's features are exposed.create_rust_app::tasks::queue()
cargo run --bin tasks
Workspace Support (Enabled by default, not tied to a feature flag)
CRA_MANIFEST_PATH
: default ./frontend/dist/manifest.json
when called from workspace root, ../frontend/dist/manifest.json
otherwise.CRA_FRONTEND_DIR
: default ./frontend
when called from workspace root, ../frontend
otherwise.CRA_VIEWS_GLOB
: default backend/views/\*\*/\*.html
when called from workspace root, views/\*\*/\*.html
otherwise.cargo dsync
backend/models
folder!cargo tsync
#[tsync::tsync]
. You'll find the output for this command here: frontend/src/types/rust.d.ts
.cd my_project && create-rust-app
/api
!react-query
hooks generation for frontend
services/
folderQuestions and comments are welcome in the issues section!
If you're experiencing slow compilation time, make sure there isn't any bloat in the template files (look for node_modules
or typescript / parcel caches and delete them).
Moreover, you can try using the mold linker which may also improve compilation times.