create-ely 0.1.1 → 0.1.3

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 (71) hide show
  1. package/README.md +36 -27
  2. package/package.json +14 -4
  3. package/scripts/postinstall.ts +43 -0
  4. package/src/constants.ts +20 -0
  5. package/src/git.ts +95 -0
  6. package/src/index.ts +126 -140
  7. package/src/template.ts +62 -0
  8. package/src/utils.ts +64 -0
  9. package/templates.zip +0 -0
  10. package/templates/monorepo/README.md +0 -75
  11. package/templates/monorepo/apps/backend/.cursor/mcp.json +0 -8
  12. package/templates/monorepo/apps/backend/.dockerignore +0 -60
  13. package/templates/monorepo/apps/backend/.env.example +0 -19
  14. package/templates/monorepo/apps/backend/.github/workflows/lint.yml +0 -31
  15. package/templates/monorepo/apps/backend/.github/workflows/tests.yml +0 -36
  16. package/templates/monorepo/apps/backend/AGENTS.md +0 -79
  17. package/templates/monorepo/apps/backend/CHANGELOG.md +0 -190
  18. package/templates/monorepo/apps/backend/CLAUDE.md +0 -149
  19. package/templates/monorepo/apps/backend/Dockerfile +0 -35
  20. package/templates/monorepo/apps/backend/LICENSE +0 -21
  21. package/templates/monorepo/apps/backend/README.md +0 -274
  22. package/templates/monorepo/apps/backend/biome.json +0 -58
  23. package/templates/monorepo/apps/backend/bun.lock +0 -303
  24. package/templates/monorepo/apps/backend/docker-compose.yml +0 -37
  25. package/templates/monorepo/apps/backend/drizzle.config.ts +0 -14
  26. package/templates/monorepo/apps/backend/package.json +0 -42
  27. package/templates/monorepo/apps/backend/src/common/config.ts +0 -29
  28. package/templates/monorepo/apps/backend/src/common/logger.ts +0 -18
  29. package/templates/monorepo/apps/backend/src/db/index.ts +0 -31
  30. package/templates/monorepo/apps/backend/src/db/migrations/20251111132328_curly_spectrum.sql +0 -8
  31. package/templates/monorepo/apps/backend/src/db/migrations/meta/20251111132328_snapshot.json +0 -70
  32. package/templates/monorepo/apps/backend/src/db/migrations/meta/_journal.json +0 -13
  33. package/templates/monorepo/apps/backend/src/db/schema/users.ts +0 -39
  34. package/templates/monorepo/apps/backend/src/main.ts +0 -67
  35. package/templates/monorepo/apps/backend/src/middleware/error-handler.ts +0 -36
  36. package/templates/monorepo/apps/backend/src/modules/users/index.ts +0 -61
  37. package/templates/monorepo/apps/backend/src/modules/users/model.ts +0 -48
  38. package/templates/monorepo/apps/backend/src/modules/users/service.ts +0 -46
  39. package/templates/monorepo/apps/backend/src/tests/users.test.ts +0 -102
  40. package/templates/monorepo/apps/backend/src/util/graceful-shutdown.ts +0 -37
  41. package/templates/monorepo/apps/backend/tsconfig.json +0 -35
  42. package/templates/monorepo/apps/backend-biome.json.template +0 -14
  43. package/templates/monorepo/apps/frontend/.env.example +0 -1
  44. package/templates/monorepo/apps/frontend/README.md +0 -59
  45. package/templates/monorepo/apps/frontend/biome.json +0 -16
  46. package/templates/monorepo/apps/frontend/components.json +0 -21
  47. package/templates/monorepo/apps/frontend/index.html +0 -15
  48. package/templates/monorepo/apps/frontend/package.json +0 -48
  49. package/templates/monorepo/apps/frontend/public/favicon.ico +0 -0
  50. package/templates/monorepo/apps/frontend/src/assets/fonts/.gitkeep +0 -0
  51. package/templates/monorepo/apps/frontend/src/assets/images/.gitkeep +0 -0
  52. package/templates/monorepo/apps/frontend/src/features/layout/Header.tsx +0 -73
  53. package/templates/monorepo/apps/frontend/src/main.tsx +0 -36
  54. package/templates/monorepo/apps/frontend/src/routeTree.gen.ts +0 -95
  55. package/templates/monorepo/apps/frontend/src/routes/__root.tsx +0 -25
  56. package/templates/monorepo/apps/frontend/src/routes/index.tsx +0 -34
  57. package/templates/monorepo/apps/frontend/src/routes/users/index.tsx +0 -79
  58. package/templates/monorepo/apps/frontend/src/routes/users/new.tsx +0 -148
  59. package/templates/monorepo/apps/frontend/src/shared/api/client.ts +0 -6
  60. package/templates/monorepo/apps/frontend/src/shared/components/.gitkeep +0 -0
  61. package/templates/monorepo/apps/frontend/src/shared/constants/.gitkeep +0 -0
  62. package/templates/monorepo/apps/frontend/src/shared/hooks/.gitkeep +0 -0
  63. package/templates/monorepo/apps/frontend/src/shared/types/.gitkeep +0 -0
  64. package/templates/monorepo/apps/frontend/src/shared/utils/utils.ts +0 -6
  65. package/templates/monorepo/apps/frontend/src/styles.css +0 -138
  66. package/templates/monorepo/apps/frontend/src/vite-env.d.ts +0 -13
  67. package/templates/monorepo/apps/frontend/tsconfig.json +0 -27
  68. package/templates/monorepo/apps/frontend/vite.config.ts +0 -27
  69. package/templates/monorepo/biome.json +0 -65
  70. package/templates/monorepo/bun.lock +0 -1044
  71. package/templates/monorepo/package.json +0 -13
package/src/utils.ts ADDED
@@ -0,0 +1,64 @@
1
+ import {
2
+ copyFileSync,
3
+ existsSync,
4
+ mkdirSync,
5
+ readdirSync,
6
+ statSync,
7
+ } from 'node:fs';
8
+ import { dirname, join } from 'node:path';
9
+
10
+ /**
11
+ * Recursively copies files and directories from source to destination
12
+ * @param src - Source path to copy from
13
+ * @param dest - Destination path to copy to
14
+ * @param exclude - Array of file/directory names to exclude from copying
15
+ */
16
+ export function copyRecursive(
17
+ src: string,
18
+ dest: string,
19
+ exclude: string[] = [],
20
+ ): void {
21
+ const stats = statSync(src);
22
+
23
+ if (stats.isDirectory()) {
24
+ if (!existsSync(dest)) {
25
+ mkdirSync(dest, { recursive: true });
26
+ }
27
+
28
+ for (const entry of readdirSync(src)) {
29
+ if (exclude.includes(entry) || entry.endsWith('.template')) continue;
30
+
31
+ const srcPath = join(src, entry);
32
+ const destPath = join(dest, entry);
33
+ copyRecursive(srcPath, destPath, exclude);
34
+ }
35
+ } else {
36
+ const destDir = dirname(dest);
37
+ if (!existsSync(destDir)) {
38
+ mkdirSync(destDir, { recursive: true });
39
+ }
40
+ copyFileSync(src, dest);
41
+ }
42
+ }
43
+
44
+ /**
45
+ * Validates a project name according to npm package naming rules
46
+ * @param value - The project name to validate
47
+ * @returns Error message if invalid, undefined if valid
48
+ */
49
+ export function validateProjectName(value: string): string | undefined {
50
+ if (!value || value.trim() === '') {
51
+ return 'Project name is required';
52
+ }
53
+
54
+ const trimmed = value.trim();
55
+ if (!/^[a-z0-9-]+$/.test(trimmed)) {
56
+ return 'Project name must contain only lowercase letters, numbers, and hyphens';
57
+ }
58
+
59
+ if (trimmed.startsWith('-') || trimmed.endsWith('-')) {
60
+ return 'Project name cannot start or end with a hyphen';
61
+ }
62
+
63
+ return undefined;
64
+ }
package/templates.zip ADDED
Binary file
@@ -1,75 +0,0 @@
1
- # Monorepo Template
2
-
3
- This is a monorepo template containing a full-stack application with a backend (ElysiaJS) and frontend (React) application.
4
-
5
- ## Getting Started
6
-
7
- ### Prerequisites
8
-
9
- - [Bun](https://bun.sh) (latest version)
10
- - [Podman](https://podman.io) (for running auxiliary services)
11
-
12
- ### Setup Steps
13
-
14
- 1. **Install dependencies**
15
-
16
- ```bash
17
- bun install
18
- ```
19
-
20
- 2. **Configure environment variables**
21
-
22
- Each app requires its own `.env` file. Please check each app's README for specific environment variable requirements:
23
-
24
- - **Backend**: See [apps/backend/README.md](./apps/backend/README.md) for required environment variables (e.g., `DATABASE_URL`, `SERVER_PORT`, etc.)
25
- - **Frontend**: See [apps/frontend/README.md](./apps/frontend/README.md) for required environment variables (e.g., `VITE_API_URL`)
26
-
27
- 3. **Start auxiliary services with Podman**
28
-
29
- The backend requires a PostgreSQL database. You can start it using Podman or Docker:
30
-
31
- ```bash
32
- cd apps/backend
33
- podman compose up -d elysia-boilerplate-postgres
34
- ```
35
-
36
- This will start a PostgreSQL database container that the backend application can connect to.
37
-
38
- 4. **Run database migrations**
39
-
40
- ```bash
41
- cd apps/backend
42
- bun run db:migrate
43
- ```
44
-
45
- 5. **Start the applications**
46
-
47
- In separate terminals:
48
-
49
- ```bash
50
- # Terminal 1: Start backend
51
- cd apps/backend
52
- bun run dev
53
-
54
- # Terminal 2: Start frontend
55
- cd apps/frontend
56
- bun run dev
57
- ```
58
-
59
- ## Project Structure
60
-
61
- ```text
62
- .
63
- ├── apps/
64
- │ ├── backend/ # ElysiaJS API server
65
- │ └── frontend/ # React frontend application
66
- ├── package.json # Root package.json for workspace management
67
- └── README.md # This file
68
- ```
69
-
70
- ## Additional Information
71
-
72
- For more detailed information about each application, please refer to their respective README files:
73
-
74
- - [Backend README](./apps/backend/README.md)
75
- - [Frontend README](./apps/frontend/README.md)
@@ -1,8 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "context7": {
4
- "command": "npx",
5
- "args": ["-y", "@upstash/context7-mcp"]
6
- }
7
- }
8
- }
@@ -1,60 +0,0 @@
1
- # Ignore files that shouldn't be in the Docker build context
2
- # Following best practices from Dejan Gegić's optimization guide
3
-
4
- # Version control
5
- .git
6
- .gitignore
7
-
8
- # Dependencies (will be installed in container)
9
- node_modules
10
- npm-debug.log*
11
- yarn-debug.log*
12
- yarn-error.log*
13
-
14
- # Environment and secrets
15
- .env
16
- .env.local
17
- .env.*.local
18
- *.pem
19
-
20
- # Build outputs (except what we explicitly copy)
21
- build
22
- dist
23
- coverage
24
-
25
- # IDE and editor files
26
- .vscode
27
- .idea
28
- *.swp
29
- *.swo
30
- *~
31
-
32
- # OS generated files
33
- .DS_Store
34
- .DS_Store?
35
- ._*
36
- .Spotlight-V100
37
- .Trashes
38
- ehthumbs.db
39
- Thumbs.db
40
-
41
- # Documentation
42
- README.md
43
- CHANGELOG.md
44
- LICENSE
45
- *.md
46
-
47
- # Docker files
48
- Dockerfile*
49
- docker-compose*.yml
50
-
51
- # Test files
52
- **/*.test.*
53
- **/*.spec.*
54
- tests/
55
- test/
56
-
57
- # Logs
58
- logs
59
- *.log
60
-
@@ -1,19 +0,0 @@
1
- # Application Environment
2
- NODE_ENV=development
3
-
4
- # Logging Configuration
5
- LOG_LEVEL=debug
6
-
7
- # Server Configuration
8
- SERVER_HOSTNAME=localhost
9
- SERVER_PORT=3000
10
-
11
- # Database Configuration
12
- # Replace with your actual PostgreSQL connection details
13
- DATABASE_URL=postgresql://postgres:postgres@localhost:5432/elysia-boilerplate
14
-
15
- # Enable migrations on server startup
16
- DB_AUTO_MIGRATE=false
17
-
18
- # Enable OpenAPI documentation to be available on /openapi route
19
- ENABLE_OPENAPI=true
@@ -1,31 +0,0 @@
1
- name: Lint
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - develop
8
- pull_request:
9
- branches:
10
- - main
11
- - develop
12
-
13
- jobs:
14
- lint:
15
- name: Biome Lint Check
16
- runs-on: ubuntu-latest
17
-
18
- steps:
19
- - name: Checkout code
20
- uses: actions/checkout@v4
21
-
22
- - name: Setup Bun
23
- uses: oven-sh/setup-bun@v2
24
- with:
25
- bun-version: latest
26
-
27
- - name: Install dependencies
28
- run: bun install --frozen-lockfile
29
-
30
- - name: Run Biome linter
31
- run: bun run lint
@@ -1,36 +0,0 @@
1
- name: Tests
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - develop
8
- pull_request:
9
- branches:
10
- - main
11
- - develop
12
-
13
- jobs:
14
- test:
15
- name: Run Tests
16
- runs-on: ubuntu-latest
17
-
18
- steps:
19
- - name: Checkout code
20
- uses: actions/checkout@v4
21
-
22
- - name: Setup Bun
23
- uses: oven-sh/setup-bun@v2
24
- with:
25
- bun-version: latest
26
-
27
- - name: Install dependencies
28
- run: bun install --frozen-lockfile
29
-
30
- - name: Prepare environment variables
31
- run: |
32
- echo "NODE_ENV=test" >> $GITHUB_ENV
33
- echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> $GITHUB_ENV
34
-
35
- - name: Run tests
36
- run: bun test
@@ -1,79 +0,0 @@
1
- # AGENTS.md
2
-
3
- ## Project Overview
4
-
5
- This is an ElysiaJS boilerplate project using Bun, PostgreSQL, and Drizzle ORM.
6
- It follows a modular architecture with strict TypeScript configuration.
7
-
8
- ## Tech Stack
9
-
10
- - **Runtime**: Bun
11
- - **Framework**: ElysiaJS
12
- - **Database**: PostgreSQL
13
- - **ORM**: Drizzle ORM
14
- - **Linter/Formatter**: Biome
15
- - **Testing**: Bun Test
16
- - **Containerization**: Docker
17
-
18
- ## Recommended Tools
19
-
20
- - **VS Code Extensions**:
21
- - `biomejs.biome` (Formatter & Linter)
22
- - `vivaxy.vscode-conventional-commits` (Commit messages)
23
- - `ms-vscode.cmake-tools` (Build tools)
24
- - **MCP Services**:
25
- - PostgreSQL MCP (for database context)
26
- - GitHub MCP (for PR/Issue context)
27
-
28
- ## Setup & Commands
29
-
30
- - **Install dependencies**: `bun install`
31
- - **Start dev server**: `bun run dev`
32
- - **Build for production**: `bun run build`
33
- - **Start production server**: `bun run start`
34
- - **Run tests**: `bun test`
35
- - **Lint code**: `bun run lint`
36
- - **Format code**: `bun run format`
37
-
38
- ## Database Operations
39
-
40
- - **Generate migrations**: `bun run db:generate` (Run after modifying schema in `src/db/schema`)
41
- - **Apply migrations**: `bun run db:migrate`
42
- - **Open Database Studio**: `bun run db:studio`
43
-
44
- ## Code Style & Conventions
45
-
46
- - **Linter**: Strictly follow Biome rules. Run `bun run lint:fix` to auto-fix issues.
47
- - **TypeScript**: Strict mode is enabled. No `any` types unless absolutely necessary.
48
- - **Architecture**:
49
- - Modular structure in `src/modules/`.
50
- - Each module should have `index.ts` (routes), `service.ts` (logic), `model.ts` (data).
51
- - Shared utilities in `src/common/`.
52
- - Database schema in `src/db/schema/`.
53
- - **Environment**: Use `src/common/config.ts` for env vars (Envalid). Do not use `process.env` directly.
54
- - **Imports**: Use explicit imports.
55
-
56
- ## Testing Instructions
57
-
58
- - **Runner**: Use `bun test`.
59
- - **Location**: Tests are located in `src/tests/`.
60
- - **Convention**: Name test files `*.test.ts`.
61
- - **Requirement**: All new features must include unit/integration tests.
62
- - **Coverage**: Run `bun test --coverage` to check coverage.
63
-
64
- ## PR Instructions
65
-
66
- - **Branches**: Target `develop` for features, `main` for releases.
67
- - **Checks**:
68
- - Ensure `bun run lint` and `bun test` pass locally before requesting review.
69
- - **CI/CD**: A GitHub Action workflow ("Lint") automatically runs `bun run lint` on every Push and PR to `main` and `develop`. This check must pass for merging.
70
- - **Title**: Follow conventional commits (e.g., `feat: add user module`, `fix: resolve login bug`).
71
-
72
- ## Directory Structure
73
-
74
- - `src/common`: Shared configuration and utilities.
75
- - `src/db`: Database setup, migrations, and schemas.
76
- - `src/modules`: Business logic modules.
77
- - `src/tests`: Test files.
78
- - `src/main.ts`: Application entry point.
79
-
@@ -1,190 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [Unreleased]
9
-
10
- ## [0.4.5] - 2026-01-03
11
-
12
- ### Changed
13
-
14
- - Updated dependencies to the latest version
15
-
16
- ## [0.4.4] - 2025-12-25
17
-
18
- ### Added
19
-
20
- - Added `CLAUDE.md` with comprehensive development guidelines for AI-assisted development
21
- - Added `ENABLE_OPENAPI` environment variable to control OpenAPI documentation availability
22
- - Added new `src/middleware/error-handler.ts` for centralized error handling
23
- - Added startup logging to indicate OpenAPI documentation availability status
24
-
25
- ### Changed
26
-
27
- - Extracted global error handler into separate middleware file (`src/middleware/error-handler.ts`)
28
- - Enhanced error logging in users module to log all caught errors before returning responses
29
- - Updated `src/common/logger.ts` to use raw `pino` instead of elysia-logger wrapper
30
- - Updated OpenAPI integration to respect `ENABLE_OPENAPI` configuration
31
- - Updated `.env.example` with `ENABLE_OPENAPI` setting and changed default `LOG_LEVEL` to `debug`
32
- - Updated dependencies: `@elysiajs/openapi` to ^1.4.12, `drizzle-orm` to ^0.45.1, `elysia` to ^1.4.19
33
- - Cleaned up `src/main.ts` by moving error handling logic to dedicated middleware
34
-
35
- ### Removed
36
-
37
- - Removed `@bogeychan/elysia-logger` dependency in favor of raw Pino integration
38
-
39
- ## [0.4.3] - 2025-12-15
40
-
41
- ### Changed
42
-
43
- - Improved `README.md` with up-to-date docs
44
- - Fixed database variable value in `.env.example` to work with `docker-compose.yml` deployment out of the box
45
- - Updated Elysia to the latest `1.4.19` version
46
-
47
- ## [0.4.2] - 2025-12-06
48
-
49
- ### Added
50
-
51
- - Added database migration error handling
52
- - Added automatic database migrations on server startup
53
-
54
- ### Changed
55
-
56
- - Updated dependencies to the latest version
57
- - Changed the way server starts to be more robust
58
-
59
- ## [0.4.1] - 2025-12-03
60
-
61
- ### Changed
62
-
63
- - Updated dependencies to the latest version
64
- - Updated error handling to be more robust
65
- - Updated ci workflows to use action environment variables instead of test environment
66
-
67
- ### Fixed
68
-
69
- - Fixed error logging to not expose sensitive request information
70
-
71
- ## [0.3.1] - 2025-12-01
72
-
73
- ### Changed
74
-
75
- - Updated graceful shutdown functionality to be more robust
76
- - Updated dependencies to the latest version
77
-
78
- ### Added
79
-
80
- - Added `@types/pg` to dev dependencies for type safety
81
-
82
- ## [0.3.0] - 2025-11-27
83
-
84
- ### Changed
85
-
86
- - Updated logger integration to use plugin-based approach at root app level
87
- - Improved app initialization and launch process with proper signal handling (SIGINT/SIGTERM)
88
- - Enhanced error logging with structured HTTP request context
89
- - Improved error handling in the users module
90
-
91
- ## [0.2.4] - 2025-11-20
92
-
93
- ### Fixed
94
-
95
- - Fixed `README.md` to use correct workflow name
96
-
97
- ## [0.2.2] - 2025-11-20
98
-
99
- ### Fixed
100
-
101
- - Fixed workflows to use environment variables
102
-
103
- ## [0.2.0] - 2025-11-20
104
-
105
- ### Added
106
-
107
- - Added local MCP server configuration
108
- - Added CI lint workflow
109
- - Added Biome-based formatting/linting
110
- - Added VS Code recommendations/settings included
111
- - Added project guidelines and updated changelog
112
-
113
- ### Fixed
114
-
115
- - Improved user-creation error handling with clearer 422 responses and more robust failure checks
116
-
117
- ### Changed
118
-
119
- - Updated dependencies to the latest version
120
- - Updated tests for consistent formatting and interaction patterns
121
-
122
- ## [0.1.6] - 2025-11-11
123
-
124
- ### Changed
125
-
126
- - Dependencies updated to the latest version
127
- - Fixed the way we define models
128
- - Moved database-related files to `src/db`
129
- - Moved common files to `src/common`
130
- - Removed aliases from `tsconfig.json` as it may interfere with monorepo setups
131
-
132
- ### Added
133
-
134
- - Added `timestamp` prefix to migrations
135
-
136
- ## [0.1.5] - 2025-09-30
137
-
138
- ### Changed
139
-
140
- - Updated dependencies to the latest version
141
- - Updated the way we use logger
142
- - Improved `openapi` documentation
143
-
144
- ## [0.1.4] - 2025-09-16
145
-
146
- ### Changed
147
-
148
- - Updated packages to the latest version
149
- - Improved `Dockerfile`
150
-
151
- ## [0.1.2] - 2025-09-14
152
-
153
- ### Added
154
-
155
- - Added test directory to `bunfig.toml`
156
- - Added users test file
157
-
158
- ### Fixed
159
-
160
- - Fixed `LOG_LEVEL` type in `config.ts`
161
- - Fixed mistaken comment in `users/index.ts`
162
-
163
- ### Changed
164
-
165
- - Updated `README.md` with testing information and some badges
166
-
167
- ## [0.1.1] - 2025-09-14
168
-
169
- ### Changed
170
-
171
- - Removed invalid parameters from `bunfig.toml` and disabled telemetry
172
-
173
- ## [0.1.0] - 2025-09-14
174
-
175
- ### Added
176
-
177
- - Elysia web framework with TypeScript and Bun runtime
178
- - PostgreSQL database with Drizzle ORM
179
- - User management API endpoints
180
- - OpenAPI documentation generation
181
- - Docker and Docker Compose configuration
182
- - Database migration system
183
- - Pino logger with development pretty printing
184
- - Environment variable validation with Envalid
185
- - Hot reload development server
186
- - Initial users table schema
187
-
188
- ### Changed
189
-
190
- - Updated OpenAPI documentation URLs from `/swagger` to `/openapi`