lapeh 2.6.17 → 3.0.2
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/.env.example +1 -6
- package/README.md +19 -85
- package/bin/index.js +84 -180
- package/dist/lib/bootstrap.d.ts.map +1 -1
- package/dist/lib/bootstrap.js +17 -16
- package/dist/lib/core/store.d.ts +55 -0
- package/dist/lib/core/store.d.ts.map +1 -0
- package/dist/lib/core/store.js +66 -0
- package/dist/lib/middleware/error.d.ts.map +1 -1
- package/dist/lib/middleware/error.js +1 -20
- package/dist/lib/utils/validator.d.ts.map +1 -1
- package/dist/lib/utils/validator.js +3 -32
- package/dist/src/modules/Auth/auth.controller.d.ts.map +1 -1
- package/dist/src/modules/Auth/auth.controller.js +118 -105
- package/dist/src/modules/Rbac/rbac.controller.d.ts.map +1 -1
- package/dist/src/modules/Rbac/rbac.controller.js +141 -140
- package/dist/src/routes/index.d.ts.map +1 -1
- package/dist/src/routes/index.js +0 -5
- package/doc/en/CHEATSHEET.md +3 -7
- package/doc/en/CLI.md +16 -41
- package/doc/en/DEPLOYMENT.md +171 -245
- package/doc/en/GETTING_STARTED.md +1 -25
- package/doc/en/PACKAGES.md +2 -3
- package/doc/en/STRUCTURE.md +1 -11
- package/doc/en/TUTORIAL.md +61 -119
- package/doc/id/CHANGELOG.md +16 -0
- package/doc/id/CHEATSHEET.md +0 -4
- package/doc/id/CLI.md +19 -54
- package/doc/id/DEPLOYMENT.md +171 -245
- package/doc/id/GETTING_STARTED.md +91 -115
- package/doc/id/PACKAGES.md +0 -1
- package/doc/id/STRUCTURE.md +1 -11
- package/doc/id/TUTORIAL.md +51 -109
- package/gitignore.template +0 -10
- package/lib/bootstrap.ts +39 -38
- package/lib/core/store.ts +116 -0
- package/lib/middleware/error.ts +1 -21
- package/lib/utils/validator.ts +3 -39
- package/package.json +4 -18
- package/scripts/init-project.js +2 -108
- package/scripts/make-module.js +1 -12
- package/scripts/seed-json.js +158 -0
- package/src/modules/Auth/auth.controller.ts +156 -106
- package/src/modules/Rbac/rbac.controller.ts +193 -138
- package/src/routes/index.ts +0 -3
- package/src/routes/rbac.ts +42 -42
- package/storage/logs/.0337f5062fe676994d1dc340156e089444e3d6e0-audit.json +5 -10
- package/storage/logs/lapeh-2025-12-30.log +1093 -0
- package/tsconfig.build.json +1 -3
- package/tsconfig.json +0 -1
- package/lib/core/database.ts +0 -5
- package/prisma/base.prisma.template +0 -8
- package/prisma/migrations/20251225163737_init/migration.sql +0 -236
- package/prisma/migrations/20251226000329_create_pets_table/migration.sql +0 -11
- package/prisma/migrations/20251226001249_create_pets_table/migration.sql +0 -82
- package/prisma/migrations/20251226001717_restore_core_models/migration.sql +0 -236
- package/prisma/migrations/migration_lock.toml +0 -3
- package/prisma/schema.prisma +0 -197
- package/prisma/seed.ts +0 -411
- package/scripts/compile-schema.js +0 -64
- package/src/modules/Auth/auth.prisma +0 -106
- package/src/modules/Pets/pets.controller.ts +0 -238
- package/src/modules/Pets/pets.prisma +0 -9
- package/src/modules/Rbac/rbac.prisma +0 -68
- package/src/routes/pets.ts +0 -13
- package/storage/logs/lapeh-2025-12-26.log +0 -88
- package/storage/logs/lapeh-2025-12-27.log +0 -217
package/doc/en/DEPLOYMENT.md
CHANGED
|
@@ -1,245 +1,171 @@
|
|
|
1
|
-
# Deployment Guide
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
1. **Environment Variables**:
|
|
10
|
-
2. **Build**: TypeScript
|
|
11
|
-
|
|
12
|
-
##
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
### 1. Setup Server
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### 2. Clone & Install
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
git clone https://github.com/username/repo
|
|
24
|
-
cd repo
|
|
25
|
-
npm install --production=false # Install devDependencies
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
### 3. Build
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm run build
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### 4. Setup
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
**Tips:**
|
|
173
|
-
|
|
174
|
-
1. Sesuaikan `cwd` (Current Working Directory) dengan lokasi folder proyek Anda di VPS.
|
|
175
|
-
2. Pastikan port tidak bentrok antar aplikasi (contoh di atas: 4000, 3001, 8001).
|
|
176
|
-
3. Simpan file ini di root folder proyek utama atau di folder khusus konfigurasi server Anda.
|
|
177
|
-
4. Jalankan semua aplikasi sekaligus dengan: `pm2 start ecosystem.config.js`.
|
|
178
|
-
|
|
179
|
-
### 8. Reverse Proxy (Nginx)
|
|
180
|
-
|
|
181
|
-
Jangan expose port 4000 langsung. Gunakan Nginx di depannya.
|
|
182
|
-
Config Nginx block:
|
|
183
|
-
|
|
184
|
-
```nginx
|
|
185
|
-
server {
|
|
186
|
-
server_name api.domain-anda.com;
|
|
187
|
-
location / {
|
|
188
|
-
proxy_pass http://localhost:4000;
|
|
189
|
-
proxy_http_version 1.1;
|
|
190
|
-
proxy_set_header Upgrade $http_upgrade;
|
|
191
|
-
proxy_set_header Connection 'upgrade';
|
|
192
|
-
proxy_set_header Host $host;
|
|
193
|
-
proxy_cache_bypass $http_upgrade;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
## Strategi 2: Docker (Container)
|
|
199
|
-
|
|
200
|
-
Lapeh sudah menyertakan `Dockerfile` (jika belum, buat sederhana saja).
|
|
201
|
-
|
|
202
|
-
**Dockerfile Minimal:**
|
|
203
|
-
|
|
204
|
-
```dockerfile
|
|
205
|
-
FROM node:18-alpine
|
|
206
|
-
|
|
207
|
-
WORKDIR /app
|
|
208
|
-
|
|
209
|
-
COPY package*.json ./
|
|
210
|
-
RUN npm install
|
|
211
|
-
|
|
212
|
-
COPY . .
|
|
213
|
-
RUN npm run build
|
|
214
|
-
|
|
215
|
-
EXPOSE 4000
|
|
216
|
-
CMD ["npm", "run", "start:prod"]
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
**Deploy:**
|
|
220
|
-
|
|
221
|
-
```bash
|
|
222
|
-
docker build -t my-lapeh-app .
|
|
223
|
-
docker run -p 4000:4000 --env-file .env my-lapeh-app
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
## Strategi 3: PaaS (Railway / Render / Vercel)
|
|
227
|
-
|
|
228
|
-
Platform seperti Railway.app sangat mudah karena mendeteksi `package.json`.
|
|
229
|
-
|
|
230
|
-
1. Push kode ke GitHub.
|
|
231
|
-
2. Connect repo di Railway/Render.
|
|
232
|
-
3. Set Environment Variables di dashboard mereka.
|
|
233
|
-
4. Set **Build Command**: `npm run build`.
|
|
234
|
-
5. Set **Start Command**: `npm run start:prod`.
|
|
235
|
-
|
|
236
|
-
**Catatan Khusus Vercel (Serverless):**
|
|
237
|
-
Lapeh didesain sebagai _Long-Running Server_ (Express). Deploy ke Vercel dimungkinkan tapi butuh wrapper serverless (seperti `vercel-express`). Untuk performa terbaik, disarankan menggunakan VPS atau Container (Railway/Fly.io).
|
|
238
|
-
|
|
239
|
-
## Checklist Keamanan Production
|
|
240
|
-
|
|
241
|
-
- [ ] `NODE_ENV=production` harus diset.
|
|
242
|
-
- [ ] `JWT_SECRET` harus panjang dan acak.
|
|
243
|
-
- [ ] Database tidak boleh terekspos ke publik (gunakan private network atau firewall).
|
|
244
|
-
- [ ] Rate Limiting aktif (default Lapeh sudah aktif).
|
|
245
|
-
- [ ] Gunakan HTTPS (SSL) via Nginx atau Cloudflare.
|
|
1
|
+
# Deployment Guide
|
|
2
|
+
|
|
3
|
+
This guide will help you deploy your Lapeh application from `localhost` to a Production Server (VPS/Cloud).
|
|
4
|
+
|
|
5
|
+
## Pre-Deployment Preparation
|
|
6
|
+
|
|
7
|
+
Before deploying, ensure:
|
|
8
|
+
|
|
9
|
+
1. **Environment Variables**: Prepare `.env` values for production (Strong JWT Secret, etc.).
|
|
10
|
+
2. **Build**: TypeScript must be compiled to JavaScript.
|
|
11
|
+
|
|
12
|
+
## Strategy 1: VPS (Ubuntu/Debian) with PM2
|
|
13
|
+
|
|
14
|
+
This is the most common and cost-effective way.
|
|
15
|
+
|
|
16
|
+
### 1. Setup Server
|
|
17
|
+
|
|
18
|
+
Ensure Node.js and NPM are installed on the server.
|
|
19
|
+
|
|
20
|
+
### 2. Clone & Install
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git clone https://github.com/username/your-repo.git
|
|
24
|
+
cd your-repo
|
|
25
|
+
npm install --production=false # Install devDependencies for build
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 3. Build Application
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm run build
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This will generate a `dist/` folder.
|
|
35
|
+
|
|
36
|
+
### 4. Setup Production Config
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cp .env.example .env
|
|
40
|
+
nano .env # Fill with production config
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 5. Run with PM2
|
|
44
|
+
|
|
45
|
+
Lapeh includes an automatic PM2 configuration (`ecosystem.config.js`).
|
|
46
|
+
|
|
47
|
+
1. **Install PM2 Global**:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g pm2
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
2. **Run Application**:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pm2 start ecosystem.config.js
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
This command will:
|
|
60
|
+
|
|
61
|
+
- Run the application in **Cluster** mode (using all available CPU cores).
|
|
62
|
+
- Set `NODE_ENV` to `production`.
|
|
63
|
+
- Enable auto-restart if the app crashes or memory usage exceeds 1GB.
|
|
64
|
+
|
|
65
|
+
3. **Check Status**:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pm2 status
|
|
69
|
+
pm2 logs
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
4. **Save Startup Config (To run on reboot)**:
|
|
73
|
+
```bash
|
|
74
|
+
pm2 save
|
|
75
|
+
pm2 startup
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### ❓ FAQ: Why Does My App Appear Multiple Times in PM2?
|
|
79
|
+
|
|
80
|
+
If you run `pm2 list` and see your app name appear multiple times, **DON'T WORRY**. This is a feature, not a bug.
|
|
81
|
+
|
|
82
|
+
- **Cause**: `instances: "max"` and `exec_mode: "cluster"` configuration in `ecosystem.config.js`.
|
|
83
|
+
- **Function**: PM2 detects the number of CPU cores on your VPS and creates 1 worker process for each core.
|
|
84
|
+
- **Benefit**: Your application becomes **Multi-Threaded**. Requests are distributed evenly across all processes, improving performance.
|
|
85
|
+
|
|
86
|
+
**How to change to Single Instance (Save RAM):**
|
|
87
|
+
If your server RAM is limited (e.g., 512MB/1GB), modify `ecosystem.config.js`:
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
module.exports = {
|
|
91
|
+
apps: [
|
|
92
|
+
{
|
|
93
|
+
name: "my-app",
|
|
94
|
+
// ...
|
|
95
|
+
instances: 1, // Change "max" to 1
|
|
96
|
+
// ...
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Then run `pm2 reload ecosystem.config.js`.
|
|
103
|
+
|
|
104
|
+
### 7. Advanced: Running Multiple Apps (Multi-App)
|
|
105
|
+
|
|
106
|
+
You can combine multiple Node.js apps in one `ecosystem.config.js`.
|
|
107
|
+
|
|
108
|
+
### 8. Reverse Proxy (Nginx)
|
|
109
|
+
|
|
110
|
+
Do not expose port 4000 directly. Use Nginx in front of it.
|
|
111
|
+
Nginx block config:
|
|
112
|
+
|
|
113
|
+
```nginx
|
|
114
|
+
server {
|
|
115
|
+
server_name api.your-domain.com;
|
|
116
|
+
location / {
|
|
117
|
+
proxy_pass http://localhost:4000;
|
|
118
|
+
proxy_http_version 1.1;
|
|
119
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
120
|
+
proxy_set_header Connection 'upgrade';
|
|
121
|
+
proxy_set_header Host $host;
|
|
122
|
+
proxy_cache_bypass $http_upgrade;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Strategy 2: Docker (Container)
|
|
128
|
+
|
|
129
|
+
Lapeh includes a `Dockerfile`.
|
|
130
|
+
|
|
131
|
+
**Minimal Dockerfile:**
|
|
132
|
+
|
|
133
|
+
```dockerfile
|
|
134
|
+
FROM node:18-alpine
|
|
135
|
+
|
|
136
|
+
WORKDIR /app
|
|
137
|
+
|
|
138
|
+
COPY package*.json ./
|
|
139
|
+
RUN npm install
|
|
140
|
+
|
|
141
|
+
COPY . .
|
|
142
|
+
RUN npm run build
|
|
143
|
+
|
|
144
|
+
EXPOSE 4000
|
|
145
|
+
CMD ["npm", "run", "start:prod"]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Deploy:**
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
docker build -t my-lapeh-app .
|
|
152
|
+
docker run -p 4000:4000 --env-file .env my-lapeh-app
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
## Strategy 3: PaaS (Railway / Render / Vercel)
|
|
156
|
+
|
|
157
|
+
Platforms like Railway.app are very easy as they detect `package.json`.
|
|
158
|
+
|
|
159
|
+
1. Push code to GitHub.
|
|
160
|
+
2. Connect repo on Railway/Render.
|
|
161
|
+
3. Set Environment Variables in their dashboard.
|
|
162
|
+
4. Set **Build Command**: `npm run build`.
|
|
163
|
+
5. Set **Start Command**: `npm run start:prod`.
|
|
164
|
+
|
|
165
|
+
## Production Security Checklist
|
|
166
|
+
|
|
167
|
+
- [ ] `NODE_ENV=production` must be set.
|
|
168
|
+
- [ ] `JWT_SECRET` must be long and random.
|
|
169
|
+
- [ ] Database credentials (if used) must be secure.
|
|
170
|
+
- [ ] Rate Limiting active (Lapeh default is active).
|
|
171
|
+
- [ ] Use HTTPS (SSL) via Nginx or Cloudflare.
|
|
@@ -7,7 +7,6 @@ Welcome to the official documentation for **Lapeh Framework**. This guide will h
|
|
|
7
7
|
Before you begin, ensure your system meets the following requirements:
|
|
8
8
|
|
|
9
9
|
- **Node.js**: Version 18.x or newer.
|
|
10
|
-
- **Database**: PostgreSQL (Recommended) or MySQL/MariaDB.
|
|
11
10
|
- **Package Manager**: NPM (bundled with Node.js).
|
|
12
11
|
|
|
13
12
|
## Installation
|
|
@@ -23,18 +22,6 @@ Run the following command in your terminal:
|
|
|
23
22
|
npx lapeh@latest init your-project-name
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
**Alternative Quick Setup Flags:**
|
|
27
|
-
|
|
28
|
-
- **Full Setup** (Includes dummy data, recommended for learning):
|
|
29
|
-
```bash
|
|
30
|
-
npx lapeh@latest init your-project-name --full
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
- **Default Setup** (Skips questions, uses PostgreSQL):
|
|
34
|
-
```bash
|
|
35
|
-
npx lapeh@latest init your-project-name --y
|
|
36
|
-
```
|
|
37
|
-
|
|
38
25
|
### 2. Initial Setup
|
|
39
26
|
|
|
40
27
|
Once the project is created, navigate into the project directory and run the setup wizard:
|
|
@@ -49,8 +36,6 @@ This script will automatically perform the following:
|
|
|
49
36
|
1. Copy `.env.example` to `.env`.
|
|
50
37
|
2. Install all dependencies (`npm install`).
|
|
51
38
|
3. Generate a secure **JWT Secret**.
|
|
52
|
-
4. Run database migrations (create tables).
|
|
53
|
-
5. Run the seeder (populate initial data).
|
|
54
39
|
|
|
55
40
|
### 3. Run Development Server
|
|
56
41
|
|
|
@@ -68,17 +53,11 @@ Here is the standard folder structure of Lapeh Framework:
|
|
|
68
53
|
my-app/
|
|
69
54
|
├── bin/ # CLI scripts for npx
|
|
70
55
|
├── doc/ # Project documentation
|
|
71
|
-
├── prisma/ # Database Configuration & Schema
|
|
72
|
-
│ ├── migrations/ # Database migration history files
|
|
73
|
-
│ ├── base.prisma.template # Database configuration template
|
|
74
|
-
│ ├── schema.prisma # Combined schema file (Auto-generated)
|
|
75
|
-
│ └── seed.ts # Script for populating initial data
|
|
76
56
|
├── scripts/ # Utility scripts (Generator, Compiler)
|
|
77
57
|
├── src/ # Main application source code
|
|
78
58
|
│ ├── controllers/ # Business logic (Request handlers)
|
|
79
|
-
│ ├── core/ # Core configuration (
|
|
59
|
+
│ ├── core/ # Core configuration (Redis, Server)
|
|
80
60
|
│ ├── middleware/ # Express Middleware (Auth, RateLimit)
|
|
81
|
-
│ ├── models/ # Prisma Schema definitions per feature
|
|
82
61
|
│ ├── routes/ # API routing definitions
|
|
83
62
|
│ ├── utils/ # Helper functions (Response, Validator)
|
|
84
63
|
│ └── index.ts # Application entry point
|
|
@@ -96,9 +75,6 @@ The `.env` file stores important configurations. Here are the key variables:
|
|
|
96
75
|
PORT=4000
|
|
97
76
|
NODE_ENV=development
|
|
98
77
|
|
|
99
|
-
# Database (Change according to your credentials)
|
|
100
|
-
DATABASE_URL="postgresql://user:password@localhost:5432/mydb?schema=public"
|
|
101
|
-
|
|
102
78
|
# Security
|
|
103
79
|
JWT_SECRET="super-long-and-random-secret"
|
|
104
80
|
ACCESS_TOKEN_EXPIRES_IN=3600 # 1 hour
|
package/doc/en/PACKAGES.md
CHANGED
|
@@ -57,9 +57,8 @@ Package ini hanya dipakai saat koding, tidak ikut terinstall di server productio
|
|
|
57
57
|
| **`typescript`** | Compiler TS. | Mengubah kode `.ts` menjadi `.js`. |
|
|
58
58
|
| **`nodemon`** | Auto-restarter. | Restart server otomatis setiap kita save file. |
|
|
59
59
|
| **`eslint`** | Linter (Polisi Kode). | Mencari potensi error dan variabel yang tidak terpakai. |
|
|
60
|
-
| **`@types/*`** |
|
|
61
|
-
| **`
|
|
62
|
-
| **`tsc-alias`** | Path resolver. | Mengubah alias `@/core` menjadi path relatif `../core` saat build production. |
|
|
60
|
+
| **`@types/*`** | Type Definitions. | Provides intellisense (code suggestions) for plain JavaScript libraries. |
|
|
61
|
+
| **`tsc-alias`** | Path resolver. | Resolves `@/core` aliases to relative `../core` paths during production build. |
|
|
63
62
|
|
|
64
63
|
---
|
|
65
64
|
|
package/doc/en/STRUCTURE.md
CHANGED
|
@@ -9,7 +9,6 @@ To fully understand Lapeh Framework, you need to know what each file and folder
|
|
|
9
9
|
| `bin/` | Contains execution scripts for CLI (`npx lapeh`). You rarely touch this. |
|
|
10
10
|
| `doc/` | Project documentation resides here. |
|
|
11
11
|
| `lib/` | **Framework Core**. Internal parts of the framework you rarely touch. |
|
|
12
|
-
| `prisma/` | The heart of Database configuration. |
|
|
13
12
|
| `scripts/` | Collection of Node.js utility scripts (generators, schema compilers, etc). |
|
|
14
13
|
| `src/` | **Main Source Code**. 99% of your coding happens here. |
|
|
15
14
|
| `.env` | Secret variables (Database URL, API Keys). **Do not commit this file to Git!** |
|
|
@@ -29,7 +28,6 @@ Lapeh uses a **Modular** approach. Each feature is grouped into a single module
|
|
|
29
28
|
Example `Auth` module structure:
|
|
30
29
|
|
|
31
30
|
- `Auth/auth.controller.ts`: Application logic (Controller).
|
|
32
|
-
- `Auth/auth.prisma`: Database table definition (Model).
|
|
33
31
|
|
|
34
32
|
### `src/routes/`
|
|
35
33
|
|
|
@@ -54,7 +52,6 @@ This part is similar to `node_modules` or the `.next` folder in Next.js. This is
|
|
|
54
52
|
The "Engine" part of the framework.
|
|
55
53
|
|
|
56
54
|
- `server.ts`: Express App setup.
|
|
57
|
-
- `database.ts`: Prisma Client instance.
|
|
58
55
|
- `redis.ts`: Redis connection.
|
|
59
56
|
- `serializer.ts`: JSON Schema caching logic.
|
|
60
57
|
|
|
@@ -74,18 +71,11 @@ Built-in Helper functions.
|
|
|
74
71
|
- `response.ts`: Standard JSON response format (`sendFastSuccess`, `sendError`).
|
|
75
72
|
- `logger.ts`: Logging system (Winston).
|
|
76
73
|
|
|
77
|
-
## `prisma/` Folder
|
|
78
|
-
|
|
79
|
-
- `migrations/`: Database change history (SQL files). Do not edit manually.
|
|
80
|
-
- `base.prisma.template`: Header of the database schema (contains db datasource config).
|
|
81
|
-
- `seed.ts`: Script for populating initial data (Data Seeding).
|
|
82
|
-
|
|
83
74
|
## `scripts/` Folder
|
|
84
75
|
|
|
85
76
|
"Magic" scripts executed by `npm run`.
|
|
86
77
|
|
|
87
|
-
- `make-module.js`: New module generator (Controller
|
|
88
|
-
- `compile-schema.js`: Merges `.prisma` files from each module into a single `schema.prisma`.
|
|
78
|
+
- `make-module.js`: New module generator (Controller).
|
|
89
79
|
- `init-project.js`: Initial setup wizard.
|
|
90
80
|
- `generate-jwt-secret.js`: Automatic JWT secret key generator.
|
|
91
81
|
|