shuttle_common/templates.rs
1use std::collections::HashMap;
2
3use serde::{Deserialize, Serialize};
4
5/// Schema used in `examples/templates.toml` and services that parse it
6#[derive(Debug, Serialize, Deserialize)]
7pub struct TemplatesSchema {
8 /// Version of this schema
9 pub version: u32,
10 /// Mapping of tag names to logo URLs
11 pub logos: HashMap<String, String>,
12 /// Very basic templates, typically Hello World
13 pub starters: HashMap<String, TemplateDefinition>,
14 /// Non-starter templates
15 pub templates: HashMap<String, TemplateDefinition>,
16 /// Examples not meant to be templates
17 pub examples: HashMap<String, TemplateDefinition>,
18 /// Examples with attached tutorials
19 pub tutorials: HashMap<String, TemplateDefinition>,
20 /// Templates made by community members
21 pub community_templates: HashMap<String, TemplateDefinition>,
22}
23
24#[derive(Debug, Default, Serialize, Deserialize)]
25pub struct TemplateDefinition {
26 /// Title of the template
27 pub title: String,
28 /// A short description of the template
29 pub description: String,
30 /// Path relative to the repo root
31 pub path: Option<String>,
32 /// List of areas where this template is useful. Examples: "Web app", "Discord bot", "Monitoring", "Automation", "Utility"
33 pub use_cases: Vec<String>,
34 /// List of keywords that describe the template. Examples: "axum", "serenity", "typescript", "saas", "fullstack", "database"
35 pub tags: Vec<String>,
36 /// URL to a live instance of the template (if relevant)
37 pub live_demo: Option<String>,
38
39 /// If this template is available in the `shuttle init --template` short-hand options, add that name here
40 pub template: Option<String>,
41
42 ////// Fields for community templates
43 /// GitHub username of the author of the community template
44 pub author: Option<String>,
45 /// URL to the repo of the community template
46 pub repo: Option<String>,
47}