phos 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/README.md +68 -42
  2. package/dist/cli.js +351 -171
  3. package/dist/cli.js.map +1 -1
  4. package/dist/generators/backends/elysia.d.ts +1 -1
  5. package/dist/generators/backends/elysia.d.ts.map +1 -1
  6. package/dist/generators/backends/elysia.js +22 -127
  7. package/dist/generators/backends/elysia.js.map +1 -1
  8. package/dist/generators/backends/fastapi.d.ts +1 -1
  9. package/dist/generators/backends/fastapi.d.ts.map +1 -1
  10. package/dist/generators/backends/fastapi.js +40 -148
  11. package/dist/generators/backends/fastapi.js.map +1 -1
  12. package/dist/generators/frontends/astro.d.ts +1 -1
  13. package/dist/generators/frontends/astro.d.ts.map +1 -1
  14. package/dist/generators/frontends/astro.js +17 -295
  15. package/dist/generators/frontends/astro.js.map +1 -1
  16. package/dist/generators/frontends/nextjs.d.ts +1 -1
  17. package/dist/generators/frontends/nextjs.d.ts.map +1 -1
  18. package/dist/generators/frontends/nextjs.js +17 -266
  19. package/dist/generators/frontends/nextjs.js.map +1 -1
  20. package/dist/generators/frontends/svelte.d.ts +1 -1
  21. package/dist/generators/frontends/svelte.d.ts.map +1 -1
  22. package/dist/generators/frontends/svelte.js +18 -316
  23. package/dist/generators/frontends/svelte.js.map +1 -1
  24. package/dist/generators/monorepo.d.ts +1 -1
  25. package/dist/generators/monorepo.d.ts.map +1 -1
  26. package/dist/generators/monorepo.js +369 -202
  27. package/dist/generators/monorepo.js.map +1 -1
  28. package/dist/generators/single.d.ts +1 -1
  29. package/dist/generators/single.d.ts.map +1 -1
  30. package/dist/generators/single.js +335 -134
  31. package/dist/generators/single.js.map +1 -1
  32. package/dist/templates/backend/elysia/src/api/user_api.d.ts +1 -0
  33. package/dist/templates/backend/elysia/src/api/user_api.d.ts.map +1 -0
  34. package/dist/templates/backend/elysia/src/api/user_api.js +2 -0
  35. package/dist/templates/backend/elysia/src/api/user_api.js.map +1 -0
  36. package/dist/templates/backend/elysia/src/db.d.ts +3 -0
  37. package/dist/templates/backend/elysia/src/db.d.ts.map +1 -0
  38. package/dist/templates/backend/elysia/src/db.js +13 -0
  39. package/dist/templates/backend/elysia/src/db.js.map +1 -0
  40. package/dist/templates/backend/elysia/src/index.d.ts +4 -0
  41. package/dist/templates/backend/elysia/src/index.d.ts.map +1 -0
  42. package/dist/templates/backend/elysia/src/index.js +55 -0
  43. package/dist/templates/backend/elysia/src/index.js.map +1 -0
  44. package/dist/templates/backend/elysia/src/service/user_service.d.ts +1 -0
  45. package/dist/templates/backend/elysia/src/service/user_service.d.ts.map +1 -0
  46. package/dist/templates/backend/elysia/src/service/user_service.js +2 -0
  47. package/dist/templates/backend/elysia/src/service/user_service.js.map +1 -0
  48. package/dist/templates/backend/elysia/src/sql/user_sql.d.ts +1 -0
  49. package/dist/templates/backend/elysia/src/sql/user_sql.d.ts.map +1 -0
  50. package/dist/templates/backend/elysia/src/sql/user_sql.js +2 -0
  51. package/dist/templates/backend/elysia/src/sql/user_sql.js.map +1 -0
  52. package/dist/templates/backend/elysia/src/types/user_type.d.ts +1 -0
  53. package/dist/templates/backend/elysia/src/types/user_type.d.ts.map +1 -0
  54. package/dist/templates/backend/elysia/src/types/user_type.js +2 -0
  55. package/dist/templates/backend/elysia/src/types/user_type.js.map +1 -0
  56. package/dist/templates/frontend/nextjs/app/layout.d.ts +7 -0
  57. package/dist/templates/frontend/nextjs/app/layout.d.ts.map +1 -0
  58. package/dist/templates/frontend/nextjs/app/layout.js +22 -0
  59. package/dist/templates/frontend/nextjs/app/layout.js.map +1 -0
  60. package/dist/templates/frontend/nextjs/app/page.d.ts +2 -0
  61. package/dist/templates/frontend/nextjs/app/page.d.ts.map +1 -0
  62. package/dist/templates/frontend/nextjs/app/page.js +15 -0
  63. package/dist/templates/frontend/nextjs/app/page.js.map +1 -0
  64. package/dist/templates/frontend/nextjs/next.config.d.ts +4 -0
  65. package/dist/templates/frontend/nextjs/next.config.d.ts.map +1 -0
  66. package/dist/templates/frontend/nextjs/next.config.js +5 -0
  67. package/dist/templates/frontend/nextjs/next.config.js.map +1 -0
  68. package/dist/templates/frontend/svelte/src/lib/index.d.ts +1 -0
  69. package/dist/templates/frontend/svelte/src/lib/index.d.ts.map +1 -0
  70. package/dist/templates/frontend/svelte/src/lib/index.js +3 -0
  71. package/dist/templates/frontend/svelte/src/lib/index.js.map +1 -0
  72. package/dist/templates/frontend/svelte/vite.config.d.ts +3 -0
  73. package/dist/templates/frontend/svelte/vite.config.d.ts.map +1 -0
  74. package/dist/templates/frontend/svelte/vite.config.js +5 -0
  75. package/dist/templates/frontend/svelte/vite.config.js.map +1 -0
  76. package/dist/utils/helpers.d.ts +10 -10
  77. package/dist/utils/helpers.d.ts.map +1 -1
  78. package/dist/utils/helpers.js +77 -34
  79. package/dist/utils/helpers.js.map +1 -1
  80. package/package.json +7 -2
  81. package/src/templates/frontend/astro/.vscode/extensions.json +4 -0
  82. package/src/templates/frontend/astro/.vscode/launch.json +11 -0
  83. package/src/templates/frontend/svelte/.vscode/settings.json +5 -0
  84. package/.eslintignore +0 -3
  85. package/AGENTS.md +0 -172
  86. package/CHANGELOG.md +0 -184
  87. package/bun.lock +0 -125
  88. package/src/cli.ts +0 -500
  89. package/src/generators/backends/elysia.ts +0 -45
  90. package/src/generators/backends/fastapi.ts +0 -71
  91. package/src/generators/frontends/astro.ts +0 -37
  92. package/src/generators/frontends/nextjs.ts +0 -37
  93. package/src/generators/frontends/svelte.ts +0 -38
  94. package/src/generators/monorepo.ts +0 -529
  95. package/src/generators/single.ts +0 -465
  96. package/src/utils/helpers.ts +0 -198
  97. package/tsconfig.json +0 -24
