@jttc/projen-project-types 1.0.0-beta.0 → 1.0.0-beta.10

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 (113) hide show
  1. package/.cz-config.js +83 -43
  2. package/.czrc +1 -1
  3. package/.jsii +4637 -14
  4. package/AGENTS.md +132 -0
  5. package/API.md +31146 -7
  6. package/README.md +197 -29
  7. package/docs/components/cdk8s.md +724 -0
  8. package/docs/components/commitzent.md +261 -0
  9. package/docs/components/k3d.md +456 -0
  10. package/docs/default-configurations.md +267 -0
  11. package/docs/index.md +86 -1
  12. package/docs/project-types/cdk-app.md +481 -0
  13. package/docs/project-types/cdk-library.md +321 -0
  14. package/docs/project-types/cdk8s-app.md +353 -0
  15. package/docs/project-types/cdk8s-library.md +442 -0
  16. package/docs/project-types/nx-monorepo.md +382 -0
  17. package/lib/cdk/cdk-app-project.d.ts +12 -0
  18. package/lib/cdk/cdk-app-project.js +28 -0
  19. package/lib/cdk/cdk-library-project.d.ts +12 -0
  20. package/lib/cdk/cdk-library-project.js +28 -0
  21. package/lib/cdk/cdk8s-app-project.d.ts +14 -0
  22. package/lib/cdk/cdk8s-app-project.js +54 -0
  23. package/lib/cdk/cdk8s-library-project.d.ts +14 -0
  24. package/lib/cdk/cdk8s-library-project.js +50 -0
  25. package/lib/cdk/index.d.ts +5 -0
  26. package/lib/cdk/index.js +22 -0
  27. package/lib/cdk/interfaces/cdk-app-options.d.ts +7 -0
  28. package/lib/cdk/interfaces/cdk-app-options.js +3 -0
  29. package/lib/cdk/interfaces/cdk-library-options.d.ts +7 -0
  30. package/lib/cdk/interfaces/cdk-library-options.js +3 -0
  31. package/lib/cdk/interfaces/cdk8s-app-options.d.ts +18 -0
  32. package/lib/cdk/interfaces/cdk8s-app-options.js +3 -0
  33. package/lib/cdk/interfaces/cdk8s-library-options.d.ts +8 -0
  34. package/lib/cdk/interfaces/cdk8s-library-options.js +3 -0
  35. package/lib/cdk/interfaces/index.d.ts +5 -0
  36. package/lib/cdk/interfaces/index.js +22 -0
  37. package/lib/cdk/interfaces/jsii-options.d.ts +7 -0
  38. package/lib/cdk/interfaces/jsii-options.js +3 -0
  39. package/lib/cdk/interfaces/project-global-options.d.ts +15 -0
  40. package/lib/cdk/interfaces/project-global-options.js +3 -0
  41. package/lib/cdk/jsii-project.d.ts +12 -0
  42. package/lib/cdk/jsii-project.js +24 -0
  43. package/lib/common/common-options.d.ts +40 -0
  44. package/lib/common/common-options.js +110 -0
  45. package/lib/components/agents/agents.d.ts +21 -0
  46. package/lib/components/agents/agents.js +476 -0
  47. package/lib/components/agents/index.d.ts +1 -0
  48. package/lib/components/agents/index.js +18 -0
  49. package/lib/components/cdk8s/cdk8s.d.ts +11 -0
  50. package/lib/components/cdk8s/cdk8s.js +124 -0
  51. package/lib/components/cdk8s/index.d.ts +2 -0
  52. package/lib/components/cdk8s/index.js +19 -0
  53. package/lib/components/cdk8s/interfaces/Cdk8s.d.ts +34 -0
  54. package/lib/components/cdk8s/interfaces/Cdk8s.js +12 -0
  55. package/lib/components/cdk8s/main-library.ts.template +35 -0
  56. package/lib/components/cdk8s/main.test.ts.template +3 -0
  57. package/lib/components/cdk8s/main.ts.template +38 -0
  58. package/lib/components/commitzent/commitzent.d.ts +8 -0
  59. package/lib/components/commitzent/commitzent.js +100 -0
  60. package/lib/components/commitzent/index.d.ts +2 -0
  61. package/lib/components/commitzent/index.js +19 -0
  62. package/lib/components/commitzent/interfaces/Icommitzent.d.ts +34 -0
  63. package/lib/components/commitzent/interfaces/Icommitzent.js +3 -0
  64. package/lib/components/index.d.ts +4 -0
  65. package/lib/components/index.js +21 -0
  66. package/lib/components/k3d/index.d.ts +3 -0
  67. package/lib/components/k3d/index.js +20 -0
  68. package/lib/components/k3d/k3d.d.ts +33 -0
  69. package/lib/components/k3d/k3d.js +109 -0
  70. package/lib/components/k3d/k3dBase.d.ts +4 -0
  71. package/lib/components/k3d/k3dBase.js +23 -0
  72. package/lib/components/k3d/types.d.ts +64 -0
  73. package/lib/components/k3d/types.js +8 -0
  74. package/lib/index.d.ts +5 -3
  75. package/lib/index.js +20 -12
  76. package/lib/monorepo/components/NxConfiguration.d.ts +17 -0
  77. package/lib/monorepo/components/NxConfiguration.js +105 -0
  78. package/lib/monorepo/components/index.d.ts +2 -0
  79. package/lib/monorepo/components/index.js +19 -0
  80. package/lib/monorepo/components/publish-release.d.ts +5 -0
  81. package/lib/monorepo/components/publish-release.js +80 -0
  82. package/lib/monorepo/index.d.ts +3 -0
  83. package/lib/monorepo/index.js +20 -0
  84. package/lib/monorepo/interfaces/Nx.d.ts +130 -0
  85. package/lib/monorepo/interfaces/Nx.js +3 -0
  86. package/lib/monorepo/interfaces/NxMonorepo.d.ts +3 -0
  87. package/lib/monorepo/interfaces/NxMonorepo.js +3 -0
  88. package/lib/monorepo/interfaces/index.d.ts +2 -0
  89. package/lib/monorepo/interfaces/index.js +19 -0
  90. package/lib/monorepo/monorepo.d.ts +16 -0
  91. package/lib/monorepo/monorepo.js +131 -0
  92. package/lib/terraform/components/index.d.ts +2 -0
  93. package/lib/terraform/components/index.js +19 -0
  94. package/lib/terraform/components/terraform-deploy-github-workflow.d.ts +26 -0
  95. package/lib/terraform/components/terraform-deploy-github-workflow.js +92 -0
  96. package/lib/terraform/components/terraform-plan-github-workflow.d.ts +31 -0
  97. package/lib/terraform/components/terraform-plan-github-workflow.js +155 -0
  98. package/lib/terraform/index.d.ts +5 -0
  99. package/lib/terraform/index.js +22 -0
  100. package/lib/terraform/providers/hetzner-provider.d.ts +105 -0
  101. package/lib/terraform/providers/hetzner-provider.js +83 -0
  102. package/lib/terraform/providers/index.d.ts +2 -0
  103. package/lib/terraform/providers/index.js +19 -0
  104. package/lib/terraform/providers/provider-strategy.d.ts +44 -0
  105. package/lib/terraform/providers/provider-strategy.js +38 -0
  106. package/lib/terraform/terraform-base-project.d.ts +38 -0
  107. package/lib/terraform/terraform-base-project.js +97 -0
  108. package/lib/terraform/terraform-module-project.d.ts +24 -0
  109. package/lib/terraform/terraform-module-project.js +77 -0
  110. package/lib/terraform/terraform-stack-project.d.ts +28 -0
  111. package/lib/terraform/terraform-stack-project.js +83 -0
  112. package/mkdocs.yml +12 -0
  113. package/package.json +14 -7
