ferro_cli/templates/
project.rs1pub fn cargo_toml(package_name: &str, description: &str, author: &str) -> String {
6 let authors_line = if author.is_empty() {
7 String::new()
8 } else {
9 format!("authors = [\"{author}\"]\n")
10 };
11
12 format!(
13 include_str!("files/backend/Cargo.toml.tpl"),
14 package_name = package_name,
15 description = description,
16 authors_line = authors_line
17 )
18}
19
20pub fn main_rs(package_name: &str) -> String {
21 include_str!("files/backend/main.rs.tpl").replace("{package_name}", package_name)
22}
23
24pub fn routes_rs() -> &'static str {
25 include_str!("files/backend/routes.rs.tpl")
26}
27
28pub fn controllers_mod() -> &'static str {
29 include_str!("files/backend/controllers/mod.rs.tpl")
30}
31
32pub fn home_controller() -> &'static str {
33 include_str!("files/backend/controllers/home.rs.tpl")
34}
35
36pub fn middleware_mod() -> &'static str {
39 include_str!("files/backend/middleware/mod.rs.tpl")
40}
41
42pub fn middleware_logging() -> &'static str {
43 include_str!("files/backend/middleware/logging.rs.tpl")
44}
45
46pub fn models_mod() -> &'static str {
48 include_str!("files/backend/models/mod.rs.tpl")
49}
50
51pub fn actions_mod() -> &'static str {
54 include_str!("files/backend/actions/mod.rs.tpl")
55}
56
57pub fn example_action() -> &'static str {
58 include_str!("files/backend/actions/example_action.rs.tpl")
59}
60
61pub fn config_mod() -> &'static str {
64 include_str!("files/backend/config/mod.rs.tpl")
65}
66
67pub fn config_database() -> &'static str {
68 include_str!("files/backend/config/database.rs.tpl")
69}
70
71pub fn config_mail() -> &'static str {
72 include_str!("files/backend/config/mail.rs.tpl")
73}
74
75pub fn bootstrap() -> &'static str {
76 include_str!("files/backend/bootstrap.rs.tpl")
77}
78
79pub fn migrations_mod() -> &'static str {
82 include_str!("files/backend/migrations/mod.rs.tpl")
83}
84
85pub fn package_json(project_name: &str) -> String {
88 include_str!("files/frontend/package.json.tpl").replace("{project_name}", project_name)
89}
90
91pub fn vite_config() -> &'static str {
92 include_str!("files/frontend/vite.config.ts.tpl")
93}
94
95pub fn tsconfig() -> &'static str {
96 include_str!("files/frontend/tsconfig.json.tpl")
97}
98
99pub fn index_html(project_title: &str) -> String {
100 include_str!("files/frontend/index.html.tpl").replace("{project_title}", project_title)
101}
102
103pub fn main_tsx() -> &'static str {
104 include_str!("files/frontend/src/main.tsx.tpl")
105}
106
107pub fn home_page() -> &'static str {
108 include_str!("files/frontend/src/pages/Home.tsx.tpl")
109}
110
111pub fn inertia_props_types() -> &'static str {
112 include_str!("files/frontend/src/types/inertia-props.ts.tpl")
113}
114
115pub fn app_layout() -> &'static str {
118 include_str!("files/frontend/src/layouts/AppLayout.tsx.tpl")
119}
120
121pub fn auth_layout() -> &'static str {
122 include_str!("files/frontend/src/layouts/AuthLayout.tsx.tpl")
123}
124
125pub fn layouts_index() -> &'static str {
126 include_str!("files/frontend/src/layouts/index.ts.tpl")
127}
128
129pub fn globals_css() -> &'static str {
130 include_str!("files/frontend/src/styles/globals.css.tpl")
131}
132
133pub fn login_page() -> &'static str {
136 include_str!("files/frontend/src/pages/auth/Login.tsx.tpl")
137}
138
139pub fn register_page() -> &'static str {
140 include_str!("files/frontend/src/pages/auth/Register.tsx.tpl")
141}
142
143pub fn forgot_password_page() -> &'static str {
144 include_str!("files/frontend/src/pages/auth/ForgotPassword.tsx.tpl")
145}
146
147pub fn reset_password_page() -> &'static str {
148 include_str!("files/frontend/src/pages/auth/ResetPassword.tsx.tpl")
149}
150
151pub fn dashboard_page() -> &'static str {
152 include_str!("files/frontend/src/pages/Dashboard.tsx.tpl")
153}
154
155pub fn profile_page() -> &'static str {
156 include_str!("files/frontend/src/pages/Profile.tsx.tpl")
157}
158
159pub fn settings_page() -> &'static str {
160 include_str!("files/frontend/src/pages/Settings.tsx.tpl")
161}
162
163pub fn auth_controller() -> &'static str {
166 include_str!("files/backend/controllers/auth.rs.tpl")
167}
168
169pub fn dashboard_controller() -> &'static str {
170 include_str!("files/backend/controllers/dashboard.rs.tpl")
171}
172
173pub fn profile_controller() -> &'static str {
174 include_str!("files/backend/controllers/profile.rs.tpl")
175}
176
177pub fn settings_controller() -> &'static str {
178 include_str!("files/backend/controllers/settings.rs.tpl")
179}
180
181pub fn authenticate_middleware() -> &'static str {
182 include_str!("files/backend/middleware/authenticate.rs.tpl")
183}
184
185pub fn user_model() -> &'static str {
186 include_str!("files/backend/models/user.rs.tpl")
187}
188
189pub fn password_reset_tokens_model() -> &'static str {
190 include_str!("files/backend/models/password_reset_tokens.rs.tpl")
191}
192
193pub fn create_users_migration() -> &'static str {
196 include_str!("files/backend/migrations/create_users_table.rs.tpl")
197}
198
199pub fn create_sessions_migration() -> &'static str {
200 include_str!("files/backend/migrations/create_sessions_table.rs.tpl")
201}
202
203pub fn create_password_reset_tokens_migration() -> &'static str {
204 include_str!("files/backend/migrations/create_password_reset_tokens_table.rs.tpl")
205}
206
207pub fn gitignore() -> &'static str {
210 include_str!("files/root/gitignore.tpl")
211}
212
213pub fn env(project_name: &str) -> String {
214 include_str!("files/root/env.tpl").replace("{project_name}", project_name)
215}
216
217pub fn env_example() -> &'static str {
218 include_str!("files/root/env.example.tpl")
219}
220
221pub fn readme(project_name: &str, project_title: &str, description: &str) -> String {
222 include_str!("files/root/README.md.tpl")
223 .replace("{project_name}", project_name)
224 .replace("{project_title}", project_title)
225 .replace("{description}", description)
226}
227
228pub fn schedule_rs() -> &'static str {
232 include_str!("files/backend/schedule.rs.tpl")
233}
234
235pub fn tasks_mod() -> &'static str {
237 include_str!("files/backend/tasks/mod.rs.tpl")
238}