@stackweld/templates 0.2.0

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 (117) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/.turbo/turbo-lint.log +694 -0
  3. package/.turbo/turbo-test.log +15 -0
  4. package/.turbo/turbo-typecheck.log +4 -0
  5. package/dist/__tests__/templates.test.d.ts +2 -0
  6. package/dist/__tests__/templates.test.d.ts.map +1 -0
  7. package/dist/__tests__/templates.test.js +81 -0
  8. package/dist/__tests__/templates.test.js.map +1 -0
  9. package/dist/index.d.ts +36 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +68 -0
  12. package/dist/index.js.map +1 -0
  13. package/dist/templates/astro-landing.d.ts +3 -0
  14. package/dist/templates/astro-landing.d.ts.map +1 -0
  15. package/dist/templates/astro-landing.js +36 -0
  16. package/dist/templates/astro-landing.js.map +1 -0
  17. package/dist/templates/django-react.d.ts +3 -0
  18. package/dist/templates/django-react.d.ts.map +1 -0
  19. package/dist/templates/django-react.js +123 -0
  20. package/dist/templates/django-react.js.map +1 -0
  21. package/dist/templates/django-rest-api.d.ts +3 -0
  22. package/dist/templates/django-rest-api.d.ts.map +1 -0
  23. package/dist/templates/django-rest-api.js +95 -0
  24. package/dist/templates/django-rest-api.js.map +1 -0
  25. package/dist/templates/express-api.d.ts +3 -0
  26. package/dist/templates/express-api.d.ts.map +1 -0
  27. package/dist/templates/express-api.js +142 -0
  28. package/dist/templates/express-api.js.map +1 -0
  29. package/dist/templates/fastapi-react.d.ts +3 -0
  30. package/dist/templates/fastapi-react.d.ts.map +1 -0
  31. package/dist/templates/fastapi-react.js +120 -0
  32. package/dist/templates/fastapi-react.js.map +1 -0
  33. package/dist/templates/go-microservice.d.ts +3 -0
  34. package/dist/templates/go-microservice.d.ts.map +1 -0
  35. package/dist/templates/go-microservice.js +131 -0
  36. package/dist/templates/go-microservice.js.map +1 -0
  37. package/dist/templates/hono-microservice.d.ts +3 -0
  38. package/dist/templates/hono-microservice.d.ts.map +1 -0
  39. package/dist/templates/hono-microservice.js +80 -0
  40. package/dist/templates/hono-microservice.js.map +1 -0
  41. package/dist/templates/htmx-django.d.ts +3 -0
  42. package/dist/templates/htmx-django.d.ts.map +1 -0
  43. package/dist/templates/htmx-django.js +96 -0
  44. package/dist/templates/htmx-django.js.map +1 -0
  45. package/dist/templates/laravel-app.d.ts +3 -0
  46. package/dist/templates/laravel-app.d.ts.map +1 -0
  47. package/dist/templates/laravel-app.js +95 -0
  48. package/dist/templates/laravel-app.js.map +1 -0
  49. package/dist/templates/mern-stack.d.ts +3 -0
  50. package/dist/templates/mern-stack.d.ts.map +1 -0
  51. package/dist/templates/mern-stack.js +122 -0
  52. package/dist/templates/mern-stack.js.map +1 -0
  53. package/dist/templates/monorepo-starter.d.ts +3 -0
  54. package/dist/templates/monorepo-starter.d.ts.map +1 -0
  55. package/dist/templates/monorepo-starter.js +136 -0
  56. package/dist/templates/monorepo-starter.js.map +1 -0
  57. package/dist/templates/nestjs-api.d.ts +3 -0
  58. package/dist/templates/nestjs-api.d.ts.map +1 -0
  59. package/dist/templates/nestjs-api.js +111 -0
  60. package/dist/templates/nestjs-api.js.map +1 -0
  61. package/dist/templates/nuxt3-app.d.ts +3 -0
  62. package/dist/templates/nuxt3-app.d.ts.map +1 -0
  63. package/dist/templates/nuxt3-app.js +77 -0
  64. package/dist/templates/nuxt3-app.js.map +1 -0
  65. package/dist/templates/python-ai-lab.d.ts +3 -0
  66. package/dist/templates/python-ai-lab.d.ts.map +1 -0
  67. package/dist/templates/python-ai-lab.js +152 -0
  68. package/dist/templates/python-ai-lab.js.map +1 -0
  69. package/dist/templates/remix-fullstack.d.ts +3 -0
  70. package/dist/templates/remix-fullstack.d.ts.map +1 -0
  71. package/dist/templates/remix-fullstack.js +79 -0
  72. package/dist/templates/remix-fullstack.js.map +1 -0
  73. package/dist/templates/saas-starter.d.ts +3 -0
  74. package/dist/templates/saas-starter.d.ts.map +1 -0
  75. package/dist/templates/saas-starter.js +128 -0
  76. package/dist/templates/saas-starter.js.map +1 -0
  77. package/dist/templates/solidstart-app.d.ts +3 -0
  78. package/dist/templates/solidstart-app.d.ts.map +1 -0
  79. package/dist/templates/solidstart-app.js +72 -0
  80. package/dist/templates/solidstart-app.js.map +1 -0
  81. package/dist/templates/sveltekit-fullstack.d.ts +3 -0
  82. package/dist/templates/sveltekit-fullstack.d.ts.map +1 -0
  83. package/dist/templates/sveltekit-fullstack.js +89 -0
  84. package/dist/templates/sveltekit-fullstack.js.map +1 -0
  85. package/dist/templates/t3-stack.d.ts +3 -0
  86. package/dist/templates/t3-stack.d.ts.map +1 -0
  87. package/dist/templates/t3-stack.js +92 -0
  88. package/dist/templates/t3-stack.js.map +1 -0
  89. package/dist/templates/tauri-desktop.d.ts +3 -0
  90. package/dist/templates/tauri-desktop.d.ts.map +1 -0
  91. package/dist/templates/tauri-desktop.js +55 -0
  92. package/dist/templates/tauri-desktop.js.map +1 -0
  93. package/package.json +33 -0
  94. package/src/__tests__/templates.test.ts +98 -0
  95. package/src/index.ts +97 -0
  96. package/src/templates/astro-landing.ts +40 -0
  97. package/src/templates/django-react.ts +127 -0
  98. package/src/templates/django-rest-api.ts +99 -0
  99. package/src/templates/express-api.ts +147 -0
  100. package/src/templates/fastapi-react.ts +122 -0
  101. package/src/templates/go-microservice.ts +133 -0
  102. package/src/templates/hono-microservice.ts +81 -0
  103. package/src/templates/htmx-django.ts +100 -0
  104. package/src/templates/laravel-app.ts +96 -0
  105. package/src/templates/mern-stack.ts +126 -0
  106. package/src/templates/monorepo-starter.ts +138 -0
  107. package/src/templates/nestjs-api.ts +112 -0
  108. package/src/templates/nuxt3-app.ts +78 -0
  109. package/src/templates/python-ai-lab.ts +155 -0
  110. package/src/templates/remix-fullstack.ts +80 -0
  111. package/src/templates/saas-starter.ts +131 -0
  112. package/src/templates/solidstart-app.ts +73 -0
  113. package/src/templates/sveltekit-fullstack.ts +90 -0
  114. package/src/templates/t3-stack.ts +94 -0
  115. package/src/templates/tauri-desktop.ts +57 -0
  116. package/tsconfig.json +10 -0
  117. package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,92 @@
