@idealyst/cli 1.0.37 → 1.0.39

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 (60) hide show
  1. package/dist/docs/LLM-CLI-QUICK-REFERENCE.md +123 -0
  2. package/dist/docs/LLM-CLI-REFERENCE.md +514 -0
  3. package/dist/generators/api.js +3 -4
  4. package/dist/generators/api.js.map +1 -1
  5. package/dist/generators/database.js +32 -0
  6. package/dist/generators/database.js.map +1 -0
  7. package/dist/generators/index.js +5 -0
  8. package/dist/generators/index.js.map +1 -1
  9. package/dist/generators/utils.js +2 -1
  10. package/dist/generators/utils.js.map +1 -1
  11. package/dist/index.js +297 -2
  12. package/dist/index.js.map +1 -1
  13. package/dist/templates/api/.env.example +6 -0
  14. package/dist/templates/api/README.md +25 -35
  15. package/dist/templates/api/package.json +0 -8
  16. package/dist/templates/api/src/context.ts +4 -8
  17. package/dist/templates/database/.env.example +8 -0
  18. package/dist/templates/database/README.md +93 -0
  19. package/dist/templates/database/__tests__/database.test.ts +14 -0
  20. package/dist/templates/database/jest.config.js +19 -0
  21. package/dist/templates/database/jest.setup.js +11 -0
  22. package/dist/templates/database/package.json +61 -0
  23. package/dist/templates/{api → database}/prisma/schema.prisma +1 -1
  24. package/dist/templates/database/prisma/seed.ts +28 -0
  25. package/dist/templates/database/src/client.ts +18 -0
  26. package/dist/templates/database/src/index.ts +11 -0
  27. package/dist/templates/database/src/schemas.ts +26 -0
  28. package/dist/templates/database/tsconfig.json +32 -0
  29. package/dist/templates/workspace/.devcontainer/README.md +0 -0
  30. package/dist/templates/workspace/.devcontainer/fix-permissions.sh +0 -0
  31. package/dist/templates/workspace/.devcontainer/post-create.sh +0 -89
  32. package/dist/types/generators/database.d.ts +2 -0
  33. package/dist/types/generators/index.d.ts +1 -0
  34. package/dist/types/types.d.ts +1 -1
  35. package/docs/LLM-CLI-QUICK-REFERENCE.md +123 -0
  36. package/docs/LLM-CLI-REFERENCE.md +514 -0
  37. package/package.json +10 -4
  38. package/templates/api/.env.example +6 -0
  39. package/templates/api/README.md +25 -35
  40. package/templates/api/package.json +0 -8
  41. package/templates/api/src/context.ts +4 -8
  42. package/templates/database/.env.example +8 -0
  43. package/templates/database/README.md +93 -0
  44. package/templates/database/__tests__/database.test.ts +14 -0
  45. package/templates/database/jest.config.js +19 -0
  46. package/templates/database/jest.setup.js +11 -0
  47. package/templates/database/package.json +61 -0
  48. package/templates/{api → database}/prisma/schema.prisma +1 -1
  49. package/templates/database/prisma/seed.ts +28 -0
  50. package/templates/database/src/client.ts +18 -0
  51. package/templates/database/src/index.ts +11 -0
  52. package/templates/database/src/schemas.ts +26 -0
  53. package/templates/database/tsconfig.json +32 -0
  54. package/templates/workspace/.devcontainer/README.md +0 -0
  55. package/templates/workspace/.devcontainer/fix-permissions.sh +0 -0
  56. package/templates/workspace/.devcontainer/post-create.sh +0 -0
  57. package/dist/templates/api/env.example +0 -12
  58. package/dist/templates/workspace/.env.production +0 -56
  59. package/dist/templates/workspace/scripts/docker-build.sh +0 -151
  60. package/templates/api/env.example +0 -12
@@ -4,7 +4,6 @@
4
4
 
5
5
  This API project is built with:
6
6
  - **tRPC** - End-to-end typesafe APIs
7
- - **Prisma** - Modern database toolkit
8
7
  - **Zod** - TypeScript-first schema validation
9
8
  - **Express.js** - Web framework for Node.js
10
9
  - **TypeScript** - Type-safe JavaScript
@@ -13,7 +12,7 @@ This API project is built with:
13
12
 
14
13
  1. **Setup environment variables:**
15
14
  ```bash
16
- cp env.example .env
15
+ cp .env.example .env
17
16
  ```
18
17
 
19
18
  2. **Install dependencies:**
