crypt-express-app 1.3.20
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 +329 -0
- package/dist/generate-module.js +658 -0
- package/dist/index.js +121 -0
- package/dist/scripts/generate-app.js +198 -0
- package/dist/scripts/generate-locales.js +25 -0
- package/dist/scripts/generate-middleware.js +167 -0
- package/dist/scripts/generate-module.js +739 -0
- package/dist/scripts/generate-root-files.js +759 -0
- package/dist/scripts/generate-utils.js +1002 -0
- package/dist/scripts/middleware.js +165 -0
- package/dist/scripts/setup-prisma.js +25 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
# crypt-express-app
|
|
2
|
+
|
|
3
|
+
π A production-ready Express + TypeScript backend starter CLI with Prisma, Redis, i18n, Swagger, Docker, and scalable modular architecture.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## β¨ What is crypt-express-app?
|
|
8
|
+
|
|
9
|
+
`crypt-express-app` is a CLI tool that instantly scaffolds a fully structured, enterprise-grade Express backend application.
|
|
10
|
+
|
|
11
|
+
It generates:
|
|
12
|
+
|
|
13
|
+
- Express + TypeScript setup
|
|
14
|
+
- Prisma ORM configuration
|
|
15
|
+
- PostgreSQL + Redis Docker setup
|
|
16
|
+
- Swagger documentation
|
|
17
|
+
- i18next internationalization
|
|
18
|
+
- Modular folder architecture
|
|
19
|
+
- Logger + Error handling middleware
|
|
20
|
+
- Environment configuration
|
|
21
|
+
- Ready-to-run Docker Compose stack
|
|
22
|
+
|
|
23
|
+
This tool is built for developers who want a clean, scalable backend architecture in seconds.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# π¦ Installation
|
|
28
|
+
|
|
29
|
+
You donβt install it globally.
|
|
30
|
+
|
|
31
|
+
Use directly with npx:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx crypt-express-app my-project
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or inside current directory:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx crypt-express-app .
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
# π§ What It Generates
|
|
46
|
+
|
|
47
|
+
After running the CLI, your project will include:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
my-project/
|
|
51
|
+
β
|
|
52
|
+
βββ src/
|
|
53
|
+
β βββ app.ts
|
|
54
|
+
β βββ routes.ts
|
|
55
|
+
β βββ prisma/
|
|
56
|
+
β β βββ client.ts
|
|
57
|
+
β βββ utils/
|
|
58
|
+
β βββ middlewares/
|
|
59
|
+
β βββ locales/
|
|
60
|
+
β βββ modules/
|
|
61
|
+
β
|
|
62
|
+
βββ prisma/
|
|
63
|
+
β βββ schema.prisma
|
|
64
|
+
βββ server.ts
|
|
65
|
+
βββ .env
|
|
66
|
+
βββ .env.dev
|
|
67
|
+
βββ .env.prod
|
|
68
|
+
βββ example.env
|
|
69
|
+
βββ Dockerfile
|
|
70
|
+
βββ docker-compose.yml
|
|
71
|
+
βββ tsconfig.json
|
|
72
|
+
βββ package.json
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
# π₯ Features
|
|
78
|
+
|
|
79
|
+
## β
Express + TypeScript
|
|
80
|
+
- Clean app architecture
|
|
81
|
+
- Modular routing system
|
|
82
|
+
- Centralized error handling
|
|
83
|
+
- Logger middleware
|
|
84
|
+
|
|
85
|
+
## β
Prisma ORM
|
|
86
|
+
- PostgreSQL configuration
|
|
87
|
+
- Auto Prisma client setup
|
|
88
|
+
- prisma.config.ts support
|
|
89
|
+
|
|
90
|
+
## β
Redis Cache
|
|
91
|
+
- Redis service container
|
|
92
|
+
- Cache service wrapper
|
|
93
|
+
- TTL-based caching support
|
|
94
|
+
|
|
95
|
+
## β
Internationalization (i18n)
|
|
96
|
+
- English + Bengali support
|
|
97
|
+
- Language detection
|
|
98
|
+
- JSON-based translations
|
|
99
|
+
|
|
100
|
+
## β
Swagger API Docs
|
|
101
|
+
- OpenAPI 3.0 setup
|
|
102
|
+
- Bearer auth support
|
|
103
|
+
- Persist authorization enabled
|
|
104
|
+
|
|
105
|
+
Access at:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
http://localhost:3000/api/docs
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## β
Docker Ready
|
|
112
|
+
- Node service container
|
|
113
|
+
- PostgreSQL container
|
|
114
|
+
- Redis container
|
|
115
|
+
- Volume persistence
|
|
116
|
+
- Production-ready configuration
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
# π Quick Start
|
|
121
|
+
|
|
122
|
+
After project generation:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
cd my-project
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Start infrastructure:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
docker compose up -d postgres redis
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Generate Prisma client:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npx prisma generate
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Run development server:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
pnpm dev
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Or build and run:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pnpm build
|
|
150
|
+
pnpm start
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
# π Environment Variables
|
|
156
|
+
|
|
157
|
+
Default `.env`:
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
PORT=3000
|
|
161
|
+
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/app_db
|
|
162
|
+
IAM_REDIS_URL=redis://localhost:6379
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
For Docker (`.env.dev`):
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
DATABASE_URL=postgresql://postgres:postgres@postgres:5432/app_db
|
|
169
|
+
IAM_REDIS_URL=redis://redis:6379
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
# π³ Docker Usage
|
|
175
|
+
|
|
176
|
+
Start everything:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
docker compose up --build
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Only database + redis:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
docker compose up -d postgres redis
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
Stop:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
docker compose down
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
# π§© Architecture Philosophy
|
|
197
|
+
|
|
198
|
+
crypt-express-app follows a clean separation:
|
|
199
|
+
|
|
200
|
+
- `app.ts` β Express configuration
|
|
201
|
+
- `routes.ts` β Route registration
|
|
202
|
+
- `modules/` β Feature modules
|
|
203
|
+
- `utils/` β Shared services
|
|
204
|
+
- `middlewares/` β Cross-cutting concerns
|
|
205
|
+
- `prisma/` β Database client layer
|
|
206
|
+
|
|
207
|
+
This makes scaling large backend systems easier.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
# π CLI Behavior
|
|
212
|
+
|
|
213
|
+
If project name contains spaces:
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
"My App Project"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
It auto converts to:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
my-app-project
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
# π Scripts
|
|
228
|
+
|
|
229
|
+
Generated project includes:
|
|
230
|
+
|
|
231
|
+
```json
|
|
232
|
+
"dev": "nodemon",
|
|
233
|
+
"build": "tsc && npm run copy-locales",
|
|
234
|
+
"start": "node dist/server.js"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
# π Requirements
|
|
240
|
+
|
|
241
|
+
- Node.js 18+
|
|
242
|
+
- pnpm or npm
|
|
243
|
+
- Docker (optional but recommended)
|
|
244
|
+
- PostgreSQL
|
|
245
|
+
- Redis
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
# π Production Ready
|
|
250
|
+
|
|
251
|
+
This starter includes:
|
|
252
|
+
|
|
253
|
+
- Structured logging
|
|
254
|
+
- Error middleware
|
|
255
|
+
- Swagger security
|
|
256
|
+
- Environment separation
|
|
257
|
+
- Docker orchestration
|
|
258
|
+
- Prisma adapter configuration
|
|
259
|
+
|
|
260
|
+
You can safely use this as a base for:
|
|
261
|
+
|
|
262
|
+
- SaaS backend
|
|
263
|
+
- Microservices
|
|
264
|
+
- Enterprise REST APIs
|
|
265
|
+
- Auth servers
|
|
266
|
+
- Admin panels
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
# π€ Contributing
|
|
271
|
+
|
|
272
|
+
Pull requests are welcome.
|
|
273
|
+
|
|
274
|
+
1. Fork repository
|
|
275
|
+
2. Create feature branch
|
|
276
|
+
3. Submit PR
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
# π License
|
|
281
|
+
|
|
282
|
+
ISC
|
|
283
|
+
|
|
284
|
+
---
|
|
285
|
+
|
|
286
|
+
# π¨βπ» Author
|
|
287
|
+
|
|
288
|
+
Abir Hosen
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
# β Why crypt-express-app?
|
|
293
|
+
|
|
294
|
+
Because setting up backend boilerplate repeatedly is painful.
|
|
295
|
+
|
|
296
|
+
crypt-express-app removes:
|
|
297
|
+
|
|
298
|
+
- Folder setup time
|
|
299
|
+
- Docker setup time
|
|
300
|
+
- Prisma configuration time
|
|
301
|
+
- Redis setup time
|
|
302
|
+
- Swagger configuration time
|
|
303
|
+
- i18n wiring time
|
|
304
|
+
|
|
305
|
+
Start coding business logic immediately.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
# π Future Roadmap
|
|
310
|
+
|
|
311
|
+
- Auth module generator
|
|
312
|
+
- Role-based access control
|
|
313
|
+
- GraphQL support
|
|
314
|
+
- Microservice mode
|
|
315
|
+
- CLI flags support
|
|
316
|
+
- Health check system
|
|
317
|
+
- CI/CD template
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
Enjoy building scalable backends π
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
## π Links
|
|
325
|
+
|
|
326
|
+
- π Website: [Cryptdox](https://cryptdox.com)
|
|
327
|
+
- π¦ NPM Package: [crypt-express-app](https://www.npmjs.com/package/crypt-express-app)
|
|
328
|
+
- π€ Portfolio: [abir.cryptdox.com](http://abir.cryptdox.com)
|
|
329
|
+
- π§ Email: abir71.hosen@gmail.com
|