create-tigra 1.0.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.
Files changed (131) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +87 -0
  3. package/bin/create-tigra.js +292 -0
  4. package/package.json +41 -0
  5. package/template/.agent/rules/client/01-project-structure.md +326 -0
  6. package/template/.agent/rules/client/02-component-patterns.md +249 -0
  7. package/template/.agent/rules/client/03-typescript-rules.md +226 -0
  8. package/template/.agent/rules/client/04-state-management.md +474 -0
  9. package/template/.agent/rules/client/05-api-integration.md +129 -0
  10. package/template/.agent/rules/client/06-forms-validation.md +129 -0
  11. package/template/.agent/rules/client/07-common-patterns.md +150 -0
  12. package/template/.agent/rules/client/08-color-system.md +93 -0
  13. package/template/.agent/rules/client/09-security-rules.md +97 -0
  14. package/template/.agent/rules/client/10-testing-strategy.md +370 -0
  15. package/template/.agent/rules/global/ai-edit-safety.md +38 -0
  16. package/template/.agent/rules/server/01-db-and-migrations.md +242 -0
  17. package/template/.agent/rules/server/02-general-rules.md +111 -0
  18. package/template/.agent/rules/server/03-migrations.md +20 -0
  19. package/template/.agent/rules/server/04-pagination.md +130 -0
  20. package/template/.agent/rules/server/05-project-conventions.md +71 -0
  21. package/template/.agent/rules/server/06-response-handling.md +173 -0
  22. package/template/.agent/rules/server/07-testing-strategy.md +506 -0
  23. package/template/.agent/rules/server/08-observability.md +180 -0
  24. package/template/.agent/rules/server/09-api-documentation-v2.md +168 -0
  25. package/template/.agent/rules/server/10-background-jobs-v2.md +185 -0
  26. package/template/.agent/rules/server/11-rate-limiting-v2.md +210 -0
  27. package/template/.agent/rules/server/12-performance-optimization.md +567 -0
  28. package/template/.claude/rules/client-01-project-structure.md +327 -0
  29. package/template/.claude/rules/client-02-component-patterns.md +250 -0
  30. package/template/.claude/rules/client-03-typescript-rules.md +227 -0
  31. package/template/.claude/rules/client-04-state-management.md +475 -0
  32. package/template/.claude/rules/client-05-api-integration.md +130 -0
  33. package/template/.claude/rules/client-06-forms-validation.md +130 -0
  34. package/template/.claude/rules/client-07-common-patterns.md +151 -0
  35. package/template/.claude/rules/client-08-color-system.md +94 -0
  36. package/template/.claude/rules/client-09-security-rules.md +98 -0
  37. package/template/.claude/rules/client-10-testing-strategy.md +371 -0
  38. package/template/.claude/rules/global-ai-edit-safety.md +39 -0
  39. package/template/.claude/rules/server-01-db-and-migrations.md +243 -0
  40. package/template/.claude/rules/server-02-general-rules.md +112 -0
  41. package/template/.claude/rules/server-03-migrations.md +21 -0
  42. package/template/.claude/rules/server-04-pagination.md +131 -0
  43. package/template/.claude/rules/server-05-project-conventions.md +72 -0
  44. package/template/.claude/rules/server-06-response-handling.md +174 -0
  45. package/template/.claude/rules/server-07-testing-strategy.md +507 -0
  46. package/template/.claude/rules/server-08-observability.md +181 -0
  47. package/template/.claude/rules/server-09-api-documentation-v2.md +169 -0
  48. package/template/.claude/rules/server-10-background-jobs-v2.md +186 -0
  49. package/template/.claude/rules/server-11-rate-limiting-v2.md +211 -0
  50. package/template/.claude/rules/server-12-performance-optimization.md +568 -0
  51. package/template/.cursor/rules/client-01-project-structure.mdc +327 -0
  52. package/template/.cursor/rules/client-02-component-patterns.mdc +250 -0
  53. package/template/.cursor/rules/client-03-typescript-rules.mdc +227 -0
  54. package/template/.cursor/rules/client-04-state-management.mdc +475 -0
  55. package/template/.cursor/rules/client-05-api-integration.mdc +130 -0
  56. package/template/.cursor/rules/client-06-forms-validation.mdc +130 -0
  57. package/template/.cursor/rules/client-07-common-patterns.mdc +151 -0
  58. package/template/.cursor/rules/client-08-color-system.mdc +94 -0
  59. package/template/.cursor/rules/client-09-security-rules.mdc +98 -0
  60. package/template/.cursor/rules/client-10-testing-strategy.mdc +371 -0
  61. package/template/.cursor/rules/global-ai-edit-safety.mdc +39 -0
  62. package/template/.cursor/rules/server-01-db-and-migrations.mdc +243 -0
  63. package/template/.cursor/rules/server-02-general-rules.mdc +112 -0
  64. package/template/.cursor/rules/server-03-migrations.mdc +21 -0
  65. package/template/.cursor/rules/server-04-pagination.mdc +131 -0
  66. package/template/.cursor/rules/server-05-project-conventions.mdc +72 -0
  67. package/template/.cursor/rules/server-06-response-handling.mdc +174 -0
  68. package/template/.cursor/rules/server-07-testing-strategy.mdc +507 -0
  69. package/template/.cursor/rules/server-08-observability.mdc +181 -0
  70. package/template/.cursor/rules/server-09-api-documentation-v2.mdc +169 -0
  71. package/template/.cursor/rules/server-10-background-jobs-v2.mdc +186 -0
  72. package/template/.cursor/rules/server-11-rate-limiting-v2.mdc +211 -0
  73. package/template/.cursor/rules/server-12-performance-optimization.mdc +568 -0
  74. package/template/CLAUDE.md +207 -0
  75. package/template/server/.env.example +148 -0
  76. package/template/server/.tsc-aliasrc.json +12 -0
  77. package/template/server/README.md +175 -0
  78. package/template/server/SECURITY.md +190 -0
  79. package/template/server/biome.json +42 -0
  80. package/template/server/docker-compose.yml +111 -0
  81. package/template/server/package.json +83 -0
  82. package/template/server/postman_collection.json +733 -0
  83. package/template/server/prisma/schema.prisma +92 -0
  84. package/template/server/prisma/seed.ts +142 -0
  85. package/template/server/scripts/wait-for-db.js +60 -0
  86. package/template/server/src/app.ts +74 -0
  87. package/template/server/src/config/env.ts +101 -0
  88. package/template/server/src/hooks/request-timing.hook.ts +26 -0
  89. package/template/server/src/libs/auth/authenticate.middleware.ts +22 -0
  90. package/template/server/src/libs/auth/rbac.middleware.test.ts +134 -0
  91. package/template/server/src/libs/auth/rbac.middleware.ts +147 -0
  92. package/template/server/src/libs/db.ts +76 -0
  93. package/template/server/src/libs/error-handler.ts +89 -0
  94. package/template/server/src/libs/logger.ts +60 -0
  95. package/template/server/src/libs/queue.ts +79 -0
  96. package/template/server/src/libs/redis.ts +79 -0
  97. package/template/server/src/libs/swagger-schemas.ts +16 -0
  98. package/template/server/src/modules/admin/admin.controller.ts +122 -0
  99. package/template/server/src/modules/admin/admin.routes.ts +100 -0
  100. package/template/server/src/modules/admin/admin.schemas.ts +35 -0
  101. package/template/server/src/modules/admin/admin.service.ts +167 -0
  102. package/template/server/src/modules/auth/auth.controller.ts +141 -0
  103. package/template/server/src/modules/auth/auth.integration.test.ts +150 -0
  104. package/template/server/src/modules/auth/auth.repo.ts +218 -0
  105. package/template/server/src/modules/auth/auth.routes.ts +204 -0
  106. package/template/server/src/modules/auth/auth.schemas.ts +137 -0
  107. package/template/server/src/modules/auth/auth.service.test.ts +119 -0
  108. package/template/server/src/modules/auth/auth.service.ts +329 -0
  109. package/template/server/src/modules/auth/auth.types.ts +97 -0
  110. package/template/server/src/modules/resources/resources.controller.ts +218 -0
  111. package/template/server/src/modules/resources/resources.repo.ts +253 -0
  112. package/template/server/src/modules/resources/resources.routes.ts +355 -0
  113. package/template/server/src/modules/resources/resources.schemas.ts +146 -0
  114. package/template/server/src/modules/resources/resources.service.ts +218 -0
  115. package/template/server/src/modules/resources/resources.types.ts +73 -0
  116. package/template/server/src/plugins/rate-limit.plugin.ts +21 -0
  117. package/template/server/src/plugins/security.plugin.ts +21 -0
  118. package/template/server/src/plugins/swagger.plugin.ts +41 -0
  119. package/template/server/src/routes/health.routes.ts +31 -0
  120. package/template/server/src/server.ts +142 -0
  121. package/template/server/src/test/setup.ts +38 -0
  122. package/template/server/src/types/fastify.d.ts +36 -0
  123. package/template/server/src/utils/errors.ts +108 -0
  124. package/template/server/src/utils/pagination.ts +120 -0
  125. package/template/server/src/utils/response.ts +110 -0
  126. package/template/server/src/workers/file.worker.ts +106 -0
  127. package/template/server/tsconfig.build.json +30 -0
  128. package/template/server/tsconfig.build.tsbuildinfo +1 -0
  129. package/template/server/tsconfig.json +89 -0
  130. package/template/server/tsconfig.test.json +22 -0
  131. package/template/server/vitest.config.ts +98 -0