@@ -21,19 +20,7 @@ This API project is built with:
21
20
  yarn install
22
21
  ```
23
22
 
24
- 3. **Setup database:**
25
- ```bash
26
- # Generate Prisma client
27
- yarn db:generate
28
-
29
- # Push schema to database (for development)
30
- yarn db:push
31
-
32
- # Or run migrations (for production)
33
- yarn db:migrate
34
- ```
35
-
36
- 4. **Start development server:**
23
+ 3. **Start development server:**
37
24
  ```bash
38
25
  yarn dev
39
26
  ```
@@ -45,11 +32,6 @@ The API will be available at `http://localhost:3000`
45
32
  - `yarn dev` - Start development server with hot reload
46
33
  - `yarn build` - Build for production
47
34
  - `yarn start` - Start production server
48
- - `yarn db:generate` - Generate Prisma client
49
- - `yarn db:push` - Push schema changes to database
50
- - `yarn db:studio` - Open Prisma Studio (database GUI)
51
- - `yarn db:migrate` - Run database migrations
52
- - `yarn db:reset` - Reset database and run all migrations
53
35
  - `yarn lint` - Run ESLint
54
36
  - `yarn type-check` - Run TypeScript type checking
55
37
 
@@ -67,13 +49,21 @@ All tRPC routes are available at `/trpc/[procedure]`
67
49
  - `GET /` - API information
68
50
  - `GET /health` - Health check
69
51
 
70
- ## Database
52
+ ## Connecting to a Database
71
53
 
72
- This project uses SQLite by default for development. You can switch to PostgreSQL or MySQL by updating the `DATABASE_URL` in your `.env` file and the `provider` in `prisma/schema.prisma`.
54
+ For database functionality, create a separate database package using:
55
+ ```bash
56
+ idealyst create my-database --type database
57
+ ```
73
58
 
74
- ### Database Schema
59
+ Then import and use it in your API:
60
+ ```typescript
61
+ // In your API context or controllers
62
+ import { db } from '@your-org/my-database';
75
63
 
76
- The schema starts empty - you can add your own models in `prisma/schema.prisma`. Example model structure is provided in comments.
64
+ // Use the database client
65
+ const users = await db.user.findMany();
66
+ ```
77
67
 
78
68
  ## Development
79
69
 
@@ -107,9 +97,11 @@ export class PostController extends BaseController {
107
97
  getAll = this.createQuery(
108
98
  z.object({ published: z.boolean().optional() }),
109
99
  async (input, ctx) => {
110
- return ctx.prisma.post.findMany({
111
- where: { published: input.published }
112
- });
100
+ // Mock data - replace with your database calls
101
+ return [
102
+ { id: '1', title: 'Post 1', content: 'Content 1', published: true },
103
+ { id: '2', title: 'Post 2', content: 'Content 2', published: false },
104
+ ];
113
105
  }
114
106
  );
115
107
 
@@ -118,7 +110,8 @@ export class PostController extends BaseController {
118
110
  createPostSchema,
119
111
  [logger, rateLimit(5, 60000), requireAuth],
120
112
  async (input, ctx) => {
121
- return ctx.prisma.post.create({ data: input });
113
+ // Mock creation - replace with your database calls
114
+ return { id: '3', ...input, published: false };
122
115
  }
123
116
  );
124
117
 
@@ -127,7 +120,8 @@ export class PostController extends BaseController {
127
120
  z.object({ id: z.string() }),
128
121
  [requireAuth, requireAdmin],
129
122
  async (input, ctx) => {
130
- return ctx.prisma.post.delete({ where: { id: input.id } });
123
+ // Mock deletion - replace with your database calls
124
+ return { success: true, deletedId: input.id };
131
125
  }
132
126
  );
133
127
  }
@@ -185,9 +179,8 @@ const healthStatus = await client.health.query();
185
179
 
186
180
  ## Environment Variables
187
181
 
188
- Copy `env.example` to `.env` and configure:
182
+ Copy `.env.example` to `.env` and configure:
189
183
 
190
- - `DATABASE_URL` - Database connection string
191
184
  - `PORT` - Server port (default: 3000)
192
185
  - `NODE_ENV` - Environment (development/production)
193
186
  - `CORS_ORIGIN` - CORS origin for client requests
@@ -195,13 +188,10 @@ Copy `env.example` to `.env` and configure:
195
188
  ## Deployment
196
189
 
197
190
  1. Build the project: `yarn build`
