-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: project structure, custom binary name, welcome page update (#203)
* intro links * feat: add project structure doc
- Loading branch information
Showing
6 changed files
with
98 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
title: Project structure | ||
description: Cargo workspaces and custom binary names | ||
--- | ||
|
||
This page describes what Shuttle expects from your project structure, how it handles cargo workspaces, and how to use a custom binary name. | ||
|
||
## Basic structure | ||
|
||
After initializing a basic Shuttle project, the file structure will look like this: | ||
|
||
``` | ||
. | ||
├── .gitignore | ||
├── Cargo.toml | ||
├── Shuttle.toml (optional) | ||
└── src/ | ||
└── main.rs | ||
``` | ||
|
||
The file `Shuttle.toml` is optional and can be used to override default settings for [project name](/configuration/project-name) and [deployment files](/configuration/files). | ||
|
||
## Workspaces | ||
|
||
Shuttle supports [cargo workspaces](https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html). Simply run | ||
the project and deployment commands in the root of the workspace, and the project name will be taken from the | ||
directory name of the workspace or a `Shuttle.toml` with a name key in the root of the workspace. | ||
See [Project Name](/configuration/project-name) for more info. | ||
|
||
This is an example of a workspace structure with shared code between a backend and frontend crate: | ||
|
||
``` | ||
. | ||
├── .gitignore | ||
├── Cargo.toml | ||
├── Shuttle.toml (optional) | ||
├── backend | ||
│ ├── Cargo.toml | ||
│ └── src | ||
│ └── main.rs (contains #[shuttle_runtime::main]) | ||
├── frontend | ||
│ ├── Cargo.toml | ||
│ └── src | ||
│ └── main.rs | ||
└── shared | ||
├── Cargo.toml | ||
└── src | ||
└── lib.rs | ||
``` | ||
|
||
### Caveats | ||
|
||
We currently only support one Shuttle service per workspace, so you can have many crates in a workspace, but only | ||
one crate with a `shuttle_runtime::main` macro. | ||
We intend to allow starting several Shuttle services at the same time, as part of the same project. | ||
The long term plan is to have one central service that routes to the other services in the project, sharing resources amongst them. | ||
Any feedback on what you would like to see in this area is most welcome. | ||
|
||
## Multiple binaries | ||
|
||
If you want to keep your project structured for allowing both running with and without Shuttle, check out the [standalone-binary](https://github.com/shuttle-hq/shuttle-examples/tree/main/other/standalone-binary) example. This is great for gradually adding Shuttle into your project. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters