create-ts-express-app 1.1.0 → 1.3.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.
- package/Readme.md +60 -59
- package/bin/cli.js +12 -2
- package/package.json +1 -1
- package/template/Readme.md +60 -59
- package/template/package.json +2 -6
package/Readme.md
CHANGED
@@ -1,97 +1,98 @@
|
|
1
|
-
# TypeScript
|
1
|
+
# ⚡ TypeScript Express Backend Starter
|
2
2
|
|
3
|
-
A clean, production-ready TypeScript
|
3
|
+
A clean, production-ready **TypeScript + Node.js** backend boilerplate built with modern best practices. Instant Express app generation with `npx`.
|
4
4
|
|
5
|
-
|
5
|
+
---
|
6
6
|
|
7
|
-
|
8
|
-
- ✅ Express.js web server
|
9
|
-
- ✅ Environment variable management with dotenv
|
10
|
-
- ✅ Development mode with hot reloading
|
11
|
-
- ✅ Proper project structure for scalability
|
12
|
-
- ✅ Error handling middleware
|
13
|
-
- ✅ NPM scripts for development and production
|
7
|
+
## 🚀 Quickstart
|
14
8
|
|
15
|
-
|
9
|
+
```bash
|
10
|
+
npx create-ts-express-app@latest my-project-name
|
11
|
+
cd my-project-name
|
12
|
+
npm install
|
13
|
+
npm run dev
|
14
|
+
```
|
16
15
|
|
17
|
-
|
16
|
+
You're up and running in seconds. Just ship.
|
18
17
|
|
19
|
-
|
20
|
-
- npm or yarn
|
18
|
+
---
|
21
19
|
|
22
|
-
|
20
|
+
## 🧰 Features
|
23
21
|
|
24
|
-
|
22
|
+
- ⚙️ Fully typed Express.js setup
|
23
|
+
- 🔄 Hot reloading with `ts-node-dev`
|
24
|
+
- 🔐 `.env`-based configuration
|
25
|
+
- ✅ Clean file structure built to scale
|
26
|
+
- 🧱 Error handling middleware
|
27
|
+
- 🛠️ Scripts for dev & prod workflows
|
25
28
|
|
26
|
-
|
27
|
-
git clone https://github.com/harsh-dev0/ts-express.git
|
28
|
-
cd ts-express
|
29
|
-
```
|
29
|
+
---
|
30
30
|
|
31
|
-
|
31
|
+
## 📦 Prerequisites
|
32
32
|
|
33
|
-
|
34
|
-
npm
|
35
|
-
```
|
33
|
+
- Node.js **18+**
|
34
|
+
- `npm` or `yarn`
|
36
35
|
|
37
|
-
|
36
|
+
---
|
38
37
|
|
39
|
-
|
40
|
-
PORT=3000
|
41
|
-
```
|
38
|
+
## 🧪 Development
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
Start the development server with hot reloading:
|
40
|
+
Start dev server with hot reloading:
|
46
41
|
|
47
42
|
```bash
|
48
43
|
npm run dev
|
49
44
|
```
|
50
45
|
|
51
|
-
|
46
|
+
Or watch all file changes:
|
52
47
|
|
53
48
|
```bash
|
54
49
|
npm run dev:watch
|
55
50
|
```
|
56
51
|
|
57
|
-
|
58
|
-
|
59
|
-
Build the project:
|
52
|
+
---
|
60
53
|
|
61
|
-
|
62
|
-
npm run build
|
63
|
-
```
|
54
|
+
## 🚢 Production
|
64
55
|
|
65
|
-
|
56
|
+
Build & run:
|
66
57
|
|
67
58
|
```bash
|
59
|
+
npm run build
|
68
60
|
npm start
|
69
61
|
```
|
70
62
|
|
71
|
-
|
63
|
+
---
|
64
|
+
|
65
|
+
## 🌳 Project Structure
|
72
66
|
|
73
67
|
```
|
74
|
-
|
75
|
-
├── src/
|
76
|
-
│ ├── index.ts
|
77
|
-
│ ├── routes/
|
78
|
-
│ ├── controllers/
|
79
|
-
│ ├──
|
80
|
-
│
|
81
|
-
|
82
|
-
├──
|
83
|
-
├──
|
84
|
-
|
85
|
-
└── .env # Environment variables
|
68
|
+
my-project/
|
69
|
+
├── src/
|
70
|
+
│ ├── index.ts # App entry
|
71
|
+
│ ├── routes/ # Routes
|
72
|
+
│ ├── controllers/ # Route logic
|
73
|
+
│ ├── middleware/ # Custom middleware
|
74
|
+
│ └── config/ # Config (env, db, etc.)
|
75
|
+
├── dist/ # Compiled JS (auto-generated)
|
76
|
+
├── .env # Environment variables
|
77
|
+
├── package.json
|
78
|
+
└── tsconfig.json
|
86
79
|
```
|
87
80
|
|
88
|
-
|
81
|
+
---
|
82
|
+
|
83
|
+
## 🎯 Scripts
|
84
|
+
|
85
|
+
| Command | Description |
|
86
|
+
|---------------------|-------------------------------------|
|
87
|
+
| `npm run dev` | Start dev server (hot reload) |
|
88
|
+
| `npm run dev:watch` | Dev with full file watching |
|
89
|
+
| `npm run build` | Compile TypeScript to JavaScript |
|
90
|
+
| `npm start` | Start production server |
|
91
|
+
|
92
|
+
---
|
89
93
|
|
90
|
-
|
91
|
-
- `npm start` - Starts the production server
|
92
|
-
- `npm run dev` - Starts the development server
|
93
|
-
- `npm run dev:watch` - Starts the development server with file watching
|
94
|
+
## 📄 License
|
94
95
|
|
95
|
-
|
96
|
+
MIT — Use it. Build with it. Ship something great.
|
96
97
|
|
97
|
-
|
98
|
+
---
|
package/bin/cli.js
CHANGED
@@ -41,8 +41,18 @@ async function createProject() {
|
|
41
41
|
try {
|
42
42
|
await fs.copy(templateDir, targetDir);
|
43
43
|
console.log('Template files copied successfully.');
|
44
|
-
|
45
|
-
|
44
|
+
// Add this after copying the template files:
|
45
|
+
await fs.writeFile(
|
46
|
+
path.join(targetDir, '.gitignore'),
|
47
|
+
`# Generated .gitignore file
|
48
|
+
node_modules/
|
49
|
+
dist/
|
50
|
+
.env
|
51
|
+
.DS_Store
|
52
|
+
npm-debug.log
|
53
|
+
yarn-error.log
|
54
|
+
`
|
55
|
+
)
|
46
56
|
const packageJsonPath = path.join(targetDir, 'package.json');
|
47
57
|
if (fs.existsSync(packageJsonPath)) {
|
48
58
|
const packageJson = await fs.readJson(packageJsonPath);
|
package/package.json
CHANGED
package/template/Readme.md
CHANGED
@@ -1,97 +1,98 @@
|
|
1
|
-
# TypeScript
|
1
|
+
# ⚡ TypeScript Express Backend Starter
|
2
2
|
|
3
|
-
A clean, production-ready TypeScript
|
3
|
+
A clean, production-ready **TypeScript + Node.js** backend boilerplate built with modern best practices. Instant Express app generation with `npx`.
|
4
4
|
|
5
|
-
|
5
|
+
---
|
6
6
|
|
7
|
-
|
8
|
-
- ✅ Express.js web server
|
9
|
-
- ✅ Environment variable management with dotenv
|
10
|
-
- ✅ Development mode with hot reloading
|
11
|
-
- ✅ Proper project structure for scalability
|
12
|
-
- ✅ Error handling middleware
|
13
|
-
- ✅ NPM scripts for development and production
|
7
|
+
## 🚀 Quickstart
|
14
8
|
|
15
|
-
|
9
|
+
```bash
|
10
|
+
npx create-ts-express-app@latest my-project-name
|
11
|
+
cd my-project-name
|
12
|
+
npm install
|
13
|
+
npm run dev
|
14
|
+
```
|
16
15
|
|
17
|
-
|
16
|
+
You're up and running in seconds. Just ship.
|
18
17
|
|
19
|
-
|
20
|
-
- npm or yarn
|
18
|
+
---
|
21
19
|
|
22
|
-
|
20
|
+
## 🧰 Features
|
23
21
|
|
24
|
-
|
22
|
+
- ⚙️ Fully typed Express.js setup
|
23
|
+
- 🔄 Hot reloading with `ts-node-dev`
|
24
|
+
- 🔐 `.env`-based configuration
|
25
|
+
- ✅ Clean file structure built to scale
|
26
|
+
- 🧱 Error handling middleware
|
27
|
+
- 🛠️ Scripts for dev & prod workflows
|
25
28
|
|
26
|
-
|
27
|
-
git clone https://github.com/harsh-dev0/ts-express.git
|
28
|
-
cd ts-express
|
29
|
-
```
|
29
|
+
---
|
30
30
|
|
31
|
-
|
31
|
+
## 📦 Prerequisites
|
32
32
|
|
33
|
-
|
34
|
-
npm
|
35
|
-
```
|
33
|
+
- Node.js **18+**
|
34
|
+
- `npm` or `yarn`
|
36
35
|
|
37
|
-
|
36
|
+
---
|
38
37
|
|
39
|
-
|
40
|
-
PORT=3000
|
41
|
-
```
|
38
|
+
## 🧪 Development
|
42
39
|
|
43
|
-
|
44
|
-
|
45
|
-
Start the development server with hot reloading:
|
40
|
+
Start dev server with hot reloading:
|
46
41
|
|
47
42
|
```bash
|
48
43
|
npm run dev
|
49
44
|
```
|
50
45
|
|
51
|
-
|
46
|
+
Or watch all file changes:
|
52
47
|
|
53
48
|
```bash
|
54
49
|
npm run dev:watch
|
55
50
|
```
|
56
51
|
|
57
|
-
|
58
|
-
|
59
|
-
Build the project:
|
52
|
+
---
|
60
53
|
|
61
|
-
|
62
|
-
npm run build
|
63
|
-
```
|
54
|
+
## 🚢 Production
|
64
55
|
|
65
|
-
|
56
|
+
Build & run:
|
66
57
|
|
67
58
|
```bash
|
59
|
+
npm run build
|
68
60
|
npm start
|
69
61
|
```
|
70
62
|
|
71
|
-
|
63
|
+
---
|
64
|
+
|
65
|
+
## 🌳 Project Structure
|
72
66
|
|
73
67
|
```
|
74
|
-
|
75
|
-
├── src/
|
76
|
-
│ ├── index.ts
|
77
|
-
│ ├── routes/
|
78
|
-
│ ├── controllers/
|
79
|
-
│ ├──
|
80
|
-
│
|
81
|
-
|
82
|
-
├──
|
83
|
-
├──
|
84
|
-
|
85
|
-
└── .env # Environment variables
|
68
|
+
my-project/
|
69
|
+
├── src/
|
70
|
+
│ ├── index.ts # App entry
|
71
|
+
│ ├── routes/ # Routes
|
72
|
+
│ ├── controllers/ # Route logic
|
73
|
+
│ ├── middleware/ # Custom middleware
|
74
|
+
│ └── config/ # Config (env, db, etc.)
|
75
|
+
├── dist/ # Compiled JS (auto-generated)
|
76
|
+
├── .env # Environment variables
|
77
|
+
├── package.json
|
78
|
+
└── tsconfig.json
|
86
79
|
```
|
87
80
|
|
88
|
-
|
81
|
+
---
|
82
|
+
|
83
|
+
## 🎯 Scripts
|
84
|
+
|
85
|
+
| Command | Description |
|
86
|
+
|---------------------|-------------------------------------|
|
87
|
+
| `npm run dev` | Start dev server (hot reload) |
|
88
|
+
| `npm run dev:watch` | Dev with full file watching |
|
89
|
+
| `npm run build` | Compile TypeScript to JavaScript |
|
90
|
+
| `npm start` | Start production server |
|
91
|
+
|
92
|
+
---
|
89
93
|
|
90
|
-
|
91
|
-
- `npm start` - Starts the production server
|
92
|
-
- `npm run dev` - Starts the development server
|
93
|
-
- `npm run dev:watch` - Starts the development server with file watching
|
94
|
+
## 📄 License
|
94
95
|
|
95
|
-
|
96
|
+
MIT — Use it. Build with it. Ship something great.
|
96
97
|
|
97
|
-
|
98
|
+
---
|
package/template/package.json
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "create-ts-express-kit",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.2.0",
|
4
4
|
"main": "index.js",
|
5
|
-
"bin": {
|
6
|
-
"create-ts-express-kit": "./create.js"
|
7
|
-
},
|
8
5
|
"scripts": {
|
9
6
|
"build": "tsc",
|
10
7
|
"start": "node dist/index.js",
|
@@ -30,8 +27,7 @@
|
|
30
27
|
"dependencies": {
|
31
28
|
"@types/express": "^5.0.1",
|
32
29
|
"dotenv": "^16.5.0",
|
33
|
-
"express": "^5.1.0"
|
34
|
-
"ncp": "^2.0.0"
|
30
|
+
"express": "^5.1.0"
|
35
31
|
},
|
36
32
|
"repository": {
|
37
33
|
"type": "git",
|