198
- 2. Set up your production database
199
- 3. Run migrations: `yarn db:migrate`
200
- 4. Start the server: `yarn start`
191
+ 2. Start the server: `yarn start`
201
192
 
202
193
  ## Learn More
203
194
 
204
195
  - [tRPC Documentation](https://trpc.io/)
205
- - [Prisma Documentation](https://www.prisma.io/docs/)
206
196
  - [Zod Documentation](https://zod.dev/)
207
197
  - [Express.js Documentation](https://expressjs.com/)
@@ -18,17 +18,11 @@
18
18
  "test": "jest",
19
19
  "test:watch": "jest --watch",
20
20
  "test:coverage": "jest --coverage",
21
- "db:generate": "prisma generate",
22
- "db:push": "prisma db push",
23
- "db:studio": "prisma studio",
24
- "db:migrate": "prisma migrate dev",
25
- "db:reset": "prisma migrate reset",
26
21
  "lint": "eslint src --ext .ts,.tsx",
27
22
  "lint:fix": "eslint src --ext .ts,.tsx --fix",
28
23
  "type-check": "tsc --noEmit"
29
24
  },
30
25
  "dependencies": {
31
- "@prisma/client": "^5.7.1",
32
26
  "@trpc/server": "^10.44.1",
33
27
  "cors": "^2.8.5",
34
28
  "dotenv": "^16.3.1",
@@ -44,7 +38,6 @@
44
38
  "@typescript-eslint/parser": "^6.13.1",
45
39
  "eslint": "^8.54.0",
46
40
  "jest": "^29.7.0",
47
- "prisma": "^5.7.1",
48
41
  "ts-jest": "^29.1.2",
49
42
  "tsx": "^4.6.2",
50
43
  "typescript": "^5.3.3"
@@ -52,7 +45,6 @@
52
45
  "keywords": [
53
46
  "api",
54
47
  "trpc",
55
- "prisma",
56
48
  "zod",
57
49
  "typescript",
58
50
  "express"
@@ -1,22 +1,18 @@
1
- import { PrismaClient } from '@prisma/client';
2
1
  import type { CreateExpressContextOptions } from '@trpc/server/adapters/express';
3
2
 
4
- // Create Prisma client
5
- const prisma = new PrismaClient({
6
- log: process.env.NODE_ENV === 'development' ? ['query', 'error', 'warn'] : ['error'],
7
- });
8
-
9
3
  export interface Context {
10
- prisma: PrismaClient;
11
4
  req: CreateExpressContextOptions['req'];
12
5
  res: CreateExpressContextOptions['res'];
6
+ // Add your dependencies here (e.g., database client, external services)
7
+ // Example: db: PrismaClient;
13
8
  }
14
9
 
15
10
  export const createContext = ({ req, res }: CreateExpressContextOptions): Context => {
16
11
  return {
17
- prisma,
18
12
  req,
19
13
  res,
14
+ // Initialize your dependencies here
15
+ // Example: db: prisma,
20
16
  };
21
17
  };
22
18
 
@@ -0,0 +1,8 @@
1
+ # Database
2
+ DATABASE_URL="file:./dev.db"
3
+
4
+ # Optional: PostgreSQL example
5
+ # DATABASE_URL="postgresql://username:password@localhost:5432/mydb?schema=public"
6
+
7
+ # Optional: MySQL example
8
+ # DATABASE_URL="mysql://username:password@localhost:3306/mydb"
@@ -0,0 +1,93 @@
1
+ # {{projectName}}
2
+
3
+ {{description}}
4
+
5
+ A database layer built with Prisma and TypeScript, designed to be shared across multiple applications in your monorepo.
6
+
7
+ ## Features
8
+
9
+ - 🗄️ **Prisma ORM** - Type-safe database access
10
+ - 📝 **Zod Schemas** - Runtime validation matching your database models
11
+ - 📦 **Exportable Client** - Share database access across packages
12
+ - 🔒 **TypeScript** - Full type safety
13
+ - 🧪 **Testing Setup** - Jest configuration for database testing
14
+ - 🔄 **Migration Scripts** - Database versioning and seeding
15
+
16
+ ## Getting Started
17
+
18
+ 1. **Environment Setup**
19
+ ```bash
20
+ cp .env.example .env
21
+ # Edit .env with your database URL
22
+ ```
23
+
24
+ 2. **Generate Prisma Client**
25
+ ```bash
26
+ yarn db:generate
27
+ ```
28
+
29
+ 3. **Push Schema to Database**
30
+ ```bash
31
+ yarn db:push
32
+ ```
33
+
34
+ 4. **Open Prisma Studio** (Optional)
35
+ ```bash
36
+ yarn db:studio
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ### In Other Packages
42
+
43
+ ```typescript
44
+ import { db, schemas } from '@your-org/{{projectName}}';
45
+
46
+ // Use the database client
47
+ const users = await db.user.findMany();
48
+
49
+ // Use Zod schemas for validation
50
+ const userData = schemas.createUser.parse(input);
51
+ ```
52
+
53
+ ### Adding Models
54
+
55
+ 1. Update `prisma/schema.prisma` with your models
56
+ 2. Update `src/schemas.ts` with corresponding Zod schemas
57
+ 3. Run `yarn db:generate` to update the client
58
+ 4. Run `yarn db:push` to update the database
59
+
60
+ ## Scripts
61
+
62
+ - `yarn build` - Build the package for distribution
63
+ - `yarn dev` - Run in development mode with file watching
64
+ - `yarn test` - Run tests
65
+ - `yarn test:watch` - Run tests in watch mode
66
+ - `yarn db:generate` - Generate Prisma client
67
+ - `yarn db:push` - Push schema changes to database
68
+ - `yarn db:studio` - Open Prisma Studio
69
+ - `yarn db:migrate` - Create and apply migrations
70
+ - `yarn db:reset` - Reset database and apply migrations
71
+ - `yarn db:seed` - Seed the database
72
+
73
+ ## Project Structure
74
+
75
+ ```
76
+ src/
77
+ ├── index.ts # Main exports
78
+ ├── client.ts # Prisma client setup
79
+ └── schemas.ts # Zod validation schemas
80
+ prisma/
81
+ ├── schema.prisma # Database schema
82
+ └── migrations/ # Database migrations
83
+ __tests__/
84
+ └── database.test.ts # Database tests
85
+ ```
86
+
87
+ ## Best Practices
88
+
89
+ - Always update Zod schemas when changing Prisma models
90
+ - Use meaningful migration names
91
+ - Test database operations
92
+ - Export only what's needed from the main index
93
+ - Keep the client singleton pattern for performance
@@ -0,0 +1,14 @@
1
+ import { describe, it, expect } from '@jest/globals';
2
+ import { db } from '../src';
3
+
4
+ describe('Database', () => {
5
+ it('should export database client', () => {
6
+ expect(db).toBeDefined();
7
+ });
8
+
9
+ it('should connect to database', async () => {
10
+ // This is a basic connection test
11
+ // Add your own model-specific tests here
12
+ expect(db.$connect).toBeDefined();
13
+ });
14
+ });
@@ -0,0 +1,19 @@
1
+ module.exports = {
2
+ preset: 'ts-jest',
3
+ testEnvironment: 'node',
4
+ collectCoverageFrom: [
5
+ 'src/**/*.{ts,tsx}',
6
+ '!src/**/*.d.ts',
7
+ ],
8
+ testMatch: [
9
+ '**/__tests__/**/*.test.{ts,tsx}',
10
+ ],
11
+ setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
12
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
13
+ transform: {
14
+ '^.+\\.(ts|tsx)$': 'ts-jest',
15
+ },
16
+ moduleNameMapping: {
17
+ '^@/(.*)$': '<rootDir>/src/$1',
18
+ },
19
+ };
@@ -0,0 +1,11 @@
1
+ // Global test setup
2
+ import { beforeEach, afterEach } from '@jest/globals';
3
+
4
+ // Mock environment variables for testing
5
+ process.env.NODE_ENV = 'test';
6
+ process.env.DATABASE_URL = 'file:./test.db';
7
+
8
+ // Clean up after each test
9
+ afterEach(async () => {
10
+ // Add any cleanup logic here
11
+ });
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "{{packageName}}",
3
+ "version": "{{version}}",
4
+ "description": "{{description}}",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./client": {
14
+ "types": "./dist/client.d.ts",
15
+ "import": "./dist/client.js"
16
+ },
17
+ "./schemas": {
18
+ "types": "./dist/schemas.d.ts",
19
+ "import": "./dist/schemas.js"
20
+ }
21
+ },
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "test": "jest",
25
+ "test:watch": "jest --watch",
26
+ "test:coverage": "jest --coverage",
27
+ "db:generate": "prisma generate",
28
+ "db:push": "prisma db push",
29
+ "db:studio": "prisma studio",
30
+ "db:migrate": "prisma migrate dev",
31
+ "db:reset": "prisma migrate reset",
32
+ "db:seed": "tsx prisma/seed.ts",
33
+ "lint": "eslint src --ext .ts,.tsx",
34
+ "lint:fix": "eslint src --ext .ts,.tsx --fix",
35
+ "type-check": "tsc --noEmit",
36
+ "dev": "tsx watch src/index.ts"
37
+ },
38
+ "dependencies": {
39
+ "@prisma/client": "^5.7.1",
40
+ "zod": "^3.22.4"
41
+ },
42
+ "devDependencies": {
43
+ "@types/jest": "^29.5.12",
44
+ "@types/node": "^20.10.4",
45
+ "@typescript-eslint/eslint-plugin": "^6.13.1",
46
+ "@typescript-eslint/parser": "^6.13.1",
47
+ "dotenv": "^16.3.1",
48
+ "eslint": "^8.54.0",
49
+ "jest": "^29.7.0",
50
+ "prisma": "^5.7.1",
51
+ "ts-jest": "^29.1.2",
52
+ "tsx": "^4.6.2",
53
+ "typescript": "^5.3.3"
54
+ },
55
+ "keywords": [
56
+ "database",
57
+ "prisma",
58
+ "typescript",
59
+ "orm"
60
+ ]
61
+ }
@@ -18,4 +18,4 @@ datasource db {
18
18
  // name String?
19
19
  // createdAt DateTime @default(now())
20
20
  // updatedAt DateTime @updatedAt
21
- // }
21
+ // }
@@ -0,0 +1,28 @@
1
+ import { PrismaClient } from '@prisma/client';
2
+
3
+ const prisma = new PrismaClient();
4
+
5
+ async function main() {
6
+ console.log('🌱 Seeding database...');
7
+
8
+ // Add your seed data here
9
+ // Example:
10
+ // const user = await prisma.user.create({
11
+ // data: {
12
+ // email: 'admin@example.com',
13
+ // name: 'Admin User',
14
+ // },
15
+ // });
16
+ // console.log('Created user:', user);
17
+
18
+ console.log('✅ Database seeded successfully!');
19
+ }
20
+
21
+ main()
22
+ .catch((e) => {
23
+ console.error('❌ Error seeding database:', e);
24
+ process.exit(1);
25
+ })
26
+ .finally(async () => {
27
+ await prisma.$disconnect();
28
+ });
@@ -0,0 +1,18 @@
1
+ import { PrismaClient } from '@prisma/client';
2
+
3
+ declare global {
4
+ // Prevent multiple instances of Prisma Client in development
5
+ var __globalPrisma: PrismaClient | undefined;
6
+ }
7
+
8
+ const prisma =
9
+ globalThis.__globalPrisma ??
10
+ new PrismaClient({
11
+ log: ['query', 'error', 'warn'],
12
+ });
13
+
14
+ if (process.env.NODE_ENV !== 'production') {
15
+ globalThis.__globalPrisma = prisma;
16
+ }
17
+
18
+ export default prisma;
@@ -0,0 +1,11 @@
1
+ // Export Prisma client
2
+ export { PrismaClient } from '@prisma/client';
3
+
4
+ // Export database client instance
5
+ export { default as db } from './client';
6
+
7
+ // Export Zod schemas
8
+ export * from './schemas';
9
+
10
+ // Export types from Prisma
11
+ export type * from '@prisma/client';
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+
3
+ // Add your Zod schemas here to match your Prisma models
4
+ // Example:
5
+ // export const UserSchema = z.object({
6
+ // id: z.string().cuid(),
7
+ // email: z.string().email(),
8
+ // name: z.string().optional(),
9
+ // createdAt: z.date(),
10
+ // updatedAt: z.date(),
11
+ // });
12
+
13
+ // export const CreateUserSchema = UserSchema.omit({
14
+ // id: true,
15
+ // createdAt: true,
16
+ // updatedAt: true,
17
+ // });
18
+
19
+ // export const UpdateUserSchema = CreateUserSchema.partial();
20
+
21
+ // Export all your schemas
22
+ export const schemas = {
23
+ // user: UserSchema,
24
+ // createUser: CreateUserSchema,
25
+ // updateUser: UpdateUserSchema,
26
+ } as const;
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["ES2020"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "node",
7
+ "allowSyntheticDefaultImports": true,
8
+ "esModuleInterop": true,
9
+ "forceConsistentCasingInFileNames": true,
10
+ "strict": true,
11
+ "skipLibCheck": true,
12
+ "declaration": true,
13
+ "declarationMap": true,
14
+ "sourceMap": true,
15
+ "outDir": "./dist",
16
+ "rootDir": "./src",
17
+ "resolveJsonModule": true,
18
+ "allowJs": false,
19
+ "noUncheckedIndexedAccess": true,
20
+ "experimentalDecorators": true,
21
+ "emitDecoratorMetadata": true
22
+ },
23
+ "include": [
24
+ "src/**/*",
25
+ "prisma/**/*"
26
+ ],
27
+ "exclude": [
28
+ "node_modules",
29
+ "dist",
30
+ "__tests__"
31
+ ]
32
+ }
@@ -1,89 +0,0 @@
1
- #!/bin/bash
2
-
3
- # Post-create script for Idealyst dev container
4
- echo "🚀 Setting up Idealyst development environment..."
5
-
6
- # Set proper permissions
7
- sudo chown -R devuser:devuser /app
8
-
9
- # Make scripts executable
10
- chmod +x /app/scripts/*.sh
11
-
12
- # Install dependencies if not already installed
13
- if [ ! -d "/app/node_modules" ]; then
14
- echo "📦 Installing dependencies..."
15
- yarn install
16
- fi
17
-
18
- # Set up git configuration (if not already set)
19
- if [ -z "$(git config --global user.name)" ]; then
20
- echo "⚙️ Please configure git:"
21
- echo " git config --global user.name \"Your Name\""
22
- echo " git config --global user.email \"your.email@example.com\""
23
- fi
24
-
25
- # Create environment file if it doesn't exist
26
- if [ ! -f "/app/.env" ]; then
27
- echo "📝 Creating .env file..."
28
- cat > /app/.env << EOF
29
- # Database Configuration
30
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/idealyst_db
31
- POSTGRES_DB=idealyst_db
32
- POSTGRES_USER=postgres
33
- POSTGRES_PASSWORD=postgres
34
-
35
- # Redis Configuration
36
- REDIS_URL=redis://redis:6379
37
-
38
- # API Configuration
39
- API_PORT=3001
40
- JWT_SECRET=your-jwt-secret-here
41
-
42
- # Web Configuration
43
- WEB_PORT=3000
44
-
45
- # Development Configuration
46
- NODE_ENV=development
47
- LOG_LEVEL=debug
48
-
49
- # Project Configuration
50
- PROJECT_NAME={{packageName}}
51
- EOF
52
- fi
53
-
54
- # Wait for database to be ready
55
- echo "⏳ Waiting for database to be ready..."
56
- until pg_isready -h postgres -p 5432 -U postgres; do
57
- echo "Database is unavailable - sleeping"
58
- sleep 1
59
- done
60
-
61
- echo "✅ Database is ready!"
62
-
63
- # Run database migrations if they exist
64
- if [ -d "/app/packages" ]; then
65
- echo "🗄️ Setting up database..."
66
-
67
- # Check if any package has prisma
68
- for package_dir in /app/packages/*/; do
69
- if [ -f "${package_dir}prisma/schema.prisma" ]; then
70
- echo "Running Prisma setup for $(basename "$package_dir")..."
71
- cd "$package_dir"
72
- npx prisma generate
73
- npx prisma db push
74
- cd /app
75
- fi
76
- done
77
- fi
78
-
79
- # Set up git hooks if husky is present
80
- if [ -f "/app/package.json" ] && grep -q "husky" /app/package.json; then
81
- echo "🐕 Setting up git hooks..."
82
- yarn husky install
83
- fi
84
-
85
- # Create helpful aliases
86
- echo "⚡ Setting up helpful aliases..."
87
- cat >> ~/.bashrc << EOF
88
-
89
- source ~/.bashrc
@@ -0,0 +1,2 @@
1
+ import { GenerateProjectOptions } from '../types';
2
+ export declare function generateDatabaseProject(options: GenerateProjectOptions): Promise<void>;
@@ -5,3 +5,4 @@ export * from './web';
5
5
  export * from './shared';
6
6
  export * from './workspace';
7
7
  export * from './api';
8
+ export * from './database';
@@ -1,4 +1,4 @@
1
- export type ProjectType = 'native' | 'web' | 'shared' | 'workspace' | 'api';
1
+ export type ProjectType = 'native' | 'web' | 'shared' | 'workspace' | 'api' | 'database';
2
2
  export interface GenerateProjectOptions {
3
3
  name: string;
4
4
  type: ProjectType;