@@ -1,27 +1,25 @@
1
- import { createDirectory, writeFile, getProjectPath, logStep, logSuccess, logInfo, installDependencies, initializeGit, } from '@/utils/helpers.js';
2
- import { generateElysiaBackend } from "@/generators/backends/elysia.js";
3
- import { generateFastAPIBackend } from "@/generators/backends/fastapi.js";
4
- import { generateAstroFrontend } from "@/generators/frontends/astro.js";
5
- import { generateSvelteFrontend } from "@/generators/frontends/svelte.js";
6
- import { generateNextJSFrontend } from "@/generators/frontends/nextjs.js";
1
+ import { createDirectory, writeFile, getProjectPath, logStep, logSuccess, logInfo, initializeGit, capitalize, getPackageManagerRunCmd, getPackageManagerInstallCmd, } from "../utils/helpers.js";
2
+ import { generateElysiaBackend } from "../generators/backends/elysia.js";
3
+ import { generateFastAPIBackend } from "../generators/backends/fastapi.js";
4
+ import { generateAstroFrontend } from "../generators/frontends/astro.js";
5
+ import { generateSvelteFrontend } from "../generators/frontends/svelte.js";
6
+ import { generateNextJSFrontend } from "../generators/frontends/nextjs.js";
7
7
  export async function generateMonorepo(config) {
8
8
  const projectPath = getProjectPath(config.projectName);
9
9
  logStep(`Creating monorepo at ${projectPath}`);
10
10
  await createDirectory(projectPath);
11
- const appsPath = `${projectPath}/apps`;
12
- const packagesPath = `${projectPath}/packages`;
13
- await createDirectory(appsPath);
14
- await createDirectory(packagesPath);
15
- await generateRootPackageJson(projectPath, config);
16
- await generateWorkspaceConfig(projectPath, config);
17
- await generateSharedTsConfig(projectPath);
18
- await generateSharedEslintConfig(projectPath, config);
19
- await generateSharedPrettierConfig(projectPath, config);
11
+ const backendPath = `${projectPath}/${capitalize(config.projectName)}_Backend`;
12
+ const frontendPath = `${projectPath}/${capitalize(config.projectName)}_Frontend`;
13
+ const docsPath = `${projectPath}/Docs`;
14
+ await createDirectory(backendPath);
15
+ await createDirectory(frontendPath);
16
+ await createDirectory(docsPath);
20
17
  await generateGitIgnore(projectPath);
21
18
  await generateReadme(projectPath, config);
22
- const backendPath = `${appsPath}/backend`;
23
- await createDirectory(backendPath);
24
- switch (config.backend.framework) {
19
+ await generateAgentsMd(projectPath, config);
20
+ await generateLicense(projectPath, config);
21
+ await generateEnvExample(projectPath);
22
+ switch (config.backend?.framework) {
25
23
  case "elysia":
26
24
  await generateElysiaBackend(backendPath, config);
27
25
  break;
@@ -29,9 +27,7 @@ export async function generateMonorepo(config) {
29
27
  await generateFastAPIBackend(backendPath, config);
30
28
  break;
31
29
  }
32
- const frontendPath = `${appsPath}/frontend`;
33
- await createDirectory(frontendPath);
34
- switch (config.frontend.framework) {
30
+ switch (config.frontend?.framework) {
35
31
  case "astro":
36
32
  await generateAstroFrontend(frontendPath, config);
37
33
  break;
@@ -42,130 +38,27 @@ export async function generateMonorepo(config) {
42
38
  await generateNextJSFrontend(frontendPath, config);
43
39
  break;
44
40
  }
45
- await createDirectory(`${packagesPath}/shared`);
46
- await generateSharedPackage(`${packagesPath}/shared`, config);
47
- logSuccess("Backend created at apps/backend");
48
- logSuccess("Frontend created at apps/frontend");
49
- logSuccess("Shared packages configured");
50
- logSuccess("Workspace configured");
41
+ await createDirectory(`${docsPath}/Feature`);
42
+ await createDirectory(`${docsPath}/DatabaseSetup`);
43
+ await generateSchemaDocs(docsPath, config);
44
+ const backendName = `${capitalize(config.projectName)}_Backend`;
45
+ const frontendName = `${capitalize(config.projectName)}_Frontend`;
46
+ logSuccess(`Backend created at ${backendName}`);
47
+ logSuccess(`Frontend created at ${frontendName}`);
48
+ logSuccess("Docs folder created");
51
49
  if (config.git) {
52
50
  await initializeGit(projectPath);
53
51
  }
54
- if (config.install) {
55
- await installDependencies(projectPath, config.frontend.packageManager);
56
- }
52
+ const backendInstallCmd = getPackageManagerInstallCmd(config.backend?.packageManager || "npm");
53
+ const backendRunCmd = getPackageManagerRunCmd(config.backend?.packageManager || "npm", "dev");
54
+ const frontendInstallCmd = getPackageManagerInstallCmd(config.frontend?.packageManager || "npm");
55
+ const frontendRunCmd = getPackageManagerRunCmd(config.frontend?.packageManager || "npm", "dev");
57
56
  logInfo("\n📦 Next steps:");
58
57
  logInfo(` cd ${config.projectName}`);
59
58
  logInfo(` # Backend`);
60
- logInfo(` cd apps/backend && ${config.backend.packageManager} install && ${config.backend.packageManager} run dev`);
59
+ logInfo(` cd ${backendName} && ${backendInstallCmd} && ${backendRunCmd}`);
61
60
  logInfo(` # Frontend`);
62
- logInfo(` cd apps/frontend && ${config.frontend.packageManager} install && ${config.frontend.packageManager} run dev`);
63
- }
64
- async function generateRootPackageJson(projectPath, config) {
65
- const packageManager = config.frontend.packageManager;
66
- const content = JSON.stringify({
67
- name: config.projectName,
68
- version: "0.1.0",
69
- private: true,
70
- type: "module",
71
- scripts: {
72
- dev: `${packageManager} run --filter "apps/*" dev`,
73
- build: `${packageManager} run --filter "apps/*" build`,
74
- lint: `${packageManager} run --filter "*" lint`,
75
- format: 'prettier --write "**/*.{js,jsx,ts,tsx,json,css,md}"',
76
- },
77
- workspaces: ["apps/*", "packages/*"],
78
- devDependencies: {
79
- ...(config.backend.eslint || config.frontend.eslint
80
- ? {
81
- eslint: "^8.57.0",
82
- "@typescript-eslint/parser": "^7.0.0",
83
- "@typescript-eslint/eslint-plugin": "^7.0.0",
84
- }
85
- : {}),
86
- ...(config.backend.prettier || config.frontend.prettier ? { prettier: "^3.2.0" } : {}),
87
- ...(config.backend.typescript || config.frontend.typescript
88
- ? { typescript: "^5.3.0" }
89
- : {}),
90
- },
91
- }, null, 2);
92
- await writeFile(`${projectPath}/package.json`, content);
93
- logSuccess("Root package.json created");
94
- }
95
- async function generateWorkspaceConfig(projectPath, config) {
96
- let content = "";
97
- switch (config.frontend.packageManager) {
98
- case "pnpm":
99
- content = `packages:\n - 'apps/*'\n - 'packages/*'\n`;
100
- await writeFile(`${projectPath}/pnpm-workspace.yaml`, content);
101
- break;
102
- case "yarn":
103
- content = JSON.stringify({ workspaces: ["apps/*", "packages/*"] }, null, 2);
104
- await writeFile(`${projectPath}/package.json`, content);
105
- break;
106
- case "npm":
107
- case "bun":
108
- await writeFile(`${projectPath}/.npmrc`, "workspaces=apps/* packages/*");
109
- break;
110
- }
111
- logSuccess("Workspace configuration created");
112
- }
113
- async function generateSharedTsConfig(projectPath) {
114
- const content = JSON.stringify({
115
- compilerOptions: {
116
- target: "ES2022",
117
- module: "ES2022",
118
- lib: ["ES2022"],
119
- moduleResolution: "bundler",
120
- strict: true,
121
- esModuleInterop: true,
122
- skipLibCheck: true,
123
- forceConsistentCasingInFileNames: true,
124
- resolveJsonModule: true,
125
- declaration: true,
126
- declarationMap: true,
127
- sourceMap: true,
128
- composite: true,
129
- },
130
- references: [
131
- { path: "./apps/backend" },
132
- { path: "./apps/frontend" },
133
- { path: "./packages/shared" },
134
- ],
135
- }, null, 2);
136
- await writeFile(`${projectPath}/tsconfig.json`, content);
137
- logSuccess("Shared TypeScript configuration created");
138
- }
139
- async function generateSharedEslintConfig(projectPath, config) {
140
- if (!config.backend.eslint && !config.frontend.eslint)
141
- return;
142
- const content = `module.exports = {
143
- root: true,
144
- extends: ['eslint:recommended'],
145
- env: {
146
- node: true,
147
- es2022: true,
148
- },
149
- parserOptions: {
150
- ecmaVersion: 'latest',
151
- sourceType: 'module',
152
- },
153
- };`;
154
- await writeFile(`${projectPath}/.eslintrc.js`, content);
155
- logSuccess("Shared ESLint configuration created");
156
- }
157
- async function generateSharedPrettierConfig(projectPath, config) {
158
- if (!config.backend.prettier && !config.frontend.prettier)
159
- return;
160
- const content = JSON.stringify({
161
- semi: false,
162
- singleQuote: true,
163
- tabWidth: 2,
164
- trailingComma: "es5",
165
- printWidth: 80,
166
- }, null, 2);
167
- await writeFile(`${projectPath}/.prettierrc`, content);
168
- logSuccess("Shared Prettier configuration created");
61
+ logInfo(` cd ${frontendName} && ${frontendInstallCmd} && ${frontendRunCmd}`);
169
62
  }
170
63
  async function generateGitIgnore(projectPath) {
171
64
  const content = `# Dependencies
@@ -218,6 +111,8 @@ yarn-error.log*
218
111
  logSuccess(".gitignore created");
219
112
  }
220
113
  async function generateReadme(projectPath, config) {
114
+ const backendName = `${capitalize(config.projectName)}_Backend`;
115
+ const frontendName = `${capitalize(config.projectName)}_Frontend`;
221
116
  const content = `# ${config.projectName}
222
117
 
223
118
  This project was generated by [Phos](https://github.com/yourusername/phos).
@@ -226,12 +121,12 @@ This project was generated by [Phos](https://github.com/yourusername/phos).
226
121
 
227
122
  \`\`\`
228
123
  .
229
- ├── apps/
230
- ├── backend/ # ${config.backend.framework} backend
231
- │ └── frontend/ # ${config.frontend.framework} frontend
232
- ├── packages/
233
- │ └── shared/ # Shared utilities and types
234
- └── package.json # Root package.json with workspace config
124
+ ├── ${backendName}/ # ${config.backend?.framework} backend
125
+ ├── ${frontendName}/ # ${config.frontend?.framework} frontend
126
+ ├── Docs/ # Documentation
127
+ ├── AGENTS.md # Agent guidelines
128
+ ├── LICENSE # License file
129
+ └── env.example # Environment variables template
235
130
  \`\`\`
236
131
 
237
132
  ## Getting Started
@@ -239,82 +134,354 @@ This project was generated by [Phos](https://github.com/yourusername/phos).
239
134
  ### Backend
240
135
 
241
136
  \`\`\`bash
242
- cd apps/backend
243
- ${config.backend.packageManager} install
244
- ${config.backend.packageManager} run dev
137
+ cd ${backendName}
138
+ ${config.backend?.packageManager} install
139
+ ${config.backend?.packageManager} run dev
245
140
  \`\`\`
246
141
 
247
142
  ### Frontend
248
143
 
249
144
  \`\`\`bash
250
- cd apps/frontend
251
- ${config.frontend.packageManager} install
252
- ${config.frontend.packageManager} run dev
145
+ cd ${frontendName}
146
+ ${config.frontend?.packageManager} install
147
+ ${config.frontend?.packageManager} run dev
253
148
  \`\`\`
254
149
 
255
150
  ## Available Scripts
256
151
 
257
- - \`${config.frontend.packageManager} run dev\` - Start development servers
258
- - \`${config.frontend.packageManager} run build\` - Build for production
259
- - \`${config.frontend.packageManager} run lint\` - Run ESLint
260
- - \`${config.frontend.packageManager} run format\` - Format code with Prettier
152
+ - \`${config.frontend?.packageManager} run dev\` - Start development servers
153
+ - \`${config.frontend?.packageManager} run build\` - Build for production
154
+ - \`${config.frontend?.packageManager} run lint\` - Run ESLint
155
+ - \`${config.frontend?.packageManager} run format\` - Format code with Prettier
261
156
 
262
157
  ## Tech Stack
263
158
 
264
159
  ### Backend
265
- - Framework: ${config.backend.framework}
266
- - Package Manager: ${config.backend.packageManager}
267
- - TypeScript: ${config.backend.typescript ? "Yes" : "No"}
268
- - ESLint: ${config.backend.eslint ? "Yes" : "No"}
269
- - Prettier: ${config.backend.prettier ? "Yes" : "No"}
160
+ - Framework: ${config.backend?.framework}
161
+ - Package Manager: ${config.backend?.packageManager}
162
+ - TypeScript: ${config.backend?.typescript ? "Yes" : "No"}
163
+ - ESLint: ${config.backend?.eslint ? "Yes" : "No"}
164
+ - Prettier: ${config.backend?.prettier ? "Yes" : "No"}
270
165
 
271
166
  ### Frontend
272
- - Framework: ${config.frontend.framework}
273
- - Package Manager: ${config.frontend.packageManager}
274
- - TypeScript: ${config.frontend.typescript ? "Yes" : "No"}
275
- - ESLint: ${config.frontend.eslint ? "Yes" : "No"}
276
- - Prettier: ${config.frontend.prettier ? "Yes" : "No"}
277
- - CSS Framework: ${config.frontend.cssFramework}
278
- - UI Components: ${config.frontend.uiComponents}
279
- - Testing: ${config.frontend.testing}
167
+ - Framework: ${config.frontend?.framework}
168
+ - Package Manager: ${config.frontend?.packageManager}
169
+ - TypeScript: ${config.frontend?.typescript ? "Yes" : "No"}
170
+ - ESLint: ${config.frontend?.eslint ? "Yes" : "No"}
171
+ - Prettier: ${config.frontend?.prettier ? "Yes" : "No"}
172
+ - CSS Framework: ${config.frontend?.cssFramework}
173
+ - UI Components: ${config.frontend?.uiComponents}
174
+ - Testing: ${config.frontend?.testing}
280
175
  `;
281
176
  await writeFile(`${projectPath}/README.md`, content);
282
177
  logSuccess("README.md created");
283
178
  }
284
- async function generateSharedPackage(packagePath, config) {
285
- const content = JSON.stringify({
286
- name: "@phos/shared",
287
- version: "0.1.0",
288
- type: "module",
289
- main: "./dist/index.js",
290
- types: "./dist/index.d.ts",
291
- exports: {
292
- ".": {
293
- types: "./dist/index.d.ts",
294
- import: "./dist/index.js",
295
- },
296
- },
297
- scripts: {
298
- build: "tsc",
299
- dev: "tsc --watch",
300
- },
301
- devDependencies: {
302
- typescript: "^5.3.0",
303
- },
304
- }, null, 2);
305
- await writeFile(`${packagePath}/package.json`, content);
306
- const tsConfigContent = JSON.stringify({
307
- extends: "../../tsconfig.json",
308
- compilerOptions: {
309
- composite: true,
310
- outDir: "./dist",
311
- rootDir: "./src",
312
- },
313
- include: ["src/**/*"],
314
- }, null, 2);
315
- await writeFile(`${packagePath}/tsconfig.json`, tsConfigContent);
316
- await createDirectory(`${packagePath}/src`);
317
- await writeFile(`${packagePath}/src/index.ts`, `export function hello(name: string): string {\n return \`Hello, \${name}!\`;\n}\n`);
318
- logSuccess("Shared package created");
179
+ async function generateAgentsMd(projectPath, config) {
180
+ const projectName = config.projectName;
181
+ const capitalizedProjectName = capitalize(config.projectName);
182
+ const backendName = `${capitalizedProjectName}_Backend`;
183
+ const frontendName = `${capitalizedProjectName}_Frontend`;
184
+ const content = `# AGENTS Guidelines for This Repository
185
+
186
+ ## Project Name: ${projectName}
187
+
188
+ This project was generated by [Phos](https://github.com/yourusername/phos).
189
+
190
+ ### Core Features:
191
+
192
+ 1. **${config.frontend?.framework || "Next.js"} Frontend** - Modern web framework
193
+ 2. **${config.backend?.framework || "Elysia"} Backend** - Server-side application
194
+ 3. **Monorepo Structure** - Organized workspace with separate backend and frontend
195
+
196
+ ### Technology Stack:
197
+
198
+ - **Frontend**: ${config.frontend?.framework || "Next.js"}
199
+ - **Backend**: ${config.backend?.framework || "Elysia"}
200
+ - **Package Manager**: ${config.frontend?.packageManager || "npm"}
201
+ - **TypeScript**: ${config.frontend?.typescript ? "Enabled" : "Disabled"}
202
+ - **ESLint**: ${config.frontend?.eslint ? "Enabled" : "Disabled"}
203
+ - **Prettier**: ${config.frontend?.prettier ? "Enabled" : "Disabled"}
204
+ - **CSS Framework**: ${config.frontend?.cssFramework || "Tailwind CSS"}
205
+
206
+ ## 1. Development Workflow
207
+
208
+ ### Project Structure
209
+
210
+ \`\`\`
211
+ ${projectName}/
212
+ ├── ${backendName}/ # Backend application
213
+ ├── ${frontendName}/ # Frontend application
214
+ ├── Docs/ # Documentation
215
+ ├── AGENTS.md # This file
216
+ ├── LICENSE # License
217
+ ├── README.md # Project README
218
+ └── env.example # Environment variables template
219
+ \`\`\`
220
+
221
+ ### Running the Project
222
+
223
+ #### Backend
224
+ \`\`\`bash
225
+ cd ${backendName}
226
+ ${config.backend?.packageManager || "npm"} install
227
+ ${config.backend?.packageManager || "npm"} run dev
228
+ \`\`\`
229
+
230
+ #### Frontend
231
+ \`\`\`bash
232
+ cd ${frontendName}
233
+ ${config.frontend?.packageManager || "npm"} install
234
+ ${config.frontend?.packageManager || "npm"} run dev
235
+ \`\`\`
236
+
237
+ ## 2. Architecture
238
+
239
+ ### Backend
240
+ - Framework: ${config.backend?.framework || "Elysia"}
241
+ - Language: ${config.backend?.framework === "fastapi" ? "Python" : "TypeScript"}
242
+ - Package Manager: ${config.backend?.packageManager || "npm"}
243
+
244
+ ### Frontend
245
+ - Framework: ${config.frontend?.framework || "Next.js"}
246
+ - Language: JavaScript/TypeScript
247
+ - Package Manager: ${config.frontend?.packageManager || "npm"}
248
+ - CSS Framework: ${config.frontend?.cssFramework || "Tailwind CSS"}
249
+ - UI Components: ${config.frontend?.uiComponents || "None"}
250
+
251
+ ## 3. Coding Conventions
252
+
253
+ ### ${config.frontend?.framework || "Next.js"}
254
+
255
+ ${config.frontend?.framework === "astro"
256
+ ? `
257
+ - Use Astro component syntax
258
+ - Follow Astro best practices
259
+ - Use TypeScript if enabled
260
+ `
261
+ : config.frontend?.framework === "svelte"
262
+ ? `
263
+ - Use Svelte component syntax
264
+ - Follow Svelte best practices
265
+ - Use TypeScript if enabled
266
+ `
267
+ : `
268
+ - Use Next.js conventions
269
+ - Use App Router for new features
270
+ - Use TypeScript if enabled
271
+ `}
272
+
273
+ ### ${config.backend?.framework || "Elysia"}
274
+
275
+ ${config.backend?.framework === "elysia"
276
+ ? `
277
+ - Use Elysia patterns
278
+ - Follow Bun conventions
279
+ - Use TypeScript if enabled
280
+ `
281
+ : `
282
+ - Use FastAPI patterns
283
+ - Follow Python PEP 8 guidelines
284
+ - Use type hints
285
+ `}
286
+
287
+ ## 4. Available Scripts
288
+
289
+ ### Root Level
290
+ - \`${config.frontend?.packageManager || "npm"} run dev\` - Start both dev servers
291
+ - \`${config.frontend?.packageManager || "npm"} run build\` - Build both apps
292
+ - \`${config.frontend?.packageManager || "npm"} run lint\` - Run ESLint
293
+ - \`${config.frontend?.packageManager || "npm"} run format\` - Format code
294
+
295
+ ## 5. Documentation
296
+
297
+ Check the \`Docs/\` folder for:
298
+ - Feature documentation
299
+ - Database setup scripts
300
+ - Schema documentation
301
+ - SQL queries
302
+ `;
303
+ await writeFile(`${projectPath}/AGENTS.md`, content);
304
+ logSuccess("AGENTS.md created");
305
+ }
306
+ async function generateLicense(projectPath, config) {
307
+ const content = `MIT License
308
+
309
+ Copyright (c) ${new Date().getFullYear()} ${config.projectName}
310
+
311
+ Permission is hereby granted, free of charge, to any person obtaining a copy
312
+ of this software and associated documentation files (the "Software"), to deal
313
+ in the Software without restriction, including without limitation the rights
314
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
315
+ copies of the Software, and to permit persons to whom the Software is
316
+ furnished to do so, subject to the following conditions:
317
+
318
+ The above copyright notice and this permission notice shall be included in all
319
+ copies or substantial portions of the Software.
320
+
321
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
322
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
323
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
324
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
325
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
326
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
327
+ SOFTWARE.
328
+ `;
329
+ await writeFile(`${projectPath}/LICENSE`, content);
330
+ logSuccess("LICENSE created");
331
+ }
332
+ async function generateEnvExample(projectPath) {
333
+ const content = `# Database
334
+ DB_HOST=localhost
335
+ DB_NAME=your_db_name
336
+ DB_USER=postgres
337
+ DB_PASSWORD=postgres
338
+ DB_PORT=5433
339
+
340
+ # URLs
341
+ FRONTEND_BASE_URL=http://localhost:4200
342
+ BACKEND_BASE_URL=http://localhost:4100
343
+
344
+ # JWT Configuration for rest API
345
+ JWT_SECRET=your-super-secret-jwt-key-change-in-production
346
+ JWT_EXPIRES_IN=60m
347
+
348
+ # Encryption
349
+ ENCRYPTION_SALT=your-super-secret-salt-change-in-production
350
+
351
+ # API Keys
352
+ X_API_KEY=1234
353
+ `;
354
+ await writeFile(`${projectPath}/env.example`, content);
355
+ logSuccess("env.example created");
356
+ }
357
+ async function generateSchemaDocs(docsPath, config) {
358
+ const projectName = config.projectName;
359
+ const content = `# ${projectName} Database Schema
360
+
361
+ ## Table of Contents
362
+
363
+ - [${projectName} Database Schema](#${projectName.toLowerCase()}-database-schema)
364
+ - [Table of Contents](#table-of-contents)
365
+ - [Overview](#overview)
366
+ - [Core Entities](#core-entities)
367
+ - [Entity Name](#entity-name)
368
+ - [Entity Relationships](#entity-relationships)
369
+ - [SQL Schema](#sql-schema)
370
+ - [Create Tables](#create-tables)
371
+ - [Sample Data](#sample-data)
372
+ - [Data Types Notes](#data-types-notes)
373
+ - [Migration Notes](#migration-notes)
374
+
375
+ ---
376
+
377
+ ## Overview
378
+
379
+ This document describes the complete database schema for ${projectName}, including all entities, relationships, and sample data.
380
+
381
+ ---
382
+
383
+ ## Core Entities
384
+
385
+ ### Entity Name
386
+
387
+ | Column | Type | Nullable | Description |
388
+ | ----------- | -------- | -------- | ---------------------------------- |
389
+ | id | int | No | Primary key, auto-incremented ID |
390
+ | uuid | string | No | Unique identifier |
391
+ | column_name | str | Yes/No | Description of column |
392
+ | created_at | datetime | No | Record creation timestamp (UTC) |
393
+ | updated_at | datetime | Yes | Record last update timestamp (UTC) |
394
+
395
+ ---
396
+
397
+ ## Entity Relationships
398
+
399
+ \`\`\`
400
+ table1 (1) ──── (many) table2
401
+ table3 (many) ──── (1) table4
402
+ \`\`\`
403
+
404
+ ---
405
+
406
+ ## SQL Schema
407
+
408
+ ### Create Tables
409
+
410
+ For PostgreSQL deployment, use the following schema:
411
+
412
+ \`\`\`sql
413
+ -- Drop tables if they exist (for clean setup)
414
+ DROP TABLE IF EXISTS child_table;
415
+ DROP TABLE IF EXISTS parent_table;
416
+
417
+ -- Parent table
418
+ CREATE TABLE parent_table (
419
+ id SERIAL PRIMARY KEY,
420
+ uuid TEXT NOT NULL UNIQUE,
421
+ name TEXT NOT NULL,
422
+ description TEXT,
423
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
424
+ updated_at TIMESTAMP
425
+ );
426
+
427
+ -- Child table
428
+ CREATE TABLE child_table (
429
+ id TEXT PRIMARY KEY,
430
+ parent_id TEXT NOT NULL,
431
+ content TEXT NOT NULL,
432
+ created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
433
+ updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
434
+ FOREIGN KEY (parent_id) REFERENCES parent_table(uuid)
435
+ );
436
+
437
+ -- Add foreign key constraints if needed
438
+ ALTER TABLE child_table ADD CONSTRAINT fk_child_parent FOREIGN KEY (parent_id) REFERENCES parent_table(uuid);
439
+
440
+ -- Performance indexes
441
+ CREATE INDEX idx_parent_table_uuid ON parent_table(uuid);
442
+ CREATE INDEX idx_child_table_parent_id ON child_table(parent_id);
443
+ CREATE INDEX idx_child_table_created_at ON child_table(created_at);
444
+ \`\`\`
445
+
446
+ ---
447
+
448
+ ## Sample Data
449
+
450
+ \`\`\`sql
451
+ -- Insert sample data for parent table
452
+ INSERT INTO parent_table (uuid, name, description, created_at)
453
+ VALUES ('550e8400-e29b-41d4-a716-446655440000', 'Sample Name', 'Sample description', CURRENT_TIMESTAMP);
454
+
455
+ -- Insert sample data for child table
456
+ INSERT INTO child_table (id, parent_id, content, created_at, updated_at)
457
+ VALUES ('6ba7b810-9dad-11d1-80b4-00c04fd430c8', '550e8400-e29b-41d4-a716-446655440000', 'Sample content', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP);
458
+ \`\`\`
459
+
460
+ ---
461
+
462
+ ## Data Types Notes
463
+
464
+ - **UUID**: Stored as TEXT for simplicity
465
+ - **Arrays**: Stored as native PostgreSQL arrays (e.g., text[])
466
+ - **JSON**: Stored as JSONB for PostgreSQL (or TEXT for SQLite)
467
+ - **Boolean**: Stored as BOOLEAN for PostgreSQL (or INTEGER 0/1 for SQLite)
468
+ - **Decimal**: Stored as DECIMAL for precision calculations
469
+ - **Datetime**: Stored as TIMESTAMP with CURRENT_TIMESTAMP defaults
470
+
471
+ ---
472
+
473
+ ## Migration Notes
474
+
475
+ When deploying to production:
476
+
477
+ 1. Consider using PostgreSQL for better JSON support and performance
478
+ 2. Add proper UUID generation in application code
479
+ 3. Implement database migrations for schema changes
480
+ 4. Add database constraints and triggers as needed
481
+ 5. Run \`ALTER TABLE\` statements for schema additions
482
+ 6. Test migrations on staging environment before production
483
+ `;
484
+ await writeFile(`${docsPath}/Schema.md`, content);
485
+ logSuccess("Schema.md created");
319
486
  }
320
487
  //# sourceMappingURL=monorepo.js.map