projects-init-cli 2.0.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.
@@ -0,0 +1,388 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateNestJS = generateNestJS;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = __importDefault(require("path"));
9
+ async function generateNestJS(backendPath, config) {
10
+ const dependencies = {
11
+ '@nestjs/common': '^10.4.8',
12
+ '@nestjs/core': '^10.4.8',
13
+ '@nestjs/platform-express': '^10.4.8',
14
+ '@nestjs/testing': '^10.4.8',
15
+ 'reflect-metadata': '^0.2.2',
16
+ 'rxjs': '^7.8.1'
17
+ };
18
+ const devDependencies = {
19
+ '@nestjs/cli': '^10.4.5',
20
+ '@nestjs/schematics': '^10.1.1',
21
+ '@types/express': '^5.0.0',
22
+ '@types/node': '^22.7.5',
23
+ 'source-map-support': '^0.5.21',
24
+ 'ts-loader': '^9.5.1',
25
+ 'ts-node': '^10.9.2',
26
+ 'tsconfig-paths': '^4.2.0',
27
+ typescript: '^5.6.3'
28
+ };
29
+ // Add database dependencies
30
+ if (config.storage === 'local-sqlite') {
31
+ if (config.databaseType === 'sql' && config.sqlOption === 'prisma') {
32
+ dependencies['@prisma/client'] = '^6.0.1';
33
+ dependencies['prisma'] = '^6.0.1';
34
+ }
35
+ else if (config.databaseType === 'sql') {
36
+ dependencies['typeorm'] = '^0.3.20';
37
+ dependencies['better-sqlite3'] = '^11.7.0';
38
+ devDependencies['@types/better-sqlite3'] = '^7.6.9';
39
+ }
40
+ else if (config.databaseType === 'nosql' && config.nosqlOption === 'mongodb') {
41
+ dependencies['@nestjs/mongoose'] = '^10.1.0';
42
+ dependencies['mongoose'] = '^8.8.4';
43
+ }
44
+ else if (config.databaseType === 'nosql' && config.nosqlOption === 'dynamodb') {
45
+ dependencies['@aws-sdk/client-dynamodb'] = '^3.699.0';
46
+ dependencies['@aws-sdk/lib-dynamodb'] = '^3.699.0';
47
+ }
48
+ }
49
+ else if (config.storage === 'external-url') {
50
+ if (config.databaseType === 'sql' && config.sqlOption === 'prisma') {
51
+ dependencies['@prisma/client'] = '^6.0.1';
52
+ dependencies['prisma'] = '^6.0.1';
53
+ }
54
+ else if (config.databaseType === 'sql') {
55
+ dependencies['typeorm'] = '^0.3.20';
56
+ dependencies['pg'] = '^8.13.1';
57
+ devDependencies['@types/pg'] = '^8.11.10';
58
+ }
59
+ else if (config.databaseType === 'nosql' && config.nosqlOption === 'mongodb') {
60
+ dependencies['@nestjs/mongoose'] = '^10.1.0';
61
+ dependencies['mongoose'] = '^8.8.4';
62
+ }
63
+ else if (config.databaseType === 'nosql' && config.nosqlOption === 'dynamodb') {
64
+ dependencies['@aws-sdk/client-dynamodb'] = '^3.699.0';
65
+ dependencies['@aws-sdk/lib-dynamodb'] = '^3.699.0';
66
+ }
67
+ }
68
+ // Add API type dependencies
69
+ if (config.apiType === 'graphql') {
70
+ dependencies['@nestjs/graphql'] = '^12.1.0';
71
+ dependencies['@nestjs/apollo'] = '^12.1.0';
72
+ dependencies['apollo-server-express'] = '^3.12.1';
73
+ dependencies['graphql'] = '^16.9.0';
74
+ }
75
+ const packageJson = {
76
+ name: `${config.projectName}-backend`,
77
+ version: '1.0.0',
78
+ description: '',
79
+ author: '',
80
+ private: true,
81
+ license: 'MIT',
82
+ scripts: {
83
+ build: 'nest build',
84
+ format: 'prettier --write "src/**/*.ts" "test/**/*.ts"',
85
+ start: 'nest start',
86
+ 'start:dev': 'nest start --watch',
87
+ 'start:debug': 'nest start --debug --watch',
88
+ 'start:prod': 'node dist/main',
89
+ lint: 'eslint "{src,apps,libs,test}/**/*.ts" --fix',
90
+ test: 'vitest',
91
+ 'test:ui': 'vitest --ui',
92
+ 'test:coverage': 'vitest --coverage',
93
+ 'test:e2e': 'vitest --config vitest.e2e.config.ts'
94
+ },
95
+ dependencies,
96
+ devDependencies: {
97
+ ...devDependencies,
98
+ '@typescript-eslint/eslint-plugin': '^8.15.0',
99
+ '@typescript-eslint/parser': '^8.15.0',
100
+ eslint: '^9.15.0',
101
+ 'eslint-config-prettier': '^9.1.0',
102
+ 'eslint-plugin-prettier': '^6.0.0',
103
+ prettier: '^3.3.3',
104
+ 'vitest': '^2.1.3',
105
+ '@vitest/ui': '^2.1.3',
106
+ '@vitest/coverage-v8': '^2.1.3'
107
+ }
108
+ };
109
+ await fs_extra_1.default.writeJSON(path_1.default.join(backendPath, 'package.json'), packageJson, { spaces: 2 });
110
+ // Create nest-cli.json
111
+ const nestCli = {
112
+ '$schema': 'https://json.schemastore.org/nest-cli',
113
+ collection: '@nestjs/schematics',
114
+ sourceRoot: 'src',
115
+ compilerOptions: {
116
+ deleteOutDir: true
117
+ }
118
+ };
119
+ await fs_extra_1.default.writeJSON(path_1.default.join(backendPath, 'nest-cli.json'), nestCli, { spaces: 2 });
120
+ // Create tsconfig
121
+ const tsconfig = {
122
+ compilerOptions: {
123
+ module: 'commonjs',
124
+ declaration: true,
125
+ removeComments: true,
126
+ emitDecoratorMetadata: true,
127
+ experimentalDecorators: true,
128
+ allowSyntheticDefaultImports: true,
129
+ target: 'ES2021',
130
+ sourceMap: true,
131
+ outDir: './dist',
132
+ baseUrl: './',
133
+ incremental: true,
134
+ skipLibCheck: true,
135
+ strictNullChecks: false,
136
+ noImplicitAny: false,
137
+ strictBindCallApply: false,
138
+ forceConsistentCasingInFileNames: false,
139
+ noFallthroughCasesInSwitch: false
140
+ }
141
+ };
142
+ await fs_extra_1.default.writeJSON(path_1.default.join(backendPath, 'tsconfig.json'), tsconfig, { spaces: 2 });
143
+ // Create src directory structure
144
+ const srcPath = path_1.default.join(backendPath, 'src');
145
+ await fs_extra_1.default.ensureDir(srcPath);
146
+ // Create main.ts
147
+ let mainContent = `import { NestFactory } from '@nestjs/core';
148
+ import { AppModule } from './app.module';
149
+
150
+ async function bootstrap() {
151
+ const app = await NestFactory.create(AppModule);
152
+ app.enableCors();
153
+ await app.listen(process.env.PORT || 3001);
154
+ console.log(\`Application is running on: http://localhost:\${process.env.PORT || 3001}\`);
155
+ }
156
+ bootstrap();
157
+ `;
158
+ await fs_extra_1.default.writeFile(path_1.default.join(srcPath, 'main.ts'), mainContent);
159
+ // Create app.module.ts
160
+ let appModuleContent = `import { Module } from '@nestjs/common';
161
+ import { AppController } from './app.controller';
162
+ import { AppService } from './app.service';
163
+ `;
164
+ if (config.apiType === 'graphql') {
165
+ appModuleContent += `import { GraphQLModule } from '@nestjs/graphql';
166
+ import { ApolloDriver, ApolloDriverConfig } from '@nestjs/apollo';
167
+ import { join } from 'path';
168
+
169
+ `;
170
+ }
171
+ appModuleContent += `
172
+ @Module({
173
+ imports: [
174
+ `;
175
+ if (config.apiType === 'graphql') {
176
+ appModuleContent += ` GraphQLModule.forRoot<ApolloDriverConfig>({
177
+ driver: ApolloDriver,
178
+ autoSchemaFile: join(process.cwd(), 'src/schema.gql'),
179
+ sortSchema: true,
180
+ }),
181
+ `;
182
+ }
183
+ appModuleContent += ` ],
184
+ controllers: [AppController],
185
+ providers: [AppService],
186
+ })
187
+ export class AppModule {}
188
+ `;
189
+ await fs_extra_1.default.writeFile(path_1.default.join(srcPath, 'app.module.ts'), appModuleContent);
190
+ // Create app.controller.ts
191
+ const appController = `import { Controller, Get } from '@nestjs/common';
192
+ import { AppService } from './app.service';
193
+
194
+ @Controller()
195
+ export class AppController {
196
+ constructor(private readonly appService: AppService) {}
197
+
198
+ @Get()
199
+ getHello(): string {
200
+ return this.appService.getHello();
201
+ }
202
+
203
+ @Get('health')
204
+ getHealth() {
205
+ return { status: 'ok', message: 'Server is running' };
206
+ }
207
+ }
208
+ `;
209
+ await fs_extra_1.default.writeFile(path_1.default.join(srcPath, 'app.controller.ts'), appController);
210
+ // Create app.service.ts
211
+ const appService = `import { Injectable } from '@nestjs/common';
212
+
213
+ @Injectable()
214
+ export class AppService {
215
+ getHello(): string {
216
+ return 'Hello World!';
217
+ }
218
+ }
219
+ `;
220
+ await fs_extra_1.default.writeFile(path_1.default.join(srcPath, 'app.service.ts'), appService);
221
+ // Create .env.example
222
+ let envExample = `PORT=3001
223
+ `;
224
+ if (config.storage === 'external-url' && config.databaseUrl) {
225
+ envExample += `DATABASE_URL=${config.databaseUrl}\n`;
226
+ }
227
+ await fs_extra_1.default.writeFile(path_1.default.join(backendPath, '.env.example'), envExample);
228
+ // Create Vitest config
229
+ const vitestConfig = `import { defineConfig } from 'vitest/config'
230
+ import path from 'path'
231
+
232
+ export default defineConfig({
233
+ test: {
234
+ globals: true,
235
+ environment: 'node',
236
+ coverage: {
237
+ provider: 'v8',
238
+ reporter: ['text', 'json', 'html'],
239
+ },
240
+ },
241
+ resolve: {
242
+ alias: {
243
+ '@': path.resolve(__dirname, './src'),
244
+ },
245
+ },
246
+ })
247
+ `;
248
+ await fs_extra_1.default.writeFile(path_1.default.join(backendPath, 'vitest.config.ts'), vitestConfig);
249
+ // Create test files
250
+ const testPath = path_1.default.join(srcPath, '__tests__');
251
+ await fs_extra_1.default.ensureDir(testPath);
252
+ const appControllerTest = `import { describe, it, expect, beforeEach } from 'vitest'
253
+ import { Test, TestingModule } from '@nestjs/testing'
254
+ import { AppController } from '../app.controller'
255
+ import { AppService } from '../app.service'
256
+
257
+ describe('AppController', () => {
258
+ let appController: AppController
259
+ let appService: AppService
260
+
261
+ beforeEach(async () => {
262
+ const moduleRef: TestingModule = await Test.createTestingModule({
263
+ controllers: [AppController],
264
+ providers: [AppService],
265
+ }).compile()
266
+
267
+ appService = moduleRef.get<AppService>(AppService)
268
+ appController = moduleRef.get<AppController>(AppController)
269
+ })
270
+
271
+ it('should return "Hello World!"', () => {
272
+ expect(appController.getHello()).toBe('Hello World!')
273
+ })
274
+
275
+ it('should return health check', () => {
276
+ const result = appController.getHealth()
277
+ expect(result.status).toBe('ok')
278
+ })
279
+ })
280
+ `;
281
+ await fs_extra_1.default.writeFile(path_1.default.join(testPath, 'app.controller.spec.ts'), appControllerTest);
282
+ const appServiceTest = `import { describe, it, expect } from 'vitest'
283
+ import { AppService } from '../app.service'
284
+
285
+ describe('AppService', () => {
286
+ it('should return "Hello World!"', () => {
287
+ const appService = new AppService()
288
+ expect(appService.getHello()).toBe('Hello World!')
289
+ })
290
+ })
291
+ `;
292
+ await fs_extra_1.default.writeFile(path_1.default.join(testPath, 'app.service.spec.ts'), appServiceTest);
293
+ // Create database setup if needed
294
+ if (config.databaseType === 'sql' && config.sqlOption === 'prisma') {
295
+ await generatePrismaConfig(backendPath, config);
296
+ }
297
+ else if (config.databaseType === 'nosql' && config.nosqlOption === 'mongodb') {
298
+ await generateMongoDBModule(srcPath, config);
299
+ }
300
+ // Create deployment files
301
+ await generateBackendDeployment(backendPath, config);
302
+ }
303
+ async function generatePrismaConfig(backendPath, config) {
304
+ const prismaPath = path_1.default.join(backendPath, 'prisma');
305
+ await fs_extra_1.default.ensureDir(prismaPath);
306
+ let datasource = '';
307
+ if (config.storage === 'local-sqlite') {
308
+ datasource = `datasource db {
309
+ provider = "sqlite"
310
+ url = "file:./dev.db"
311
+ }`;
312
+ }
313
+ else if (config.storage === 'external-url') {
314
+ datasource = `datasource db {
315
+ provider = "postgresql"
316
+ url = env("DATABASE_URL")
317
+ }`;
318
+ }
319
+ const schema = `${datasource}
320
+
321
+ generator client {
322
+ provider = "prisma-client-js"
323
+ }
324
+
325
+ model User {
326
+ id Int @id @default(autoincrement())
327
+ email String @unique
328
+ name String?
329
+ createdAt DateTime @default(now())
330
+ updatedAt DateTime @updatedAt
331
+ }
332
+ `;
333
+ await fs_extra_1.default.writeFile(path_1.default.join(prismaPath, 'schema.prisma'), schema);
334
+ }
335
+ async function generateMongoDBModule(srcPath, config) {
336
+ const dbContent = `import { Module } from '@nestjs/common';
337
+ import { MongooseModule } from '@nestjs/mongoose';
338
+ import { User, UserSchema } from './schemas/user.schema';
339
+
340
+ @Module({
341
+ imports: [
342
+ MongooseModule.forRoot(process.env.DATABASE_URL || 'mongodb://localhost:27017/${config.projectName}'),
343
+ MongooseModule.forFeature([{ name: User.name, schema: UserSchema }]),
344
+ ],
345
+ exports: [MongooseModule],
346
+ })
347
+ export class DatabaseModule {}
348
+ `;
349
+ await fs_extra_1.default.writeFile(path_1.default.join(srcPath, 'database.module.ts'), dbContent);
350
+ const schemasPath = path_1.default.join(srcPath, 'schemas');
351
+ await fs_extra_1.default.ensureDir(schemasPath);
352
+ const userSchema = `import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
353
+ import { Document } from 'mongoose';
354
+
355
+ export type UserDocument = User & Document;
356
+
357
+ @Schema()
358
+ export class User {
359
+ @Prop({ required: true, unique: true })
360
+ email: string;
361
+
362
+ @Prop()
363
+ name: string;
364
+
365
+ @Prop({ default: Date.now })
366
+ createdAt: Date;
367
+ }
368
+
369
+ export const UserSchema = SchemaFactory.createForClass(User);
370
+ `;
371
+ await fs_extra_1.default.writeFile(path_1.default.join(schemasPath, 'user.schema.ts'), userSchema);
372
+ }
373
+ async function generateBackendDeployment(backendPath, config) {
374
+ // Render configuration
375
+ const renderYaml = `services:
376
+ - type: web
377
+ name: ${config.projectName}-backend
378
+ env: node
379
+ buildCommand: npm install && npm run build
380
+ startCommand: npm run start:prod
381
+ envVars:
382
+ - key: NODE_ENV
383
+ value: production
384
+ - key: PORT
385
+ value: 3001
386
+ `;
387
+ await fs_extra_1.default.writeFile(path_1.default.join(backendPath, 'render.yaml'), renderYaml);
388
+ }
@@ -0,0 +1,258 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.generateSAM = generateSAM;
7
+ const fs_extra_1 = __importDefault(require("fs-extra"));
8
+ const path_1 = __importDefault(require("path"));
9
+ async function generateSAM(backendPath, config) {
10
+ // Create root package.json with SAM scripts
11
+ const rootPackageJson = {
12
+ name: `${config.projectName}-backend`,
13
+ version: '1.0.0',
14
+ private: true,
15
+ scripts: {
16
+ 'build': 'sam build',
17
+ 'deploy': 'sam deploy',
18
+ 'deploy:guided': 'sam deploy --guided',
19
+ 'local': 'sam local start-api',
20
+ 'validate': 'sam validate',
21
+ 'synth': 'sam build && sam deploy --no-execute'
22
+ },
23
+ devDependencies: {}
24
+ };
25
+ await fs_extra_1.default.writeJSON(path_1.default.join(backendPath, 'package.json'), rootPackageJson, { spaces: 2 });
26
+ // Create template.yaml
27
+ let templateContent = `AWSTemplateFormatVersion: '2010-09-09'
28
+ Transform: AWS::Serverless-2016-10-31
29
+ Description: >
30
+ ${config.projectName}
31
+ SAM Template for ${config.projectName}
32
+
33
+ Globals:
34
+ Function:
35
+ Timeout: 3
36
+ MemorySize: 128
37
+
38
+ Resources:
39
+ HelloWorldFunction:
40
+ Type: AWS::Serverless::Function
41
+ Properties:
42
+ CodeUri: hello-world/
43
+ Handler: app.lambdaHandler
44
+ Runtime: nodejs18.x
45
+ Architectures:
46
+ - x86_64
47
+ Events:
48
+ HelloWorld:
49
+ Type: Api
50
+ Properties:
51
+ Path: /hello
52
+ Method: get
53
+ HelloWorldPost:
54
+ Type: Api
55
+ Properties:
56
+ Path: /hello
57
+ Method: post
58
+
59
+ `;
60
+ if (config.databaseType === 'nosql') {
61
+ templateContent += ` DynamoDBTable:
62
+ Type: AWS::DynamoDB::Table
63
+ Properties:
64
+ TableName: ${config.projectName}Table
65
+ BillingMode: PAY_PER_REQUEST
66
+ AttributeDefinitions:
67
+ - AttributeName: id
68
+ AttributeType: S
69
+ KeySchema:
70
+ - AttributeName: id
71
+ KeyType: HASH
72
+
73
+ `;
74
+ }
75
+ else if (config.databaseType === 'sql') {
76
+ templateContent += ` # Note: RDS requires VPC configuration
77
+ # You'll need to add VPC, Subnets, and Security Groups manually
78
+ # or use AWS RDS Proxy for serverless access
79
+
80
+ `;
81
+ }
82
+ templateContent += `Outputs:
83
+ HelloWorldApi:
84
+ Description: "API Gateway endpoint URL for Prod stage for Hello World function"
85
+ Value: !Sub "https://\${ServerlessRestApi}.execute-api.\${AWS::Region}.amazonaws.com/Prod/hello/"
86
+ HelloWorldFunction:
87
+ Description: "Hello World Lambda Function ARN"
88
+ Value: !GetAtt HelloWorldFunction.Arn
89
+ HelloWorldFunctionIamRole:
90
+ Description: "Implicit IAM Role created for Hello World function"
91
+ Value: !GetAtt HelloWorldFunctionRole.Arn
92
+ `;
93
+ await fs_extra_1.default.writeFile(path_1.default.join(backendPath, 'template.yaml'), templateContent);
94
+ // Create hello-world function
95
+ const helloWorldPath = path_1.default.join(backendPath, 'hello-world');
96
+ await fs_extra_1.default.ensureDir(helloWorldPath);
97
+ const packageJson = {
98
+ name: 'hello-world',
99
+ version: '1.0.0',
100
+ description: 'Hello World SAM Lambda function',
101
+ main: 'app.js',
102
+ scripts: {
103
+ test: 'node tests/unit/test-handler.js'
104
+ },
105
+ dependencies: {}
106
+ };
107
+ if (config.databaseType === 'nosql') {
108
+ packageJson.dependencies = {
109
+ '@aws-sdk/client-dynamodb': '^3.699.0',
110
+ '@aws-sdk/lib-dynamodb': '^3.699.0'
111
+ };
112
+ }
113
+ await fs_extra_1.default.writeJSON(path_1.default.join(helloWorldPath, 'package.json'), packageJson, { spaces: 2 });
114
+ let appJs = `exports.lambdaHandler = async (event) => {
115
+ try {
116
+ const response = {
117
+ statusCode: 200,
118
+ body: JSON.stringify({
119
+ message: 'Hello from ${config.projectName}!',
120
+ input: event,
121
+ }),
122
+ };
123
+ return response;
124
+ } catch (err) {
125
+ console.log(err);
126
+ return err;
127
+ }
128
+ };
129
+ `;
130
+ if (config.databaseType === 'nosql') {
131
+ appJs = `const { DynamoDBClient } = require('@aws-sdk/client-dynamodb');
132
+ const { DynamoDBDocumentClient, PutCommand, GetCommand } = require('@aws-sdk/lib-dynamodb');
133
+
134
+ const client = new DynamoDBClient({});
135
+ const docClient = DynamoDBDocumentClient.from(client);
136
+
137
+ const TABLE_NAME = process.env.TABLE_NAME || '${config.projectName}Table';
138
+
139
+ exports.lambdaHandler = async (event) => {
140
+ try {
141
+ const response = {
142
+ statusCode: 200,
143
+ body: JSON.stringify({
144
+ message: 'Hello from ${config.projectName}!',
145
+ input: event,
146
+ }),
147
+ };
148
+ return response;
149
+ } catch (err) {
150
+ console.log(err);
151
+ return {
152
+ statusCode: 500,
153
+ body: JSON.stringify({ error: err.message }),
154
+ };
155
+ }
156
+ };
157
+ `;
158
+ }
159
+ await fs_extra_1.default.writeFile(path_1.default.join(helloWorldPath, 'app.js'), appJs);
160
+ // Create test directory and test file
161
+ const testsPath = path_1.default.join(helloWorldPath, 'tests', 'unit');
162
+ await fs_extra_1.default.ensureDir(testsPath);
163
+ const testFile = `import { describe, it, expect } from 'vitest';
164
+ const app = require('../../app');
165
+
166
+ describe('Tests index', () => {
167
+ it('verifies successful response', async () => {
168
+ const event = {
169
+ httpMethod: 'GET',
170
+ path: '/hello'
171
+ };
172
+ const context = {};
173
+
174
+ const result = await app.lambdaHandler(event, context);
175
+
176
+ expect(result).toBeDefined();
177
+ expect(result.statusCode).toBe(200);
178
+
179
+ const response = JSON.parse(result.body);
180
+ expect(response.message).toBeDefined();
181
+ });
182
+ });
183
+ `;
184
+ await fs_extra_1.default.writeFile(path_1.default.join(testsPath, 'test-handler.js'), testFile);
185
+ // Create package.json for tests
186
+ const testPackageJson = {
187
+ name: 'hello-world-tests',
188
+ version: '1.0.0',
189
+ scripts: {
190
+ test: 'vitest',
191
+ 'test:ui': 'vitest --ui',
192
+ 'test:coverage': 'vitest --coverage'
193
+ },
194
+ dependencies: {
195
+ 'aws-sdk': '^2.814.0'
196
+ },
197
+ devDependencies: {
198
+ 'vitest': '^2.1.3',
199
+ '@vitest/ui': '^2.1.3',
200
+ '@vitest/coverage-v8': '^2.1.3'
201
+ }
202
+ };
203
+ await fs_extra_1.default.writeJSON(path_1.default.join(testsPath, 'package.json'), testPackageJson, { spaces: 2 });
204
+ // Create samconfig.toml
205
+ const samConfig = `version = 0.1
206
+
207
+ [default]
208
+ [default.global.parameters]
209
+ stack_name = "${config.projectName}"
210
+
211
+ [default.build.parameters]
212
+ cached = true
213
+ parallel = true
214
+
215
+ [default.validate.parameters]
216
+ lint = true
217
+
218
+ [default.deploy.parameters]
219
+ capabilities = "CAPABILITY_IAM"
220
+ confirm_changeset = true
221
+ resolve_s3 = true
222
+ region = "us-east-1"
223
+ `;
224
+ await fs_extra_1.default.writeFile(path_1.default.join(backendPath, 'samconfig.toml'), samConfig);
225
+ // Create README
226
+ const readme = `# AWS SAM Backend
227
+
228
+ This is an AWS SAM project for serverless deployment.
229
+
230
+ ## Prerequisites
231
+
232
+ - AWS CLI configured
233
+ - SAM CLI installed (\`pip install aws-sam-cli\`)
234
+
235
+ ## Build and Deploy
236
+
237
+ \`\`\`bash
238
+ npm run build
239
+ npm run deploy:guided
240
+ \`\`\`
241
+
242
+ ## Local Development
243
+
244
+ \`\`\`bash
245
+ npm run local
246
+ \`\`\`
247
+
248
+ ## Useful Commands
249
+
250
+ - \`npm run build\` - Build your application
251
+ - \`npm run local\` - Start local API Gateway
252
+ - \`npm run deploy:guided\` - Deploy your application with guided prompts
253
+ - \`npm run deploy\` - Deploy your application
254
+ - \`npm run validate\` - Validate SAM template
255
+ - \`sam logs -n HelloWorldFunction --stack-name ${config.projectName} --tail\` - View logs
256
+ `;
257
+ await fs_extra_1.default.writeFile(path_1.default.join(backendPath, 'README.md'), readme);
258
+ }