lapeh 2.2.7 → 2.2.8

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 (52) hide show
  1. package/bin/index.js +164 -13
  2. package/package.json +6 -6
  3. package/api-testing-sepuluh/.env.example +0 -19
  4. package/api-testing-sepuluh/doc/ARCHITECTURE_GUIDE.md +0 -73
  5. package/api-testing-sepuluh/doc/CHANGELOG.md +0 -77
  6. package/api-testing-sepuluh/doc/CHEATSHEET.md +0 -94
  7. package/api-testing-sepuluh/doc/CLI.md +0 -106
  8. package/api-testing-sepuluh/doc/CONTRIBUTING.md +0 -105
  9. package/api-testing-sepuluh/doc/DEPLOYMENT.md +0 -122
  10. package/api-testing-sepuluh/doc/FAQ.md +0 -81
  11. package/api-testing-sepuluh/doc/FEATURES.md +0 -165
  12. package/api-testing-sepuluh/doc/GETTING_STARTED.md +0 -108
  13. package/api-testing-sepuluh/doc/INTRODUCTION.md +0 -60
  14. package/api-testing-sepuluh/doc/PACKAGES.md +0 -66
  15. package/api-testing-sepuluh/doc/PERFORMANCE.md +0 -91
  16. package/api-testing-sepuluh/doc/ROADMAP.md +0 -93
  17. package/api-testing-sepuluh/doc/SECURITY.md +0 -93
  18. package/api-testing-sepuluh/doc/STRUCTURE.md +0 -90
  19. package/api-testing-sepuluh/doc/TUTORIAL.md +0 -192
  20. package/api-testing-sepuluh/docker-compose.yml +0 -24
  21. package/api-testing-sepuluh/eslint.config.mjs +0 -26
  22. package/api-testing-sepuluh/framework.md +0 -168
  23. package/api-testing-sepuluh/nodemon.json +0 -6
  24. package/api-testing-sepuluh/package-lock.json +0 -5539
  25. package/api-testing-sepuluh/package.json +0 -103
  26. package/api-testing-sepuluh/prisma/base.prisma.template +0 -7
  27. package/api-testing-sepuluh/prisma/migrations/20251227034737_init_setup/migration.sql +0 -248
  28. package/api-testing-sepuluh/prisma/migrations/migration_lock.toml +0 -3
  29. package/api-testing-sepuluh/prisma/schema.prisma +0 -183
  30. package/api-testing-sepuluh/prisma/seed.ts +0 -411
  31. package/api-testing-sepuluh/prisma.config.ts +0 -15
  32. package/api-testing-sepuluh/readme.md +0 -414
  33. package/api-testing-sepuluh/scripts/check-update.js +0 -92
  34. package/api-testing-sepuluh/scripts/compile-schema.js +0 -29
  35. package/api-testing-sepuluh/scripts/config-clear.js +0 -45
  36. package/api-testing-sepuluh/scripts/generate-jwt-secret.js +0 -38
  37. package/api-testing-sepuluh/scripts/init-project.js +0 -178
  38. package/api-testing-sepuluh/scripts/make-controller.js +0 -205
  39. package/api-testing-sepuluh/scripts/make-model.js +0 -42
  40. package/api-testing-sepuluh/scripts/make-module.js +0 -158
  41. package/api-testing-sepuluh/scripts/verify-rbac-functional.js +0 -187
  42. package/api-testing-sepuluh/src/controllers/authController.ts +0 -469
  43. package/api-testing-sepuluh/src/controllers/petController.ts +0 -194
  44. package/api-testing-sepuluh/src/controllers/rbacController.ts +0 -478
  45. package/api-testing-sepuluh/src/models/core.prisma +0 -163
  46. package/api-testing-sepuluh/src/models/pets.prisma +0 -9
  47. package/api-testing-sepuluh/src/routes/auth.ts +0 -74
  48. package/api-testing-sepuluh/src/routes/index.ts +0 -10
  49. package/api-testing-sepuluh/src/routes/pets.ts +0 -13
  50. package/api-testing-sepuluh/src/routes/rbac.ts +0 -42
  51. package/api-testing-sepuluh/storage/logs/.gitkeep +0 -0
  52. package/api-testing-sepuluh/tsconfig.json +0 -39