@@ -0,0 +1,207 @@
1
+ # Project Rules for Claude
2
+
3
+ > This file is automatically loaded by Claude Code at the start of each conversation.
4
+ > For detailed rules, see `.claude/rules/` directory.
5
+
6
+ ## Safe Editing Rules (CRITICAL)
7
+
8
+ - Assume this is a **production project**. No destructive or experimental changes.
9
+ - Keep changes **small and focused**.
10
+ - Do NOT change existing function signatures, exports, or imports unless explicitly asked.
11
+ - Preserve existing behavior for: Auth, Core business flows, Payment flows.
12
+ - If introducing a breaking change, **call it out clearly**.
13
+ - Add `// TODO:` comments for ambiguous or incomplete sections.
14
+ - Do NOT add noisy debug logs.
15
+
16
+ ---
17
+
18
+ ## Stack Overview
19
+
20
+ ### Server (`server/`)
21
+ - **Runtime**: Node.js 20+ LTS
22
+ - **Framework**: Fastify
23
+ - **Language**: TypeScript (strict mode)
24
+ - **Database**: MySQL + Prisma ORM
25
+ - **Cache/Queue**: Redis + BullMQ
26
+ - **Validation**: Zod
27
+ - **Testing**: Vitest
28
+
29
+ ### Client (`client/`)
30
+ - **Framework**: React 18+ with Vite
31
+ - **UI Library**: Ant Design
32
+ - **State**: Redux Toolkit + React Query
33
+ - **Language**: TypeScript (strict mode)
34
+ - **Styling**: CSS Modules / Tailwind
35
+
36
+ ---
37
+
38
+ ## Server Architecture
39
+
40
+ ### File Structure
41
+ ```
42
+ server/src/
43
+ ├── app.ts # Fastify instance & plugin registration
44
+ ├── server.ts # Server bootstrap (listen call only)
45
+ ├── config/ # env, constants
46
+ ├── libs/ # Shared: db, redis, logger, auth
47
+ ├── plugins/ # Fastify plugins
48
+ ├── hooks/ # Fastify hooks
49
+ ├── routes/ # Standalone routes (health, etc.)
50
+ └── modules/<domain>/ # Domain modules
51
+ ├── <domain>.routes.ts
52
+ ├── <domain>.controller.ts
53
+ ├── <domain>.service.ts
54
+ ├── <domain>.repo.ts
55
+ ├── <domain>.schemas.ts
56
+ └── <domain>.types.ts
57
+ ```
58
+
59
+ ### Layered Architecture
60
+ ```
61
+ Routes → Controllers → Services → Repositories → DB
62
+ ```
63
+
64
+ - **Controllers**: HTTP handlers only, no business logic
65
+ - **Services**: Business logic, throw typed `AppError` instances
66
+ - **Repositories**: Database queries only
67
+
68
+ ### Response Contract (MANDATORY)
69
+
70
+ **Success Response:**
71
+ ```json
72
+ {
73
+ "success": true,
74
+ "message": "Human readable message",
75
+ "data": {}
76
+ }
77
+ ```
78
+
79
+ **Error Response:**
80
+ ```json
81
+ {
82
+ "success": false,
83
+ "error": {
84
+ "code": "ERROR_CODE",
85
+ "message": "Human readable message"
86
+ }
87
+ }
88
+ ```
89
+
90
+ - Use `successResponse()` helper in controllers
91
+ - Throw typed errors (`BadRequestError`, `NotFoundError`, etc.)
92
+ - NEVER expose stack traces or internal errors to clients
93
+
94
+ ### Error Types
95
+ - `BadRequestError`, `ValidationError`, `UnauthorizedError`
96
+ - `ForbiddenError`, `NotFoundError`, `ConflictError`, `InternalError`
97
+
98
+ ---
99
+
100
+ ## Client Architecture
101
+
102
+ ### File Structure
103
+ ```
104
+ client/src/
105
+ ├── app/ # App config (App.tsx, router, providers)
106
+ ├── components/
107
+ │ ├── layout/ # Header, Footer, Sidebar, MainLayout
108
+ │ └── common/ # Shared components
109
+ ├── features/<domain>/ # Feature modules
110
+ │ ├── components/
111
+ │ ├── hooks/
112
+ │ ├── pages/
113
+ │ ├── services/
114
+ │ ├── store/
115
+ │ ├── types/
116
+ │ └── utils/
117
+ ├── hooks/ # Global hooks
118
+ ├── lib/
119
+ │ ├── api/ # Axios config, API types
120
+ │ ├── constants/ # routes, api-endpoints, app.constants
121
+ │ └── utils/
122
+ ├── store/ # Redux store
123
+ ├── types/ # Global types
124
+ └── styles/
125
+ ```
126
+
127
+ ### Naming Conventions
128
+ - **Components**: `PascalCase.tsx` (e.g., `ResourceCard.tsx`)
129
+ - **Pages**: `PascalCase + Page.tsx` (e.g., `ResourcesPage.tsx`)
130
+ - **Hooks**: `use<Name>.ts` (e.g., `useAuth.ts`)
131
+ - **Services**: `<domain>.service.ts`
132
+ - **Types**: `<domain>.types.ts`
133
+
134
+ ### TypeScript Rules
135
+ - **NO `any` type** - use `unknown` if needed
136
+ - Explicit return types for all functions
137
+ - Use `interface` for props/objects, `type` for unions/intersections
138
+
139
+ ### API Response Types (must match backend)
140
+ ```tsx
141
+ interface ApiResponse<T> {
142
+ success: boolean;
143
+ message: string;
144
+ data: T;
145
+ }
146
+
147
+ interface PaginatedApiResponse<T> {
148
+ success: boolean;
149
+ message: string;
150
+ data: {
151
+ items: T[];
152
+ pagination: {
153
+ page: number;
154
+ limit: number;
155
+ totalItems: number;
156
+ totalPages: number;
157
+ hasNextPage: boolean;
158
+ hasPreviousPage: boolean;
159
+ };
160
+ };
161
+ }
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Coding Style (Both)
167
+
168
+ - Prefer `async/await` over `.then()`
169
+ - Prefer named exports (except `app.ts` and React pages)
170
+ - Use path aliases: `@/`, `@/libs/`, `@/modules/`, etc.
171
+ - Never `console.log` in production code - use the shared `logger`
172
+
173
+ ---
174
+
175
+ ## Package Manager Detection
176
+
177
+ - `pnpm-lock.yaml` exists → use `pnpm`
178
+ - `yarn.lock` exists → use `yarn`
179
+ - Otherwise → use `npm`
180
+
181
+ ---
182
+
183
+ ## When Implementing Features
184
+
185
+ 1. Summarize what needs to be done
186
+ 2. List files to be created/modified
187
+ 3. Provide code for each file
188
+ 4. Mention any migrations or env variables needed
189
+ 5. If unsure, state assumptions clearly
190
+
191
+ ---
192
+
193
+ ## Detailed Rules
194
+
195
+ For comprehensive rules, read the appropriate files in `.claude/rules/`:
196
+
197
+ **Server:**
198
+ - `server-02-general-rules.md` - Architecture & code style
199
+ - `server-05-project-conventions.md` - File structure & conventions
200
+ - `server-06-response-handling.md` - Error & success responses
201
+
202
+ **Client:**
203
+ - `client-01-project-structure.md` - File structure & naming
204
+ - `client-03-typescript-rules.md` - TypeScript conventions
205
+
206
+ **Global:**
207
+ - `global-ai-edit-safety.md` - Safe editing practices
@@ -0,0 +1,148 @@
1
+ # ==============================================
2
+ # SERVER CONFIGURATION
3
+ # ==============================================
4
+
5
+ # Environment: development | production | test
6
+ NODE_ENV=development
7
+
8
+ # Server port
9
+ PORT=3000
10
+
11
+ # API base path (e.g., /api/v1)
12
+ API_PREFIX=/api/v1
13
+
14
+ # Logging level: trace | debug | info | warn | error | fatal
15
+ LOG_LEVEL=info
16
+
17
+ # ==============================================
18
+ # DATABASE CONFIGURATION (MySQL)
19
+ # ==============================================
20
+
21
+ # MySQL connection string format:
22
+ # mysql://USER:PASSWORD@HOST:PORT/DATABASE
23
+ # For local development with Docker:
24
+ DATABASE_URL="mysql://root:{{DATABASE_PASSWORD}}@localhost:3306/{{DATABASE_NAME}}"
25
+
26
+ # For production (example):
27
+ # DATABASE_URL="mysql://user:secure_password@db.example.com:3306/{{DATABASE_NAME}}_production?connection_limit=10&pool_timeout=20"
28
+
29
+ # ==============================================
30
+ # REDIS CONFIGURATION
31
+ # ==============================================
32
+
33
+ # Redis host
34
+ REDIS_HOST=localhost
35
+
36
+ # Redis port
37
+ REDIS_PORT=6379
38
+
39
+ # Redis password (leave empty for local development)
40
+ REDIS_PASSWORD=
41
+
42
+ # Redis database number (0-15)
43
+ REDIS_DB=0
44
+
45
+ # ==============================================
46
+ # JWT AUTHENTICATION
47
+ # ==============================================
48
+
49
+ # JWT secret key - CHANGE THIS IN PRODUCTION!
50
+ # Generate with: openssl rand -base64 32
51
+ JWT_SECRET=123412341234123412341234123412341234123412341234123412341234
52
+
53
+ # Access token expiration (e.g., 15m, 1h, 7d)
54
+ JWT_ACCESS_EXPIRATION=15m
55
+
56
+ # Refresh token expiration (e.g., 7d, 30d, 90d)
57
+ JWT_REFRESH_EXPIRATION=7d
58
+
59
+ # JWT issuer (optional)
60
+ JWT_ISSUER={{PROJECT_NAME}}
61
+
62
+ # ==============================================
63
+ # CORS CONFIGURATION
64
+ # ==============================================
65
+
66
+ # Allowed origins (comma-separated)
67
+ # For development:
68
+ CORS_ALLOWED_ORIGINS=http://localhost:5173,http://localhost:3000
69
+
70
+ # For production:
71
+ # CORS_ALLOWED_ORIGINS=https://yourdomain.com,https://www.yourdomain.com
72
+
73
+
74
+ # ==============================================
75
+ # FILE UPLOAD CONFIGURATION
76
+ # ==============================================
77
+
78
+ # Maximum file size in bytes (10MB default)
79
+ MAX_FILE_SIZE=10485760
80
+
81
+ # Allowed file types (comma-separated)
82
+ ALLOWED_FILE_TYPES=image/jpeg,image/png,image/webp,application/pdf
83
+
84
+ # Upload directory
85
+ UPLOAD_DIR=./uploads
86
+
87
+ # ==============================================
88
+ # RATE LIMITING
89
+ # ==============================================
90
+
91
+ # Global rate limit (requests per time window)
92
+ RATE_LIMIT_MAX=100
93
+
94
+ # Time window in milliseconds (15 minutes = 900000)
95
+ RATE_LIMIT_WINDOW=900000
96
+
97
+ # ==============================================
98
+ # MONITORING & ERROR TRACKING
99
+ # ==============================================
100
+
101
+ # ==============================================
102
+ # API DOCUMENTATION (Swagger)
103
+ # ==============================================
104
+
105
+ # Enable Swagger UI (true/false)
106
+ # Set to false in production for security
107
+ SWAGGER_ENABLED=true
108
+
109
+ # Swagger route prefix
110
+ SWAGGER_ROUTE=/docs
111
+
112
+ # ==============================================
113
+ # EXTERNAL SERVICES (Optional)
114
+ # ==============================================
115
+
116
+ # AWS S3 (for file storage)
117
+ # AWS_ACCESS_KEY_ID=
118
+ # AWS_SECRET_ACCESS_KEY=
119
+ # AWS_REGION=us-east-1
120
+ # AWS_S3_BUCKET=
121
+
122
+ # Stripe (for payments)
123
+ # STRIPE_SECRET_KEY=
124
+ # STRIPE_WEBHOOK_SECRET=
125
+
126
+
127
+
128
+ # ==============================================
129
+ # DEVELOPMENT TOOLS
130
+ # ==============================================
131
+
132
+ # Enable query logging in development
133
+ PRISMA_QUERY_LOG=false
134
+
135
+ # Enable slow query warnings (milliseconds)
136
+ SLOW_QUERY_THRESHOLD=1000
137
+
138
+ # ==============================================
139
+ # ADMIN SEED (Initial Setup)
140
+ # ==============================================
141
+
142
+ # Admin user email for database seeding
143
+ # Change this before running npm run prisma:seed
144
+ ADMIN_EMAIL=admin@{{PROJECT_NAME}}.dev
145
+
146
+ # Admin user password for database seeding
147
+ # CHANGE THIS IMMEDIATELY AFTER FIRST LOGIN!
148
+ ADMIN_PASSWORD=ChangeThisPassword123!
@@ -0,0 +1,12 @@
1
+ {
2
+ "verbose": false,
3
+ "resolveFullPaths": true,
4
+ "replacers": {
5
+ "before": [],
6
+ "after": []
7
+ },
8
+ "fileExtensions": {
9
+ "inputGlob": "**/*.js",
10
+ "outputCheck": ["js"]
11
+ }
12
+ }
@@ -0,0 +1,175 @@
1
+ # {{PROJECT_DISPLAY_NAME}}
2
+
3
+ {{PROJECT_DESCRIPTION}}
4
+
5
+ ## Features
6
+ - JWT Authentication (access + refresh tokens)
7
+ - User management with role-based access
8
+ - Complete CRUD for resources
9
+ - Pagination with filters
10
+ - Rate limiting with Redis
11
+ - Background job processing (BullMQ)
12
+ - API documentation (Swagger/OpenAPI)
13
+ - Comprehensive error handling
14
+ - Request logging and monitoring
15
+ - Health checks
16
+
17
+ ## Tech Stack
18
+ - **Runtime**: Node.js 20+
19
+ - **Framework**: Fastify 4
20
+ - **Database**: MySQL 8.0 with Prisma ORM
21
+ - **Cache/Queue**: Redis + BullMQ
22
+ - **Validation**: Zod
23
+ - **Authentication**: JWT (jsonwebtoken)
24
+ - **Testing**: Vitest + Supertest
25
+ - **Documentation**: Swagger/OpenAPI 3.0
26
+
27
+ ## Prerequisites
28
+ - Node.js 20 or higher
29
+ - Docker and Docker Compose
30
+ - npm or pnpm
31
+
32
+ ## Quick Start
33
+
34
+ ```bash
35
+ # 1. Install dependencies
36
+ npm install
37
+
38
+ # 2. Copy environment variables
39
+ cp .env.example .env
40
+ # Edit .env and set required variables (DATABASE_URL, JWT_SECRET, etc.)
41
+
42
+ # 3. Start Docker services (MySQL + Redis)
43
+ docker-compose up -d
44
+
45
+ # 4. Generate Prisma Client
46
+ npm run prisma:generate
47
+
48
+ # 5. Run database migrations
49
+ npx prisma migrate dev --name init
50
+
51
+ # 6. Seed the database
52
+ npm run prisma:seed
53
+
54
+ # 7. Start development server
55
+ npm run dev
56
+ ```
57
+
58
+ Server will start at http://localhost:3000
59
+
60
+ ## API Documentation
61
+
62
+ Once running, visit:
63
+ - Swagger UI: http://localhost:3000/docs
64
+ - Health Check: http://localhost:3000/health
65
+
66
+ ## Available Scripts
67
+
68
+ ```bash
69
+ npm run dev # Start dev server with hot reload
70
+ npm run build # Build for production
71
+ npm run start # Start production server
72
+ npm test # Run tests
73
+ npm run test:watch # Run tests in watch mode
74
+ npm run test:coverage # Generate coverage report
75
+ npm run prisma:generate # Generate Prisma Client
76
+ npm run prisma:migrate # Run migrations (dev)
77
+ npm run prisma:seed # Seed database
78
+ npm run prisma:studio # Open Prisma Studio
79
+ ```
80
+
81
+ ## Project Structure
82
+
83
+ ```
84
+ src/
85
+ ├── app.ts # Fastify app with plugins
86
+ ├── server.ts # Server startup
87
+ ├── config/
88
+ │ └── env.ts # Environment validation
89
+ ├── libs/
90
+ │ ├── db.ts # Prisma client
91
+ │ ├── redis.ts # Redis connection
92
+ │ ├── logger.ts # Pino logger
93
+ │ └── queue.ts # BullMQ queues
94
+ ├── modules/
95
+ │ ├── auth/ # Authentication module
96
+ │ │ ├── auth.routes.ts
97
+ │ │ ├── auth.controller.ts
98
+ │ │ ├── auth.service.ts
99
+ │ │ ├── auth.repo.ts
100
+ │ │ ├── auth.schemas.ts
101
+ │ │ └── auth.types.ts
102
+ │ └── resources/ # Resources module
103
+ ├── utils/
104
+ │ ├── errors.ts # Custom error classes
105
+ │ ├── response.ts # Response helpers
106
+ │ └── pagination.ts # Pagination helper
107
+ └── workers/
108
+ └── email.worker.ts # Background email worker
109
+ ```
110
+
111
+ ## Environment Variables
112
+
113
+ Required:
114
+ - `DATABASE_URL` - MySQL connection string
115
+ - `JWT_SECRET` - JWT signing secret (min 32 chars)
116
+ - `REDIS_HOST` - Redis host
117
+ - `REDIS_PORT` - Redis port
118
+
119
+ See `.env.example` for all available variables.
120
+
121
+ ## Testing
122
+
123
+ ```bash
124
+ npm test # Run all tests
125
+ npm run test:coverage # Generate coverage report
126
+ ```
127
+
128
+ Coverage targets: 70%+ overall
129
+
130
+ ## Management Tools
131
+
132
+ The project includes built-in web interfaces for managing your data:
133
+
134
+ ### Database (phpMyAdmin)
135
+ - **URL:** [http://localhost:8080](http://localhost:8080)
136
+ - **User:** `{{DATABASE_USER}}` or `root`
137
+ - **Password:** `{{DATABASE_PASSWORD}}` or `password` (check `docker-compose.yml`)
138
+
139
+ ### Redis (Redis Commander)
140
+ - **URL:** [http://localhost:8081](http://localhost:8081)
141
+ - **Host:** `local:redis:6379` (default)
142
+
143
+ ## Production Deployment
144
+
145
+ ### Production Checklist
146
+
147
+ - [ ] Set `NODE_ENV=production`
148
+ - [ ] Build application: `npm run build`
149
+ - [ ] Configure environment variables
150
+ - [ ] Configure Nginx reverse proxy
151
+ - [ ] Set up SSL certificates (Let's Encrypt)
152
+ - [ ] Configure firewall (UFW/iptables)
153
+ - [ ] Set up monitoring (Sentry, logging)
154
+ - [ ] Configure log rotation
155
+ - [ ] Set up automated backups (database + uploads)
156
+ - [ ] Configure rate limiting for production
157
+ - [ ] Enable CORS for production domains only
158
+
159
+ ## Security
160
+
161
+ This project follows security best practices and undergoes regular security audits.
162
+
163
+ **Security Status**: Production dependencies 100% secure
164
+
165
+ For detailed information about:
166
+ - Known security considerations
167
+ - Security best practices
168
+ - Vulnerability reporting
169
+ - Audit history
170
+
171
+ See **[SECURITY.md](./SECURITY.md)**
172
+
173
+ ## License
174
+
175
+ MIT