1
+ export const t3Stack = {
2
+ id: "t3-stack",
3
+ name: "T3 Stack",
4
+ description: "Full-stack TypeScript app with Next.js, tRPC, Prisma, Tailwind CSS, and NextAuth",
5
+ technologyIds: [
6
+ "nextjs",
7
+ "react",
8
+ "nodejs",
9
+ "typescript",
10
+ "tailwindcss",
11
+ "prisma",
12
+ "postgresql",
13
+ "nextauth",
14
+ ],
15
+ profile: "standard",
16
+ scaffoldSteps: [
17
+ {
18
+ name: "Create Next.js app",
19
+ command: "npx create-next-app@latest {{projectName}} --typescript --tailwind --eslint --app --src-dir --import-alias '@/*'",
20
+ },
21
+ {
22
+ name: "Install Prisma",
23
+ command: "npm install prisma @prisma/client",
24
+ workingDir: "{{projectName}}",
25
+ },
26
+ {
27
+ name: "Initialize Prisma",
28
+ command: "npx prisma init --datasource-provider postgresql",
29
+ workingDir: "{{projectName}}",
30
+ },
31
+ {
32
+ name: "Install NextAuth",
33
+ command: "npm install next-auth@beta",
34
+ workingDir: "{{projectName}}",
35
+ },
36
+ ],
37
+ overrides: [
38
+ {
39
+ path: ".env.example",
40
+ content: [
41
+ "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/{{projectName}}",
42
+ "NEXTAUTH_SECRET=your-secret-key-change-me",
43
+ "NEXTAUTH_URL=http://localhost:3000",
44
+ ].join("\n"),
45
+ },
46
+ {
47
+ path: "docker-compose.yml",
48
+ content: [
49
+ "services:",
50
+ " db:",
51
+ " image: postgres:17",
52
+ " restart: unless-stopped",
53
+ " ports:",
54
+ ' - "5432:5432"',
55
+ " environment:",
56
+ " POSTGRES_USER: postgres",
57
+ " POSTGRES_PASSWORD: postgres",
58
+ " POSTGRES_DB: {{projectName}}",
59
+ " volumes:",
60
+ " - pgdata:/var/lib/postgresql/data",
61
+ " healthcheck:",
62
+ ' test: ["CMD-SHELL", "pg_isready -U postgres"]',
63
+ " interval: 5s",
64
+ " timeout: 5s",
65
+ " retries: 5",
66
+ "",
67
+ "volumes:",
68
+ " pgdata:",
69
+ ].join("\n"),
70
+ },
71
+ ],
72
+ hooks: [
73
+ {
74
+ timing: "post-scaffold",
75
+ name: "Install dependencies",
76
+ command: "cd {{projectName}} && npm install",
77
+ description: "Install all npm dependencies",
78
+ requiresConfirmation: false,
79
+ },
80
+ {
81
+ timing: "post-scaffold",
82
+ name: "Generate Prisma client",
83
+ command: "cd {{projectName}} && npx prisma generate",
84
+ description: "Generate the Prisma client from schema",
85
+ requiresConfirmation: false,
86
+ },
87
+ ],
88
+ variables: {
89
+ projectName: "my-t3-app",
90
+ },
91
+ };
92
+ //# sourceMappingURL=t3-stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"t3-stack.js","sourceRoot":"","sources":["../../src/templates/t3-stack.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,OAAO,GAAa;IAC/B,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE,kFAAkF;IAC/F,aAAa,EAAE;QACb,QAAQ;QACR,OAAO;QACP,QAAQ;QACR,YAAY;QACZ,aAAa;QACb,QAAQ;QACR,YAAY;QACZ,UAAU;KACX;IACD,OAAO,EAAE,UAAU;IACnB,aAAa,EAAE;QACb;YACE,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EACL,kHAAkH;SACrH;QACD;YACE,IAAI,EAAE,gBAAgB;YACtB,OAAO,EAAE,mCAAmC;YAC5C,UAAU,EAAE,iBAAiB;SAC9B;QACD;YACE,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,kDAAkD;YAC3D,UAAU,EAAE,iBAAiB;SAC9B;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,4BAA4B;YACrC,UAAU,EAAE,iBAAiB;SAC9B;KACF;IACD,SAAS,EAAE;QACT;YACE,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE;gBACP,4EAA4E;gBAC5E,2CAA2C;gBAC3C,oCAAoC;aACrC,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;QACD;YACE,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE;gBACP,WAAW;gBACX,OAAO;gBACP,wBAAwB;gBACxB,6BAA6B;gBAC7B,YAAY;gBACZ,qBAAqB;gBACrB,kBAAkB;gBAClB,+BAA+B;gBAC/B,mCAAmC;gBACnC,oCAAoC;gBACpC,cAAc;gBACd,yCAAyC;gBACzC,kBAAkB;gBAClB,qDAAqD;gBACrD,oBAAoB;gBACpB,mBAAmB;gBACnB,kBAAkB;gBAClB,EAAE;gBACF,UAAU;gBACV,WAAW;aACZ,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF;IACD,KAAK,EAAE;QACL;YACE,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,sBAAsB;YAC5B,OAAO,EAAE,mCAAmC;YAC5C,WAAW,EAAE,8BAA8B;YAC3C,oBAAoB,EAAE,KAAK;SAC5B;QACD;YACE,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,wBAAwB;YAC9B,OAAO,EAAE,2CAA2C;YACpD,WAAW,EAAE,wCAAwC;YACrD,oBAAoB,EAAE,KAAK;SAC5B;KACF;IACD,SAAS,EAAE;QACT,WAAW,EAAE,WAAW;KACzB;CACF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Template } from "@stackweld/core";
2
+ export declare const tauriDesktop: Template;
3
+ //# sourceMappingURL=tauri-desktop.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tauri-desktop.d.ts","sourceRoot":"","sources":["../../src/templates/tauri-desktop.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,eAAO,MAAM,YAAY,EAAE,QAsD1B,CAAC"}
@@ -0,0 +1,55 @@
1
+ export const tauriDesktop = {
2
+ id: "tauri-desktop",
3
+ name: "Tauri Desktop",
4
+ description: "Cross-platform desktop app with Tauri, React, TypeScript, Tailwind CSS, and SQLite",
5
+ technologyIds: ["react", "nodejs", "typescript", "tailwindcss", "sqlite"],
6
+ profile: "standard",
7
+ scaffoldSteps: [
8
+ {
9
+ name: "Create Vite + React project",
10
+ command: "npx create-vite@latest {{projectName}} -- --template react-ts",
11
+ },
12
+ {
13
+ name: "Install Tailwind",
14
+ command: "cd {{projectName}} && npm install -D tailwindcss @tailwindcss/vite",
15
+ },
16
+ {
17
+ name: "Install Tauri CLI",
18
+ command: "cd {{projectName}} && npm install -D @tauri-apps/cli",
19
+ },
20
+ {
21
+ name: "Install Tauri API",
22
+ command: "cd {{projectName}} && npm install @tauri-apps/api",
23
+ },
24
+ {
25
+ name: "Initialize Tauri",
26
+ command: "cd {{projectName}} && npx tauri init --app-name {{projectName}} --window-title {{projectName}} --dist-dir ../dist --dev-path http://localhost:5173 --ci",
27
+ },
28
+ ],
29
+ overrides: [
30
+ {
31
+ path: ".env.example",
32
+ content: ["VITE_APP_NAME={{projectName}}", "VITE_APP_VERSION=0.1.0"].join("\n"),
33
+ },
34
+ ],
35
+ hooks: [
36
+ {
37
+ timing: "post-scaffold",
38
+ name: "Install dependencies",
39
+ command: "cd {{projectName}} && npm install",
40
+ description: "Install all npm dependencies",
41
+ requiresConfirmation: false,
42
+ },
43
+ {
44
+ timing: "post-scaffold",
45
+ name: "Verify Rust toolchain",
46
+ command: "rustup show",
47
+ description: "Verify Rust is installed (required by Tauri)",
48
+ requiresConfirmation: true,
49
+ },
50
+ ],
51
+ variables: {
52
+ projectName: "my-tauri-app",
53
+ },
54
+ };
55
+ //# sourceMappingURL=tauri-desktop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tauri-desktop.js","sourceRoot":"","sources":["../../src/templates/tauri-desktop.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAa;IACpC,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,oFAAoF;IACjG,aAAa,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,QAAQ,CAAC;IACzE,OAAO,EAAE,UAAU;IACnB,aAAa,EAAE;QACb;YACE,IAAI,EAAE,6BAA6B;YACnC,OAAO,EAAE,+DAA+D;SACzE;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,oEAAoE;SAC9E;QACD;YACE,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,sDAAsD;SAChE;QACD;YACE,IAAI,EAAE,mBAAmB;YACzB,OAAO,EAAE,mDAAmD;SAC7D;QACD;YACE,IAAI,EAAE,kBAAkB;YACxB,OAAO,EACL,yJAAyJ;SAC5J;KACF;IACD,SAAS,EAAE;QACT;YACE,IAAI,EAAE,cAAc;YACpB,OAAO,EAAE,CAAC,+BAA+B,EAAE,wBAAwB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;SAChF;KACF;IACD,KAAK,EAAE;QACL;YACE,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,sBAAsB;YAC5B,OAAO,EAAE,mCAAmC;YAC5C,WAAW,EAAE,8BAA8B;YAC3C,oBAAoB,EAAE,KAAK;SAC5B;QACD;YACE,MAAM,EAAE,eAAe;YACvB,IAAI,EAAE,uBAAuB;YAC7B,OAAO,EAAE,aAAa;YACtB,WAAW,EAAE,8CAA8C;YAC3D,oBAAoB,EAAE,IAAI;SAC3B;KACF;IACD,SAAS,EAAE;QACT,WAAW,EAAE,cAAc;KAC5B;CACF,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@stackweld/templates",
3
+ "version": "0.2.0",
4
+ "description": "Built-in stack templates for Stackweld — 20 ready-to-use project templates.",
5
+ "license": "MIT",
6
+ "author": "Orlando Fernandez <hello@xplustechnologies.com>",
7
+ "homepage": "https://github.com/mundowise/Stackweld",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/mundowise/Stackweld.git",
11
+ "directory": "packages/templates"
12
+ },
13
+ "type": "module",
14
+ "main": "./dist/index.js",
15
+ "types": "./dist/index.d.ts",
16
+ "scripts": {
17
+ "build": "tsc -b",
18
+ "dev": "tsc -b --watch",
19
+ "test": "vitest run --passWithNoTests",
20
+ "typecheck": "tsc --noEmit",
21
+ "lint": "biome check src/",
22
+ "clean": "rm -rf dist .turbo"
23
+ },
24
+ "dependencies": {
25
+ "@stackweld/core": "workspace:*",
26
+ "@stackweld/registry": "workspace:*"
27
+ },
28
+ "devDependencies": {
29
+ "@biomejs/biome": "^2.0.0",
30
+ "typescript": "^5.9.0",
31
+ "vitest": "^4.1.2"
32
+ }
33
+ }
@@ -0,0 +1,98 @@
1
+ import { loadAllTechnologies } from "@stackweld/registry";
2
+ import { describe, expect, it } from "vitest";
3
+ import {
4
+ findTemplatesByTechnologies,
5
+ getAllTemplates,
6
+ getTemplate,
7
+ listTemplateIds,
8
+ } from "../index.js";
9
+
10
+ describe("Templates Registry", () => {
11
+ it("has 5 built-in templates", () => {
12
+ const templates = getAllTemplates();
13
+ expect(templates.length).toBe(20);
14
+ });
15
+
16
+ it("each template has required fields", () => {
17
+ const templates = getAllTemplates();
18
+ for (const t of templates) {
19
+ expect(t.id).toBeTruthy();
20
+ expect(t.name).toBeTruthy();
21
+ expect(t.description).toBeTruthy();
22
+ expect(t.technologyIds.length).toBeGreaterThan(0);
23
+ expect(t.profile).toBeTruthy();
24
+ expect(Array.isArray(t.scaffoldSteps)).toBe(true);
25
+ expect(Array.isArray(t.overrides)).toBe(true);
26
+ expect(Array.isArray(t.hooks)).toBe(true);
27
+ expect(t.variables).toBeDefined();
28
+ }
29
+ });
30
+
31
+ it("gets template by ID", () => {
32
+ const t = getTemplate("t3-stack");
33
+ expect(t).not.toBeNull();
34
+ expect(t?.name).toBe("T3 Stack");
35
+ });
36
+
37
+ it("returns null for unknown template", () => {
38
+ expect(getTemplate("nonexistent")).toBeNull();
39
+ });
40
+
41
+ it("lists template IDs", () => {
42
+ const ids = listTemplateIds();
43
+ expect(ids).toContain("t3-stack");
44
+ expect(ids).toContain("django-rest-api");
45
+ expect(ids).toContain("fastapi-react");
46
+ expect(ids).toContain("go-microservice");
47
+ expect(ids).toContain("astro-landing");
48
+ expect(ids).toContain("sveltekit-fullstack");
49
+ expect(ids).toContain("nuxt3-app");
50
+ expect(ids).toContain("express-api");
51
+ expect(ids).toContain("hono-microservice");
52
+ expect(ids).toContain("django-react");
53
+ });
54
+
55
+ it("finds templates by technology", () => {
56
+ const results = findTemplatesByTechnologies(["nextjs"]);
57
+ expect(results.length).toBeGreaterThan(0);
58
+ expect(results.some((t) => t.id === "t3-stack")).toBe(true);
59
+ });
60
+
61
+ it("all template technologyIds exist in registry", () => {
62
+ const templates = getAllTemplates();
63
+ const techs = loadAllTechnologies();
64
+ const techIds = new Set(techs.map((t) => t.id));
65
+
66
+ for (const template of templates) {
67
+ for (const tid of template.technologyIds) {
68
+ expect(
69
+ techIds.has(tid),
70
+ `Template "${template.id}" references unknown technology "${tid}"`,
71
+ ).toBe(true);
72
+ }
73
+ }
74
+ });
75
+
76
+ it("scaffold steps have name and command", () => {
77
+ const templates = getAllTemplates();
78
+ for (const t of templates) {
79
+ for (const step of t.scaffoldSteps) {
80
+ expect(step.name).toBeTruthy();
81
+ expect(step.command).toBeTruthy();
82
+ }
83
+ }
84
+ });
85
+
86
+ it("hooks have required fields", () => {
87
+ const templates = getAllTemplates();
88
+ for (const t of templates) {
89
+ for (const hook of t.hooks) {
90
+ expect(hook.timing).toBeTruthy();
91
+ expect(hook.name).toBeTruthy();
92
+ expect(hook.command).toBeTruthy();
93
+ expect(hook.description).toBeTruthy();
94
+ expect(typeof hook.requiresConfirmation).toBe("boolean");
95
+ }
96
+ }
97
+ });
98
+ });
package/src/index.ts ADDED
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @stackweld/templates — Built-in template registry.
3
+ * Each template is a preconfigured stack recipe with scaffold steps,
4
+ * file overrides, and lifecycle hooks.
5
+ */
6
+
7
+ import type { Template } from "@stackweld/core";
8
+ import { astroLanding } from "./templates/astro-landing.js";
9
+ import { djangoReact } from "./templates/django-react.js";
10
+ import { djangoRestApi } from "./templates/django-rest-api.js";
11
+ import { expressApi } from "./templates/express-api.js";
12
+ import { fastapiReact } from "./templates/fastapi-react.js";
13
+ import { goMicroservice } from "./templates/go-microservice.js";
14
+ import { honoMicroservice } from "./templates/hono-microservice.js";
15
+ import { htmxDjango } from "./templates/htmx-django.js";
16
+ import { laravelApp } from "./templates/laravel-app.js";
17
+ import { mernStack } from "./templates/mern-stack.js";
18
+ import { monorepoStarter } from "./templates/monorepo-starter.js";
19
+ import { nestjsApi } from "./templates/nestjs-api.js";
20
+ import { nuxt3App } from "./templates/nuxt3-app.js";
21
+ import { pythonAiLab } from "./templates/python-ai-lab.js";
22
+ import { remixFullstack } from "./templates/remix-fullstack.js";
23
+ import { saasStarter } from "./templates/saas-starter.js";
24
+ import { solidstartApp } from "./templates/solidstart-app.js";
25
+ import { sveltekitFullstack } from "./templates/sveltekit-fullstack.js";
26
+ import { t3Stack } from "./templates/t3-stack.js";
27
+ import { tauriDesktop } from "./templates/tauri-desktop.js";
28
+
29
+ const templates: Template[] = [
30
+ t3Stack,
31
+ djangoRestApi,
32
+ fastapiReact,
33
+ goMicroservice,
34
+ astroLanding,
35
+ sveltekitFullstack,
36
+ nuxt3App,
37
+ expressApi,
38
+ honoMicroservice,
39
+ djangoReact,
40
+ mernStack,
41
+ saasStarter,
42
+ nestjsApi,
43
+ remixFullstack,
44
+ solidstartApp,
45
+ laravelApp,
46
+ pythonAiLab,
47
+ tauriDesktop,
48
+ monorepoStarter,
49
+ htmxDjango,
50
+ ];
51
+
52
+ const templateMap = new Map(templates.map((t) => [t.id, t]));
53
+
54
+ /** Get all available templates. */
55
+ export function getAllTemplates(): Template[] {
56
+ return [...templates];
57
+ }
58
+
59
+ /** Get a template by ID. */
60
+ export function getTemplate(id: string): Template | null {
61
+ return templateMap.get(id) ?? null;
62
+ }
63
+
64
+ /** List all template IDs. */
65
+ export function listTemplateIds(): string[] {
66
+ return templates.map((t) => t.id);
67
+ }
68
+
69
+ /** Find templates that match a given set of technology IDs. */
70
+ export function findTemplatesByTechnologies(technologyIds: string[]): Template[] {
71
+ const idSet = new Set(technologyIds);
72
+ return templates.filter((t) => t.technologyIds.some((tid) => idSet.has(tid)));
73
+ }
74
+
75
+ // Re-export individual templates
76
+ export {
77
+ astroLanding,
78
+ djangoReact,
79
+ djangoRestApi,
80
+ expressApi,
81
+ fastapiReact,
82
+ goMicroservice,
83
+ honoMicroservice,
84
+ htmxDjango,
85
+ laravelApp,
86
+ mernStack,
87
+ monorepoStarter,
88
+ nestjsApi,
89
+ nuxt3App,
90
+ pythonAiLab,
91
+ remixFullstack,
92
+ saasStarter,
93
+ solidstartApp,
94
+ sveltekitFullstack,
95
+ t3Stack,
96
+ tauriDesktop,
97
+ };
@@ -0,0 +1,40 @@
1
+ import type { Template } from "@stackweld/core";
2
+
3
+ export const astroLanding: Template = {
4
+ id: "astro-landing",
5
+ name: "Astro Landing Page",
6
+ description: "Fast static landing page with Astro, Tailwind CSS, and TypeScript",
7
+ technologyIds: ["astro", "nodejs", "typescript", "tailwindcss"],
8
+ profile: "lightweight",
9
+ scaffoldSteps: [
10
+ {
11
+ name: "Create Astro project",
12
+ command:
13
+ "npm create astro@latest {{projectName}} -- --template minimal --install --no-git --typescript strict",
14
+ },
15
+ {
16
+ name: "Add Tailwind integration",
17
+ command: "cd {{projectName}} && npx astro add tailwind -y",
18
+ },
19
+ ],
20
+ overrides: [
21
+ {
22
+ path: ".env.example",
23
+ content: ["PUBLIC_SITE_URL=http://localhost:4321", "PUBLIC_SITE_TITLE={{projectName}}"].join(
24
+ "\n",
25
+ ),
26
+ },
27
+ ],
28
+ hooks: [
29
+ {
30
+ timing: "post-scaffold",
31
+ name: "Install dependencies",
32
+ command: "cd {{projectName}} && npm install",
33
+ description: "Install npm dependencies",
34
+ requiresConfirmation: false,
35
+ },
36
+ ],
37
+ variables: {
38
+ projectName: "my-landing",
39
+ },
40
+ };
@@ -0,0 +1,127 @@
1
+ import type { Template } from "@stackweld/core";
2
+
3
+ export const djangoReact: Template = {
4
+ id: "django-react",
5
+ name: "Django + React",
6
+ description:
7
+ "Full-stack app with Django backend, React frontend, PostgreSQL, Redis, Tailwind CSS, and Docker",
8
+ technologyIds: [
9
+ "django",
10
+ "python",
11
+ "react",
12
+ "nodejs",
13
+ "typescript",
14
+ "postgresql",
15
+ "redis",
16
+ "tailwindcss",
17
+ ],
18
+ profile: "production",
19
+ scaffoldSteps: [
20
+ {
21
+ name: "Create project directory",
22
+ command: "mkdir -p {{projectName}}/{backend,frontend}",
23
+ },
24
+ {
25
+ name: "Setup Python backend",
26
+ command:
27
+ "python3 -m venv {{projectName}}/backend/.venv && {{projectName}}/backend/.venv/bin/pip install django djangorestframework psycopg2-binary django-redis django-cors-headers python-dotenv gunicorn",
28
+ },
29
+ {
30
+ name: "Create Django project",
31
+ command:
32
+ "{{projectName}}/backend/.venv/bin/django-admin startproject config {{projectName}}/backend",
33
+ },
34
+ {
35
+ name: "Create React frontend",
36
+ command: "npx create-vite@latest {{projectName}}/frontend -- --template react-ts",
37
+ },
38
+ {
39
+ name: "Install Tailwind in frontend",
40
+ command: "cd {{projectName}}/frontend && npm install -D tailwindcss @tailwindcss/vite",
41
+ },
42
+ ],
43
+ overrides: [
44
+ {
45
+ path: ".env.example",
46
+ content: [
47
+ "# Backend",
48
+ "DEBUG=True",
49
+ "SECRET_KEY=change-me-in-production",
50
+ "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/{{projectName}}",
51
+ "REDIS_URL=redis://localhost:6379/0",
52
+ "ALLOWED_HOSTS=localhost,127.0.0.1",
53
+ "CORS_ALLOWED_ORIGINS=http://localhost:5173",
54
+ "",
55
+ "# Frontend",
56
+ "VITE_API_URL=http://localhost:8000",
57
+ ].join("\n"),
58
+ },
59
+ {
60
+ path: "docker-compose.yml",
61
+ content: [
62
+ "services:",
63
+ " db:",
64
+ " image: postgres:17",
65
+ " restart: unless-stopped",
66
+ " ports:",
67
+ ' - "5432:5432"',
68
+ " environment:",
69
+ " POSTGRES_USER: postgres",
70
+ " POSTGRES_PASSWORD: postgres",
71
+ " POSTGRES_DB: {{projectName}}",
72
+ " volumes:",
73
+ " - pgdata:/var/lib/postgresql/data",
74
+ " healthcheck:",
75
+ ' test: ["CMD-SHELL", "pg_isready -U postgres"]',
76
+ " interval: 5s",
77
+ " timeout: 5s",
78
+ " retries: 5",
79
+ "",
80
+ " redis:",
81
+ " image: redis:7-alpine",
82
+ " restart: unless-stopped",
83
+ " ports:",
84
+ ' - "6379:6379"',
85
+ " healthcheck:",
86
+ ' test: ["CMD", "redis-cli", "ping"]',
87
+ " interval: 5s",
88
+ " timeout: 5s",
89
+ " retries: 5",
90
+ "",
91
+ "volumes:",
92
+ " pgdata:",
93
+ ].join("\n"),
94
+ },
95
+ {
96
+ path: "backend/requirements.txt",
97
+ content: [
98
+ "django>=5.1",
99
+ "djangorestframework>=3.15",
100
+ "psycopg2-binary>=2.9",
101
+ "django-redis>=5.4",
102
+ "django-cors-headers>=4.4",
103
+ "python-dotenv>=1.0",
104
+ "gunicorn>=22.0",
105
+ ].join("\n"),
106
+ },
107
+ ],
108
+ hooks: [
109
+ {
110
+ timing: "post-scaffold",
111
+ name: "Install frontend dependencies",
112
+ command: "cd {{projectName}}/frontend && npm install",
113
+ description: "Install npm dependencies for the React frontend",
114
+ requiresConfirmation: false,
115
+ },
116
+ {
117
+ timing: "post-scaffold",
118
+ name: "Freeze backend requirements",
119
+ command: "cd {{projectName}}/backend && .venv/bin/pip freeze > requirements.lock",
120
+ description: "Generate locked requirements file for the backend",
121
+ requiresConfirmation: false,
122
+ },
123
+ ],
124
+ variables: {
125
+ projectName: "my-django-react-app",
126
+ },
127
+ };
@@ -0,0 +1,99 @@
1
+ import type { Template } from "@stackweld/core";
2
+
3
+ export const djangoRestApi: Template = {
4
+ id: "django-rest-api",
5
+ name: "Django REST API",
6
+ description:
7
+ "Production-ready REST API with Django, Django REST Framework, PostgreSQL, and Redis",
8
+ technologyIds: ["django", "python", "postgresql", "redis"],
9
+ profile: "standard",
10
+ scaffoldSteps: [
11
+ {
12
+ name: "Create virtual environment",
13
+ command: "python3 -m venv {{projectName}}/.venv",
14
+ },
15
+ {
16
+ name: "Create Django project",
17
+ command:
18
+ "{{projectName}}/.venv/bin/pip install django djangorestframework && {{projectName}}/.venv/bin/django-admin startproject config {{projectName}}",
19
+ },
20
+ {
21
+ name: "Install additional dependencies",
22
+ command:
23
+ "{{projectName}}/.venv/bin/pip install psycopg2-binary django-redis django-cors-headers python-dotenv",
24
+ },
25
+ ],
26
+ overrides: [
27
+ {
28
+ path: ".env.example",
29
+ content: [
30
+ "DEBUG=True",
31
+ "SECRET_KEY=change-me-in-production",
32
+ "DATABASE_URL=postgresql://postgres:postgres@localhost:5432/{{projectName}}",
33
+ "REDIS_URL=redis://localhost:6379/0",
34
+ "ALLOWED_HOSTS=localhost,127.0.0.1",
35
+ "CORS_ALLOWED_ORIGINS=http://localhost:3000",
36
+ ].join("\n"),
37
+ },
38
+ {
39
+ path: "docker-compose.yml",
40
+ content: [
41
+ "services:",
42
+ " db:",
43
+ " image: postgres:17",
44
+ " restart: unless-stopped",
45
+ " ports:",
46
+ ' - "5432:5432"',
47
+ " environment:",
48
+ " POSTGRES_USER: postgres",
49
+ " POSTGRES_PASSWORD: postgres",
50
+ " POSTGRES_DB: {{projectName}}",
51
+ " volumes:",
52
+ " - pgdata:/var/lib/postgresql/data",
53
+ " healthcheck:",
54
+ ' test: ["CMD-SHELL", "pg_isready -U postgres"]',
55
+ " interval: 5s",
56
+ " timeout: 5s",
57
+ " retries: 5",
58
+ "",
59
+ " redis:",
60
+ " image: redis:7-alpine",
61
+ " restart: unless-stopped",
62
+ " ports:",
63
+ ' - "6379:6379"',
64
+ " healthcheck:",
65
+ ' test: ["CMD", "redis-cli", "ping"]',
66
+ " interval: 5s",
67
+ " timeout: 5s",
68
+ " retries: 5",
69
+ "",
70
+ "volumes:",
71
+ " pgdata:",
72
+ ].join("\n"),
73
+ },
74
+ {
75
+ path: "requirements.txt",
76
+ content: [
77
+ "django>=5.1",
78
+ "djangorestframework>=3.15",
79
+ "psycopg2-binary>=2.9",
80
+ "django-redis>=5.4",
81
+ "django-cors-headers>=4.4",
82
+ "python-dotenv>=1.0",
83
+ "gunicorn>=22.0",
84
+ ].join("\n"),
85
+ },
86
+ ],
87
+ hooks: [
88
+ {
89
+ timing: "post-scaffold",
90
+ name: "Freeze requirements",
91
+ command: "cd {{projectName}} && .venv/bin/pip freeze > requirements.lock",
92
+ description: "Generate locked requirements file",
93
+ requiresConfirmation: false,
94
+ },
95
+ ],
96
+ variables: {
97
+ projectName: "my-django-api",
98
+ },
99
+ };