@@ -1,168 +0,0 @@
1
- # Lapeh Framework
2
-
3
- ## Quick Start
4
-
5
- Untuk memulai project ini (Setup awal):
6
-
7
- ```bash
8
- npm i
9
- ```
10
-
11
- ```bash
12
- npm run first
13
- ```
14
-
15
- Perintah di atas akan secara otomatis melakukan:
16
-
17
- 1. Copy `.env.example` ke `.env`
18
- 2. Install dependencies (`npm install`)
19
- 3. Generate JWT Secret baru di `.env`
20
- 4. Setup database (Migrate)
21
- 5. Menjalankan Database Seeder
22
-
23
- Setelah selesai, Anda bisa langsung menjalankan project:
24
-
25
- ```bash
26
- npm run dev
27
- ```
28
-
29
- ### Akun Default
30
-
31
- Jika seeder dijalankan (via `npm run first` atau `npm run db:seed`), gunakan akun berikut:
32
-
33
- - **Super Admin**: `sa@sa.com` / `string`
34
- - **Admin**: `a@a.com` / `string`
35
- - **User**: `u@u.com` / `string`
36
-
37
- ## Code Standards & Best Practices (Baru)
38
-
39
- ### 1. Import Path Aliases
40
- Gunakan alias `@/` untuk mengimpor module dari folder `src/`. Hindari relative path yang panjang seperti `../../utils/response`.
41
-
42
- **Contoh:**
43
- ```typescript
44
- // ✅ Benar (Recommended)
45
- import { prisma } from "@/core/database";
46
- import { sendSuccess } from "@/utils/response";
47
-
48
- // ❌ Salah (Legacy)
49
- import { prisma } from "../core/database";
50
- import { sendSuccess } from "../../utils/response";
51
- ```
52
-
53
- ### 2. Strict Linting (Dead Code Elimination)
54
- Framework ini menerapkan aturan linter yang ketat untuk menjaga kebersihan kode. Variabel, parameter, atau import yang tidak digunakan akan menyebabkan error.
55
-
56
- - **Variabel tidak terpakai**: Hapus atau beri prefix `_` (underscore).
57
- ```typescript
58
- // ✅ Benar
59
- const _unusedVariable = 123;
60
- function example(_req: Request, res: Response) { ... }
61
-
62
- // ❌ Error
63
- const unusedVariable = 123;
64
- function example(req: Request, res: Response) { ... } // jika req tidak dipakai
65
- ```
66
-
67
- ### 3. High Performance Response (Fastify-Style)
68
- Untuk endpoint dengan throughput tinggi (GET lists, data besar), gunakan `sendFastSuccess` dengan JSON Schema serializer. Ini 2-3x lebih cepat dari `res.json` standar Express.
69
-
70
- **Langkah-langkah:**
71
-
72
- 1. **Definisikan Schema** (sesuai field Prisma):
73
- ```typescript
74
- const userSchema = {
75
- type: "object",
76
- properties: {
77
- id: { type: "string" }, // BigInt otomatis dicovert ke string
78
- name: { type: "string" },
79
- email: { type: "string" }
80
- }
81
- };
82
- ```
83
-
84
- 2. **Buat Serializer**:
85
- ```typescript
86
- import { getSerializer, createResponseSchema } from "@/core/serializer";
87
-
88
- const userSerializer = getSerializer("user-detail", createResponseSchema(userSchema));
89
- ```
90
-
91
- 3. **Gunakan di Controller**:
92
- ```typescript
93
- import { sendFastSuccess } from "@/utils/response";
94
-
95
- export async function getUser(req, res) {
96
- const user = await prisma.user.findFirst();
97
- sendFastSuccess(res, 200, userSerializer, {
98
- status: "success",
99
- message: "User found",
100
- data: user
101
- });
102
- }
103
- ```
104
-
105
- ## Database Workflow (Prisma)
106
-
107
- Framework ini menggunakan **Prisma ORM** dengan struktur schema yang modular (dipecah per file). Berikut adalah panduan lengkap dari Development hingga Deployment.
108
-
109
- ### 1. Development (Lokal)
110
-
111
- Saat mengembangkan aplikasi di local environment:
112
-
113
- **a. Mengupdate Schema Database**
114
- Jika Anda mengubah file schema di `src/models/*.prisma` atau konfigurasi di `prisma/base.prisma.template`:
115
-
116
- ```bash
117
- npm run prisma:migrate
118
- ```
119
-
120
- _Perintah ini akan menggabungkan semua file schema, membuat file migrasi baru, menerapkan ke database lokal, dan men-generate ulang Prisma Client._
121
-
122
- **b. Melihat/Edit Data (GUI)**
123
- Untuk membuka dashboard visual database:
124
-
125
- ```bash
126
- npm run db:studio
127
- ```
128
-
129
- **c. Mengisi Data Awal (Seeding)**
130
- Jika Anda butuh data dummy atau data awal (seperti roles/permissions):
131
-
132
- ```bash
133
- npm run db:seed
134
- ```
135
-
136
- **d. Reset Database Total**
137
- Jika database berantakan dan ingin mengulang dari awal (HATI-HATI: Menghapus semua data):
138
-
139
- ```bash
140
- npm run db:reset
141
- ```
142
-
143
- _Perintah ini akan menghapus database, membuat ulang schema dari awal, dan otomatis menjalankan seeder._
144
-
145
- ---
146
-
147
- ### 2. Deployment (Production)
148
-
149
- Saat deploy ke server production:
150
-
151
- **a. Setup Awal**
152
- Pastikan `.env` di production sudah disetup dengan benar (DATABASE_URL, dll).
153
-
154
- **b. Menerapkan Migrasi**
155
- Jangan gunakan `migrate dev` di production. Gunakan perintah ini:
156
-
157
- ```bash
158
- npm run prisma:deploy
159
- ```
160
-
161
- _Perintah ini hanya akan menerapkan file migrasi yang sudah ada ke database production tanpa mereset data atau meminta konfirmasi interaktif._
162
-
163
- **c. Generate Client (Opsional)**
164
- Biasanya dilakukan otomatis saat `npm install` (karena `postinstall`), tapi jika perlu manual:
165
-
166
- ```bash
167
- npm run prisma:generate
168
- ```
@@ -1,6 +0,0 @@
1
- {
2
- "watch": ["src", ".env"],
3
- "ext": "ts,json",
4
- "ignore": ["src/**/*.test.ts"],
5
- "exec": "ts-node -r tsconfig-paths/register src/index.ts"
6
- }