@@ -0,0 +1,321 @@
1
+ # CDK Library Project
2
+
3
+ The CDK Library Project type provides an opinionated setup for creating AWS CDK construct libraries with best practices and common configurations pre-configured.
4
+
5
+ ## Overview
6
+
7
+ This project type extends the standard `AwsCdkConstructLibrary` from projen with additional features:
8
+
9
+ - **Prettier configuration** with sensible defaults
10
+ - **VSCode settings and extensions** for enhanced development experience
11
+ - **Common project structure** and tooling setup
12
+ - **Configurable options** that respect user preferences
13
+
14
+ ## Quick Start
15
+
16
+ To create a new CDK Library project, use the projen CLI:
17
+
18
+ ```bash linenums="1"
19
+ npx projen new --from @jttc/projen-project-types cdk-library
20
+ ```
21
+
22
+ This command will create a new project with the CDK Library template and prompt you for the required configuration options such as:
23
+
24
+ - Project name
25
+ - Author information
26
+ - Repository URL
27
+ - CDK version
28
+ - Default branch
29
+
30
+ After the project is created, you can customize it further by editing the `.projenrc.ts` file:
31
+
32
+ ```typescript linenums="1" title=".projenrc.ts" hl_lines="4 8 12 13"
33
+ import { CdkLibrary } from '@jttc/projen-project-types';
34
+
35
+ const project = new CdkLibrary({
36
+ name: 'my-awesome-cdk-library',
37
+ author: 'Your Name',
38
+ authorAddress: 'your.email@example.com',
39
+ repositoryUrl: 'https://github.com/yourusername/my-awesome-cdk-library.git',
40
+ cdkVersion: '2.1.0',
41
+ defaultReleaseBranch: 'main',
42
+
43
+ // Add any additional customizations here
44
+ prettier: true,
45
+ vscode: true,
46
+ });
47
+
48
+ project.synth();
49
+ ```
50
+
51
+ **Highlighted lines explanation:**
52
+
53
+ - **Line 4**: Choose a descriptive name for your CDK construct library
54
+ - **Line 8**: Pin to a specific CDK version for consistency
55
+ - **Line 12**: Enable prettier formatting (default: true)
56
+ - **Line 13**: Enable VSCode workspace configuration (default: true)
57
+
58
+ ## Features
59
+
60
+ ### Common Configurations
61
+
62
+ This project type includes the same common configurations as other project types:
63
+
64
+ !!! info "Default Configurations"
65
+ For complete details about Prettier and VSCode configurations, see [Default Configurations](../default-configurations.md). This includes:
66
+
67
+ - [Prettier Configuration](../default-configurations.md#prettier-configuration) - Code formatting rules and customization
68
+ - [VSCode Configuration](../default-configurations.md#vscode-configuration) - Editor settings and recommended extensions
69
+
70
+ ### CDK-Specific Features
71
+
72
+ - **AWS CDK Integration** with construct library setup
73
+ - **TypeScript configuration** optimized for CDK development
74
+ - **Publishing pipeline** ready for npm/JSR distribution
75
+ - **Testing setup** with Jest and CDK assertions
76
+
77
+ ## Configuration Options
78
+
79
+ ### Basic Configuration
80
+
81
+ All standard `AwsCdkConstructLibraryOptions` are supported. Here are the required options:
82
+
83
+ ```typescript linenums="1" title="Basic CDK Library Configuration"
84
+ const project = new CdkLibrary({
85
+ // Required options
86
+ name: 'my-cdk-library',
87
+ author: 'Your Name',
88
+ authorAddress: 'your.email@example.com',
89
+ repositoryUrl: 'https://github.com/yourusername/my-cdk-library.git',
90
+ cdkVersion: '2.1.0',
91
+ defaultReleaseBranch: 'main',
92
+
93
+ // Optional configurations (see sections below)
94
+ });
95
+ ```
96
+
97
+ ### Common Configuration Options
98
+
99
+ For Prettier and VSCode configuration options, refer to [Default Configurations](../default-configurations.md):
100
+
101
+ - **Prettier**: [Customization Guide](../default-configurations.md#customization)
102
+ - **VSCode**: [Configuration Options](../default-configurations.md#customization)
103
+
104
+ ## Examples
105
+
106
+ ### Minimal Setup
107
+
108
+ Perfect for getting started quickly with all defaults:
109
+
110
+ ```typescript linenums="1" title=".projenrc.ts - Minimal Setup"
111
+ import { CdkLibrary } from '@jttc/projen-project-types';
112
+
113
+ const project = new CdkLibrary({
114
+ name: 'simple-cdk-library',
115
+ author: 'John Doe',
116
+ authorAddress: 'john@example.com',
117
+ repositoryUrl: 'https://github.com/johndoe/simple-cdk-library.git',
118
+ cdkVersion: '2.1.0',
119
+ defaultReleaseBranch: 'main',
120
+ // All other options use sensible defaults
121
+ });
122
+
123
+ project.synth();
124
+ ```
125
+
126
+ ### Customized Setup
127
+
128
+ Example with custom prettier settings and additional CDK options:
129
+
130
+ ```typescript linenums="1" title=".projenrc.ts - Advanced Configuration" hl_lines="11 12 18 19 20"
131
+ import { CdkLibrary } from '@jttc/projen-project-types';
132
+
133
+ const project = new CdkLibrary({
134
+ name: 'advanced-cdk-library',
135
+ author: 'Jane Smith',
136
+ authorAddress: 'jane@company.com',
137
+ repositoryUrl: 'https://github.com/company/advanced-cdk-library.git',
138
+ cdkVersion: '2.1.0',
139
+ defaultReleaseBranch: 'main',
140
+
141
+ // Custom prettier settings
142
+ prettierOptions: {
143
+ settings: {
144
+ printWidth: 120,
145
+ tabWidth: 4,
146
+ },
147
+ },
148
+
149
+ // Enable VSCode (explicit)
150
+ vscode: true,
151
+
152
+ // Additional CDK library options
153
+ description: 'An advanced CDK construct library',
154
+ keywords: ['aws', 'cdk', 'constructs'],
155
+ license: 'MIT',
156
+ });
157
+
158
+ project.synth();
159
+ ```
160
+
161
+ **Highlighted lines explanation:**
162
+
163
+ - **Lines 11-16**: Custom prettier settings for longer lines and 4-space indentation
164
+ - **Line 19**: Enable VSCode configuration explicitly
165
+ - **Lines 22-24**: Additional NPM package metadata for discoverability
166
+
167
+ ### Development-Only Setup
168
+
169
+ Optimized for local development with minimal tooling:
170
+
171
+ ```typescript linenums="1" title=".projenrc.ts - Development Focus" hl_lines="11 12"
172
+ import { CdkLibrary } from '@jttc/projen-project-types';
173
+
174
+ const project = new CdkLibrary({
175
+ name: 'dev-cdk-library',
176
+ author: 'Developer',
177
+ authorAddress: 'dev@localhost.com',
178
+ repositoryUrl: 'https://github.com/dev/dev-cdk-library.git',
179
+ cdkVersion: '2.1.0',
180
+ defaultReleaseBranch: 'main',
181
+
182
+ prettier: false,
183
+ vscode: true,
184
+ });
185
+
186
+ project.synth();
187
+ ```
188
+
189
+ **Highlighted lines explanation:**
190
+
191
+ - **Line 11**: Skip prettier for faster development iterations
192
+ - **Line 12**: Keep VSCode config for better developer experience
193
+
194
+ ## Project Structure
195
+
196
+ After running `yarn projen` with a CDK Library project, you'll get the following structure:
197
+
198
+ ```text title="Generated Project Structure"
199
+ my-cdk-library/
200
+ ├── .github/
201
+ │ └── workflows/ # CI/CD workflows
202
+ │ ├── build.yml
203
+ │ ├── release.yml
204
+ │ └── upgrade-main.yml
205
+ ├── .vscode/ # VSCode configuration (if enabled)
206
+ │ ├── extensions.json # Recommended extensions
207
+ │ └── settings.json # Editor settings
208
+ ├── src/
209
+ │ └── index.ts # Main library entry point
210
+ ├── test/
211
+ │ └── *.test.ts # Test files
212
+ ├── .eslintrc.json # ESLint configuration
213
+ ├── .gitignore # Git ignore rules
214
+ ├── .prettierrc.json # Prettier config (if enabled)
215
+ ├── .projenrc.ts # Projen configuration
216
+ ├── package.json # NPM package configuration
217
+ ├── tsconfig.json # TypeScript configuration
218
+ └── README.md # Generated README
219
+ ```
220
+
221
+ !!! info "Conditional Files"
222
+ Some files are only created based on your configuration:
223
+
224
+ - `.vscode/` folder: Only when `vscode: true` (default)
225
+ - `.prettierrc.json`: Only when `prettier: true` (default)
226
+
227
+ ## Best Practices
228
+
229
+ ### 1. Use Consistent Configurations
230
+
231
+ Stick with the default prettier and VSCode configurations unless you have specific requirements. This ensures consistency across your team and projects.
232
+
233
+ ### 2. Leverage VSCode Extensions
234
+
235
+ The recommended extensions provide significant productivity improvements for CDK development. Make sure your team installs them.
236
+
237
+ ### 3. Customize Thoughtfully
238
+
239
+ While customization is available, consider whether deviating from defaults provides real value. Consistency often trumps personal preferences in team environments.
240
+
241
+ ### 4. Version Lock Your CDK Version
242
+
243
+ Always specify a specific CDK version to ensure consistent builds across environments:
244
+
245
+ ```typescript
246
+ cdkVersion: '2.1.0', // Good - specific version
247
+ // cdkVersion: '^2.0.0', // Avoid - could lead to inconsistencies
248
+ ```
249
+
250
+ ## Troubleshooting
251
+
252
+ ### Prettier Not Working
253
+
254
+ If prettier isn't formatting your code:
255
+
256
+ 1. Ensure the prettier extension is installed in VSCode
257
+ 2. Check that `"editor.defaultFormatter": "esbenp.prettier-vscode"` is in your VSCode settings
258
+ 3. Verify `.prettierrc.json` exists in your project root
259
+
260
+ ### VSCode Extensions Not Recommended
261
+
262
+ If VSCode isn't showing extension recommendations:
263
+
264
+ 1. Check that `.vscode/extensions.json` exists
265
+ 2. Restart VSCode
266
+ 3. Go to Extensions panel and look for the "Recommended" section
267
+
268
+ ### Build Errors
269
+
270
+ If you encounter build errors after setup:
271
+
272
+ 1. Run `yarn install` to ensure all dependencies are installed
273
+ 2. Run `yarn projen` to regenerate configuration files
274
+ 3. Check that your CDK version is compatible with your constructs version
275
+
276
+ ## Migration Guide
277
+
278
+ ### From Standard AwsCdkConstructLibrary
279
+
280
+ To migrate from a standard `AwsCdkConstructLibrary` to `CdkLibrary`:
281
+
282
+ 1. Install the package: `npm install @jttc/projen-project-types`
283
+ 2. Update your `.projenrc.ts`:
284
+
285
+ ```diff
286
+ - import { AwsCdkConstructLibrary } from 'projen/lib/awscdk';
287
+ + import { CdkLibrary } from '@jttc/projen-project-types';
288
+
289
+ - const project = new AwsCdkConstructLibrary({
290
+ + const project = new CdkLibrary({
291
+ // ... same options
292
+ });
293
+ ```
294
+
295
+ 3. Run `yarn projen` to regenerate files
296
+ 4. Commit the changes
297
+
298
+ The migration is backward compatible - all existing options will continue to work.
299
+
300
+ ## Contributing
301
+
302
+ To contribute improvements to the CDK Library project type:
303
+
304
+ 1. Fork the repository
305
+ 2. Make your changes
306
+ 3. Add tests for new functionality
307
+ 4. Update documentation
308
+ 5. Submit a pull request
309
+
310
+ ## Support
311
+
312
+ If you encounter issues or have questions:
313
+
314
+ - Check this documentation
315
+ - Review existing GitHub issues
316
+ - Create a new issue with detailed information
317
+ - Tag the maintainers for urgent issues
318
+
319
+ ---
320
+
321
+ *This project type is maintained by [Jump to the Cloud](https://jumptothecloud.tech) team.*
@@ -0,0 +1,353 @@
1
+ # CDK8s App Project
2
+
3
+ The CDK8s App Project type provides an opinionated setup for creating CDK8s applications with Kubernetes manifest generation, combining best practices and common configurations.
4
+
5
+ ## Overview
6
+
7
+ This project type extends the standard `TypeScriptProject` from projen with additional CDK8s features:
8
+
9
+ - **CDK8s integration** for Kubernetes manifest generation
10
+ - **Multi-version Kubernetes support** (v1.29 to v1.33)
11
+ - **Prettier configuration** and **VSCode settings** - see [Default Configurations](../default-configurations.md)
12
+ - **Common project structure** and tooling setup
13
+ - **Configurable CDK8s options** for custom workflows
14
+ - **Application-focused setup** for deploying Kubernetes applications
15
+
16
+ ## Quick Start
17
+
18
+ To create a new CDK8s App project, use the projen CLI:
19
+
20
+ ```bash linenums="1"
21
+ npx projen new --from @jttc/projen-project-types cdk8s-app
22
+ ```
23
+
24
+ This command will create a new project with the CDK8s App template and prompt you for the required configuration options such as:
25
+
26
+ - Project name
27
+ - Author information
28
+ - Repository URL
29
+ - Default branch
30
+ - Kubernetes version
31
+
32
+ After the project is created, you can customize it further by editing the `.projenrc.ts` file:
33
+
34
+ ```typescript linenums="1" title=".projenrc.ts" hl_lines="4 8 12 13 14 15"
35
+ import { Cdk8App } from '@jttc/projen-project-types';
36
+ import { K8sVersion } from '@jttc/projen-project-types';
37
+
38
+ const project = new Cdk8App({
39
+ name: 'my-awesome-cdk8s-app',
40
+ author: 'Your Name',
41
+ authorAddress: 'your.email@example.com',
42
+ repositoryUrl: 'https://github.com/yourusername/my-awesome-cdk8s-app.git',
43
+ defaultReleaseBranch: 'main',
44
+
45
+ // CDK8s specific configuration
46
+ k8sVersion: K8sVersion.V1_31,
47
+ appPath: 'src/k8s',
48
+ appFile: 'main.ts',
49
+ outputPath: 'dist/manifests',
50
+ imports: ['k8s@1.31.0/api/core/v1/configmap', 'k8s@1.31.0/api/apps/v1/deployment'],
51
+ });
52
+
53
+ project.synth();
54
+ ```
55
+
56
+ **Highlighted lines explanation:**
57
+
58
+ - **Line 4**: Choose a descriptive name for your CDK8s application
59
+ - **Line 8**: Set the repository URL for your project
60
+ - **Line 12**: Set the Kubernetes version for CDK8s imports
61
+ - **Line 13**: Configure custom path for Kubernetes source code
62
+ - **Line 14**: Set the main application file name
63
+ - **Line 15**: Set output directory for generated manifests
64
+ - **Line 16**: Add specific Kubernetes resource imports
65
+
66
+ ## Features
67
+
68
+ ### CDK8s Integration
69
+
70
+ The CDK8s App project includes full CDK8s integration with:
71
+
72
+ - **Automatic CDK8s setup** with configurable Kubernetes versions
73
+ - **Import generation** from Kubernetes APIs and custom resources
74
+ - **TypeScript-first** Kubernetes manifest authoring
75
+ - **CDK8s tasks** for building and synthesizing manifests
76
+ - **Application structure** optimized for Kubernetes deployments
77
+
78
+ ### Kubernetes Version Support
79
+
80
+ Choose from multiple supported Kubernetes versions:
81
+
82
+ | Version | CDK8s Plus Package | Description |
83
+ |---------|-------------------|-------------|
84
+ | v1.29 | `cdk8s-plus-29` | Kubernetes v1.29 support |
85
+ | v1.30 | `cdk8s-plus-30` | Kubernetes v1.30 support |
86
+ | v1.31 | `cdk8s-plus-31` | Kubernetes v1.31 support (default) |
87
+ | v1.32 | `cdk8s-plus-32` | Kubernetes v1.32 support |
88
+ | v1.33 | `cdk8s-plus-33` | Kubernetes v1.33 support |
89
+
90
+ ### Common Configurations
91
+
92
+ This project type includes the same common configurations as other project types:
93
+
94
+ !!! info "Default Configurations"
95
+ For complete details about Prettier and VSCode configurations, see [Default Configurations](../default-configurations.md). This includes:
96
+
97
+ - [Prettier Configuration](../default-configurations.md#prettier-configuration) - Code formatting rules and customization
98
+ - [VSCode Configuration](../default-configurations.md#vscode-configuration) - Editor settings and recommended extensions
99
+
100
+ ### CDK8s App Structure
101
+
102
+ The CDK8s App project creates a complete application structure with:
103
+
104
+ - **Main application entry point** (`src/main.ts`)
105
+ - **CDK8s configuration** (`cdk8s.yaml`)
106
+ - **Kubernetes source directory** (configurable, default: `src/k8s`)
107
+ - **Output directory** for generated manifests (configurable, default: `kubernetes`)
108
+ - **Import generation setup** for Kubernetes APIs
109
+ - **Proper TypeScript setup** for CDK8s development
110
+
111
+ ## Configuration Options
112
+
113
+ ### Basic Configuration
114
+
115
+ All standard `TypeScriptProjectOptions` are supported, along with CDK8s-specific options:
116
+
117
+ ```typescript
118
+ interface Cdk8sAppOptions extends Cdk8sBaseOptions, TypeScriptProjectOptions {
119
+ // Standard TypeScript project options
120
+ name: string;
121
+ defaultReleaseBranch: string;
122
+
123
+ // CDK8s specific options
124
+ k8sVersion?: K8sVersion;
125
+ appPath?: string;
126
+ appFile?: string;
127
+ outputPath?: string;
128
+ imports?: string[];
129
+ }
130
+ ```
131
+
132
+ ### CDK8s Configuration
133
+
134
+ | Option | Type | Default | Description |
135
+ |--------|------|---------|-------------|
136
+ | `k8sVersion` | `K8sVersion` | `V1_31` | Kubernetes version for CDK8s imports |
137
+ | `appPath` | `string` | `"src/k8s"` | Path to CDK8s application source |
138
+ | `appFile` | `string` | `"main.ts"` | Main application file name |
139
+ | `outputPath` | `string` | `"kubernetes"` | Output directory for manifests |
140
+ | `imports` | `string[]` | `[]` | Additional Kubernetes imports |
141
+
142
+ ### Advanced Configuration
143
+
144
+ ```typescript title="Advanced .projenrc.ts"
145
+ import { Cdk8App } from '@jttc/projen-project-types';
146
+ import { K8sVersion } from '@jttc/projen-project-types';
147
+
148
+ const project = new Cdk8App({
149
+ name: 'advanced-cdk8s-app',
150
+ defaultReleaseBranch: 'main',
151
+
152
+ // CDK8s Configuration
153
+ k8sVersion: K8sVersion.V1_31,
154
+ appPath: 'src/kubernetes',
155
+ appFile: 'app.ts',
156
+ outputPath: 'manifests',
157
+
158
+ // Kubernetes API imports
159
+ imports: [
160
+ 'k8s@1.31.0/api/core/v1/pod',
161
+ 'k8s@1.31.0/api/core/v1/service',
162
+ 'k8s@1.31.0/api/apps/v1/deployment',
163
+ 'k8s@1.31.0/api/networking/v1/ingress',
164
+ ],
165
+
166
+ // TypeScript project options
167
+ prettier: true,
168
+ vscode: true,
169
+ packageName: '@myorg/k8s-app',
170
+ });
171
+
172
+ project.synth();
173
+ ```
174
+
175
+ ## Common Usage Patterns
176
+
177
+ ### Simple Web Application
178
+
179
+ ```typescript title="Basic web app deployment"
180
+ import { Cdk8App } from '@jttc/projen-project-types';
181
+ import { K8sVersion } from '@jttc/projen-project-types';
182
+
183
+ const project = new Cdk8App({
184
+ name: 'my-web-app',
185
+ defaultReleaseBranch: 'main',
186
+ k8sVersion: K8sVersion.V1_31,
187
+
188
+ imports: [
189
+ 'k8s@1.31.0/api/core/v1/service',
190
+ 'k8s@1.31.0/api/apps/v1/deployment',
191
+ 'k8s@1.31.0/api/networking/v1/ingress',
192
+ ],
193
+ });
194
+
195
+ project.synth();
196
+ ```
197
+
198
+ ### Microservices Application
199
+
200
+ ```typescript title="Multi-service deployment"
201
+ import { Cdk8App } from '@jttc/projen-project-types';
202
+ import { K8sVersion } from '@jttc/projen-project-types';
203
+
204
+ const project = new Cdk8App({
205
+ name: 'microservices-platform',
206
+ defaultReleaseBranch: 'main',
207
+ k8sVersion: K8sVersion.V1_31,
208
+ appPath: 'src/platform',
209
+ outputPath: 'dist/k8s',
210
+
211
+ imports: [
212
+ 'k8s@1.31.0/api/core/v1/configmap',
213
+ 'k8s@1.31.0/api/core/v1/secret',
214
+ 'k8s@1.31.0/api/core/v1/service',
215
+ 'k8s@1.31.0/api/apps/v1/deployment',
216
+ 'k8s@1.31.0/api/networking/v1/networkpolicy',
217
+ ],
218
+ });
219
+
220
+ project.synth();
221
+ ```
222
+
223
+ ### Custom Resources Integration
224
+
225
+ ```typescript title="With custom Kubernetes operators"
226
+ import { Cdk8App } from '@jttc/projen-project-types';
227
+ import { K8sVersion } from '@jttc/projen-project-types';
228
+
229
+ const project = new Cdk8App({
230
+ name: 'custom-resources-app',
231
+ defaultReleaseBranch: 'main',
232
+ k8sVersion: K8sVersion.V1_31,
233
+
234
+ imports: [
235
+ // Standard Kubernetes resources
236
+ 'k8s@1.31.0/api/core/v1',
237
+ 'k8s@1.31.0/api/apps/v1',
238
+ // Custom resources from operators
239
+ 'prometheus-operator@0.65.1',
240
+ 'istio@1.18.0',
241
+ ],
242
+ });
243
+
244
+ project.synth();
245
+ ```
246
+
247
+ ## Development Workflow
248
+
249
+ ### Generated Files
250
+
251
+ The CDK8s App project generates several important files:
252
+
253
+ - **`cdk8s.yaml`**: CDK8s configuration file
254
+ - **`src/k8s/main.ts`**: Main CDK8s application (configurable path)
255
+ - **`kubernetes/`**: Generated Kubernetes manifests (configurable path)
256
+ - **Import files**: Generated TypeScript bindings for Kubernetes APIs
257
+
258
+ ### Available Tasks
259
+
260
+ | Task | Command | Description |
261
+ |------|---------|-------------|
262
+ | Build | `npm run build` | Compile TypeScript and generate manifests |
263
+ | Import | `npm run cdk8s:import` | Generate TypeScript bindings for Kubernetes APIs |
264
+ | Synthesize | `npm run cdk8s:synth` | Generate Kubernetes manifests |
265
+ | Test | `npm run test` | Run unit tests |
266
+
267
+ ### Typical Development Flow
268
+
269
+ 1. **Initial setup**: Run `npm run cdk8s:import` to generate API bindings
270
+ 2. **Write CDK8s code**: Create your Kubernetes application in the configured app path
271
+ 3. **Build and test**: Run `npm run build` and `npm run test`
272
+ 4. **Generate manifests**: Run `npm run cdk8s:synth` to create Kubernetes YAML
273
+ 5. **Deploy**: Apply the generated manifests to your Kubernetes cluster
274
+
275
+ ## CDK8s Component Integration
276
+
277
+ The CDK8s App project uses the [CDK8s Component](../components/cdk8s.md) internally to provide:
278
+
279
+ - Kubernetes API import management
280
+ - CDK8s task configuration
281
+ - Proper dependency management
282
+ - Custom resource integration
283
+
284
+ For more details on the underlying CDK8s functionality, see the [CDK8s Component documentation](../components/cdk8s.md).
285
+
286
+ ## Example Application
287
+
288
+ Here's a simple example of what your `src/k8s/main.ts` might look like:
289
+
290
+ ```typescript title="src/k8s/main.ts"
291
+ import { App, Chart, ChartProps } from 'cdk8s';
292
+ import { Construct } from 'constructs';
293
+ import { Deployment, Service, IntOrString } from 'cdk8s-plus-31';
294
+
295
+ export class MyChart extends Chart {
296
+ constructor(scope: Construct, id: string, props: ChartProps = { }) {
297
+ super(scope, id, props);
298
+
299
+ // Create a deployment
300
+ const deployment = new Deployment(this, 'my-app', {
301
+ replicas: 3,
302
+ containers: [{
303
+ image: 'nginx:latest',
304
+ ports: [{ containerPort: 80 }],
305
+ }],
306
+ });
307
+
308
+ // Expose the deployment
309
+ new Service(this, 'my-service', {
310
+ selector: deployment,
311
+ ports: [{ port: 80, targetPort: IntOrString.fromNumber(80) }],
312
+ });
313
+ }
314
+ }
315
+
316
+ const app = new App();
317
+ new MyChart(app, 'my-chart');
318
+ app.synth();
319
+ ```
320
+
321
+ This example creates a simple nginx deployment with a service to expose it.
322
+
323
+ ## Best Practices
324
+
325
+ ### Project Structure
326
+
327
+ - Keep your CDK8s application code in the configured `appPath` directory
328
+ - Use meaningful names for your charts and constructs
329
+ - Organize complex applications into multiple chart files
330
+ - Leverage TypeScript interfaces for configuration
331
+
332
+ ### Configuration Management
333
+
334
+ - Use ConfigMaps and Secrets for application configuration
335
+ - Implement proper resource naming conventions
336
+ - Use labels and annotations for better resource management
337
+ - Consider using CDK8s constructs for common patterns
338
+
339
+ ### Testing
340
+
341
+ - Write unit tests for your CDK8s constructs
342
+ - Use snapshot testing for manifest verification
343
+ - Test different configuration scenarios
344
+ - Validate generated manifests against Kubernetes schemas
345
+
346
+ ### Deployment
347
+
348
+ - Review generated manifests before deploying
349
+ - Use proper namespacing strategies
350
+ - Implement resource quotas and limits
351
+ - Consider using GitOps workflows for deployment
352
+
353
+ For more advanced CDK8s usage patterns and examples, refer to the [official CDK8s documentation](https://cdk8s.io/).