create-arktos 1.5.1 → 2.0.1
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/LICENSE +34 -21
- package/README.md +54 -490
- package/cli/generator.js +184 -0
- package/cli/package-manager.js +66 -0
- package/cli/project-name.js +179 -0
- package/cli/ui.js +54 -0
- package/index.js +153 -0
- package/package.json +26 -53
- package/templates/backend/.prettierrc +23 -0
- package/templates/backend/LICENSE +34 -0
- package/{eslint.config.js → templates/backend/eslint.config.js} +26 -40
- package/templates/backend/pnpm-workspace.yaml +4 -0
- package/{src → templates/backend/src}/app.ts +3 -3
- package/{src → templates/backend/src}/controllers/auth.controller.ts +10 -1
- package/{src → templates/backend/src}/routes/auth.routes.ts +1 -1
- package/{src → templates/backend/src}/routes/index.ts +1 -1
- package/{tsconfig.json → templates/backend/tsconfig.json} +2 -4
- package/bin/cli.js +0 -332
- /package/{.env.example → templates/backend/.env.example} +0 -0
- /package/{template.package.json → templates/backend/package.json} +0 -0
- /package/{prisma → templates/backend/prisma}/schema.prisma +0 -0
- /package/{src → templates/backend/src}/config/env.validation.ts +0 -0
- /package/{src → templates/backend/src}/config/logger.ts +0 -0
- /package/{src → templates/backend/src}/constants/errorCodes.ts +0 -0
- /package/{src → templates/backend/src}/constants/messages.ts +0 -0
- /package/{src → templates/backend/src}/middleware/index.ts +0 -0
- /package/{src → templates/backend/src}/schemas/index.ts +0 -0
- /package/{src → templates/backend/src}/services/database.service.ts +0 -0
- /package/{src → templates/backend/src}/services/email.service.ts +0 -0
- /package/{src → templates/backend/src}/services/jwt.service.ts +0 -0
- /package/{src → templates/backend/src}/types/express.d.ts +0 -0
- /package/{src → templates/backend/src}/types/index.ts +0 -0
- /package/{src → templates/backend/src}/utils/response.ts +0 -0
- /package/{src → templates/backend/src}/views/emails/notification.html +0 -0
- /package/{src → templates/backend/src}/views/emails/resetPassword.html +0 -0
- /package/{src → templates/backend/src}/views/emails/verification.html +0 -0
- /package/{src → templates/backend/src}/views/emails/welcome.html +0 -0
- /package/{vercel.json → templates/backend/vercel.json} +0 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters:
|
|
4
|
+
|
|
5
|
+
Licensor: Zafer Gök
|
|
6
|
+
Licensed Work: Arktos, including the create-arktos CLI generator, backend architectures, templates, and associated documentation.
|
|
7
|
+
Additional Use Grant: You may use the Licensed Work free of charge for non-commercial, evaluation, educational, internal development, and testing purposes. Any production deployment, commercial offering, commercial client deliverables, or providing the Licensed Work (or modified versions thereof) as a paid backend service or competing product requires a separate commercial license agreement with the Licensor.
|
|
8
|
+
Change Date: 2030-01-01
|
|
9
|
+
Change License: Apache License, Version 2.0 (or at your option, MIT License)
|
|
10
|
+
|
|
11
|
+
Notice:
|
|
12
|
+
|
|
13
|
+
The Business Source License 1.1 (the "License") is not an Open Source license.
|
|
14
|
+
However, the Licensor pledges to grant an Open Source license on the Change Date.
|
|
15
|
+
|
|
16
|
+
Text of the License:
|
|
17
|
+
|
|
18
|
+
1. Grant of License.
|
|
19
|
+
Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-commercial use of the Licensed Work, subject to the Additional Use Grant and other conditions set forth herein.
|
|
20
|
+
|
|
21
|
+
2. Additional Use Grant.
|
|
22
|
+
As specified in the Parameters above, you are permitted to use the Licensed Work free of charge exclusively under the conditions defined in the Additional Use Grant. Use of the Licensed Work outside the Additional Use Grant without obtaining a commercial license from the Licensor is strictly prohibited.
|
|
23
|
+
|
|
24
|
+
3. Commercial Inquiries.
|
|
25
|
+
To obtain a commercial license for production, commercial, or enterprise use, contact the Licensor at gok.zaferr@gmail.com or visit https://github.com/zzafergok/arktos.
|
|
26
|
+
|
|
27
|
+
4. Change Date and Change License.
|
|
28
|
+
Effective on the Change Date specified in the Parameters above, the Licensor hereby grants you a license to the Licensed Work under the Change License specified in the Parameters above, without the restrictions of this License.
|
|
29
|
+
|
|
30
|
+
5. Attribution and Notice.
|
|
31
|
+
You must retain all copyright notices, trademarks, and this License notice in all copies or substantial portions of the Licensed Work.
|
|
32
|
+
|
|
33
|
+
6. Disclaimer of Warranties.
|
|
34
|
+
THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE LICENSOR OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK.
|
package/README.md
CHANGED
|
@@ -1,533 +1,97 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ❄️ create-arktos
|
|
2
2
|
|
|
3
|
-
> **
|
|
3
|
+
> **Production-ready Node.js & TypeScript backend boilerplate generator with Express 5, JWT authentication, Prisma 6 ORM, PostgreSQL (Neon), and Resend.**
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/create-arktos)
|
|
6
|
+
[](./LICENSE)
|
|
7
7
|
[](https://nodejs.org/)
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Create a new backend project instantly:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
# Create a new project
|
|
15
|
-
npx create-arktos my-awesome-api
|
|
16
|
-
|
|
17
|
-
# Navigate to project
|
|
18
|
-
cd my-awesome-api
|
|
19
|
-
|
|
20
|
-
# Install dependencies
|
|
21
|
-
npm install
|
|
22
|
-
|
|
23
|
-
# Set up environment variables
|
|
24
|
-
cp .env.example .env
|
|
25
|
-
# Edit .env with your database and API keys
|
|
26
|
-
|
|
27
|
-
# Set up database
|
|
28
|
-
npx prisma migrate dev
|
|
29
|
-
|
|
30
|
-
# Start development server
|
|
31
|
-
npm run dev
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Your backend API is now running at `http://localhost:3001` 🚀
|
|
35
|
-
|
|
36
|
-
## 🌟 What's Included
|
|
37
|
-
|
|
38
|
-
### 🔐 **Complete Authentication System**
|
|
39
|
-
- JWT-based authentication with access & refresh tokens
|
|
40
|
-
- User registration with email verification
|
|
41
|
-
- Password reset functionality
|
|
42
|
-
- Profile management
|
|
43
|
-
- Login attempt logging and security monitoring
|
|
44
|
-
|
|
45
|
-
### 🛡️ **Security First**
|
|
46
|
-
- Rate limiting (general, auth, and API-specific)
|
|
47
|
-
- CORS protection with configurable origins
|
|
48
|
-
- Helmet.js security headers
|
|
49
|
-
- Input sanitization and validation with Zod
|
|
50
|
-
- Password hashing with bcrypt
|
|
51
|
-
- Request logging and monitoring
|
|
52
|
-
|
|
53
|
-
### 🗄️ **Database & ORM**
|
|
54
|
-
- Prisma ORM with PostgreSQL
|
|
55
|
-
- Pre-configured models (User, LoginLog, EmailVerification, etc.)
|
|
56
|
-
- Database health monitoring
|
|
57
|
-
- Migration system
|
|
58
|
-
- Neon serverless PostgreSQL ready
|
|
59
|
-
|
|
60
|
-
### 📧 **Email Service**
|
|
61
|
-
- Resend integration for transactional emails
|
|
62
|
-
- Pre-built email templates (welcome, verification, password reset)
|
|
63
|
-
- HTML email templates included
|
|
64
|
-
|
|
65
|
-
### 🏗️ **Modern Architecture**
|
|
66
|
-
- TypeScript with strict type checking
|
|
67
|
-
- Modular middleware system
|
|
68
|
-
- Singleton database service
|
|
69
|
-
- Centralized error handling
|
|
70
|
-
- Winston logging system
|
|
71
|
-
- Clean project structure
|
|
72
|
-
|
|
73
|
-
### 🚀 **Deployment Ready**
|
|
74
|
-
- Vercel configuration included
|
|
75
|
-
- Environment variable validation
|
|
76
|
-
- Production build scripts
|
|
77
|
-
- Health check endpoints
|
|
78
|
-
|
|
79
|
-
## 📦 Generated Project Structure
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
-
my-awesome-api/
|
|
83
|
-
├── src/
|
|
84
|
-
│ ├── app.ts # Express application setup
|
|
85
|
-
│ ├── config/
|
|
86
|
-
│ │ ├── env.validation.ts # Environment validation
|
|
87
|
-
│ │ └── logger.ts # Winston logger config
|
|
88
|
-
│ ├── constants/
|
|
89
|
-
│ │ ├── errorCodes.ts # Error code definitions
|
|
90
|
-
│ │ └── messages.ts # Response messages
|
|
91
|
-
│ ├── controllers/
|
|
92
|
-
│ │ └── auth.controller.ts # Authentication endpoints
|
|
93
|
-
│ ├── middleware/
|
|
94
|
-
│ │ └── index.ts # Security & validation middleware
|
|
95
|
-
│ ├── routes/
|
|
96
|
-
│ │ ├── auth.routes.ts # Auth route definitions
|
|
97
|
-
│ │ └── index.ts # Route aggregation
|
|
98
|
-
│ ├── schemas/
|
|
99
|
-
│ │ └── index.ts # Zod validation schemas
|
|
100
|
-
│ ├── services/
|
|
101
|
-
│ │ ├── database.service.ts # Singleton database service
|
|
102
|
-
│ │ ├── email.service.ts # Email service with Resend
|
|
103
|
-
│ │ └── jwt.service.ts # JWT utilities
|
|
104
|
-
│ ├── types/
|
|
105
|
-
│ │ ├── express.d.ts # Express type extensions
|
|
106
|
-
│ │ └── index.ts # Type definitions
|
|
107
|
-
│ ├── utils/
|
|
108
|
-
│ │ └── response.ts # API response utilities
|
|
109
|
-
│ └── views/
|
|
110
|
-
│ └── emails/ # HTML email templates
|
|
111
|
-
├── prisma/
|
|
112
|
-
│ └── schema.prisma # Database schema
|
|
113
|
-
├── .env.example # Environment variables template
|
|
114
|
-
├── .gitignore # Git ignore rules
|
|
115
|
-
├── .prettierrc # Prettier configuration
|
|
116
|
-
├── eslint.config.js # ESLint configuration
|
|
117
|
-
├── package.json # Dependencies and scripts
|
|
118
|
-
├── README.md # Project documentation
|
|
119
|
-
├── tsconfig.json # TypeScript configuration
|
|
120
|
-
└── vercel.json # Vercel deployment config
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## 🔗 API Endpoints
|
|
124
|
-
|
|
125
|
-
### Authentication
|
|
126
|
-
| Method | Endpoint | Description |
|
|
127
|
-
|--------|----------|-------------|
|
|
128
|
-
| POST | `/api/auth/register` | Register new user |
|
|
129
|
-
| POST | `/api/auth/login` | User login |
|
|
130
|
-
| POST | `/api/auth/refresh` | Refresh access token |
|
|
131
|
-
| POST | `/api/auth/logout` | User logout |
|
|
132
|
-
| GET | `/api/auth/verify-email/:token` | Verify email address |
|
|
133
|
-
| POST | `/api/auth/resend-verification` | Resend verification email |
|
|
134
|
-
| POST | `/api/auth/forgot-password` | Request password reset |
|
|
135
|
-
| POST | `/api/auth/reset-password` | Reset password |
|
|
136
|
-
|
|
137
|
-
### User Profile
|
|
138
|
-
| Method | Endpoint | Description |
|
|
139
|
-
|--------|----------|-------------|
|
|
140
|
-
| GET | `/api/auth/profile` | Get user profile |
|
|
141
|
-
| PUT | `/api/auth/profile` | Update user profile |
|
|
142
|
-
| POST | `/api/auth/change-password` | Change password |
|
|
143
|
-
|
|
144
|
-
### Health & Status
|
|
145
|
-
| Method | Endpoint | Description |
|
|
146
|
-
|--------|----------|-------------|
|
|
147
|
-
| GET | `/health` | Basic health check |
|
|
148
|
-
| GET | `/api/health` | Detailed health with database status |
|
|
149
|
-
|
|
150
|
-
## 🛠️ Development Commands
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
# Development
|
|
154
|
-
npm run dev # Start development server
|
|
155
|
-
npm run build # Build for production
|
|
156
|
-
npm start # Start production server
|
|
157
|
-
|
|
158
|
-
# Database
|
|
159
|
-
npm run db:generate # Generate Prisma client
|
|
160
|
-
npm run db:migrate # Run database migrations
|
|
161
|
-
npm run db:push # Push schema changes
|
|
162
|
-
npm run db:studio # Open Prisma Studio
|
|
163
|
-
npm run db:seed # Run database seeding
|
|
164
|
-
npm run db:reset # Reset database with seed
|
|
165
|
-
|
|
166
|
-
# Code Quality
|
|
167
|
-
npm run lint # Run ESLint
|
|
168
|
-
npm run lint:fix # Fix linting issues
|
|
169
|
-
npm run format # Format with Prettier
|
|
170
|
-
npm run type-check # TypeScript type checking
|
|
171
|
-
|
|
172
|
-
# Health Check
|
|
173
|
-
npm run health # Check API health
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## 📋 Prerequisites
|
|
177
|
-
|
|
178
|
-
- **Node.js** 18.0.0 or higher
|
|
179
|
-
- **npm** 8.0.0 or higher
|
|
180
|
-
- **PostgreSQL database** (recommend [Neon](https://neon.tech) for serverless)
|
|
181
|
-
- **Resend account** for email service (optional but recommended)
|
|
9
|
+
---
|
|
182
10
|
|
|
183
|
-
##
|
|
11
|
+
## ⚡ Quick Start
|
|
184
12
|
|
|
185
|
-
|
|
13
|
+
Create a production-grade backend API in seconds:
|
|
186
14
|
|
|
187
|
-
###
|
|
188
|
-
```bash
|
|
189
|
-
# 1. Sign up at neon.tech
|
|
190
|
-
# 2. Create a new database project
|
|
191
|
-
# 3. Copy connection strings from dashboard
|
|
192
|
-
# 4. Add to your .env file
|
|
193
|
-
|
|
194
|
-
DATABASE_URL="postgresql://user:password@host:port/db?sslmode=require"
|
|
195
|
-
DIRECT_URL="postgresql://user:password@host:port/db?sslmode=require"
|
|
196
|
-
```
|
|
15
|
+
### Using pnpm (Recommended)
|
|
197
16
|
|
|
198
|
-
### 2. **Email Service** (Resend)
|
|
199
17
|
```bash
|
|
200
|
-
|
|
201
|
-
# 2. Create API key in dashboard
|
|
202
|
-
# 3. Add to your .env file
|
|
203
|
-
|
|
204
|
-
RESEND_API_KEY="re_your_api_key_here"
|
|
205
|
-
FROM_EMAIL="noreply@yourdomain.com"
|
|
18
|
+
pnpm create arktos my-api
|
|
206
19
|
```
|
|
207
20
|
|
|
208
|
-
###
|
|
209
|
-
```bash
|
|
210
|
-
# Generate secure random strings
|
|
211
|
-
openssl rand -base64 32
|
|
21
|
+
### Using npx
|
|
212
22
|
|
|
213
|
-
JWT_SECRET="your-super-secure-jwt-secret"
|
|
214
|
-
JWT_REFRESH_SECRET="your-super-secure-refresh-secret"
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
### 4. **Complete .env Example**
|
|
218
|
-
Your `.env` file should look like this:
|
|
219
23
|
```bash
|
|
220
|
-
|
|
221
|
-
NODE_ENV=development
|
|
222
|
-
PORT=3001
|
|
223
|
-
FRONTEND_URL=http://localhost:3000
|
|
224
|
-
BACKEND_URL=http://localhost:3001
|
|
225
|
-
|
|
226
|
-
# Database (Neon PostgreSQL)
|
|
227
|
-
DATABASE_URL="postgresql://user:password@host:port/database?sslmode=require"
|
|
228
|
-
DIRECT_URL="postgresql://user:password@host:port/database?sslmode=require"
|
|
229
|
-
|
|
230
|
-
# JWT Configuration
|
|
231
|
-
JWT_SECRET="your-super-secure-jwt-secret-128-bits-minimum"
|
|
232
|
-
JWT_REFRESH_SECRET="your-super-secure-refresh-secret-128-bits-minimum"
|
|
233
|
-
JWT_EXPIRES_IN="15m"
|
|
234
|
-
JWT_REFRESH_EXPIRES_IN="7d"
|
|
235
|
-
|
|
236
|
-
# Email Service (Resend)
|
|
237
|
-
RESEND_API_KEY="re_xxxxxxxxxxxxxxxxxxxxxxxxxx"
|
|
238
|
-
FROM_EMAIL="noreply@yourdomain.com"
|
|
239
|
-
FROM_NAME="Your App Name"
|
|
240
|
-
|
|
241
|
-
# Security Settings
|
|
242
|
-
BCRYPT_SALT_ROUNDS=12
|
|
243
|
-
CORS_ORIGIN="http://localhost:3000,https://yourdomain.com"
|
|
24
|
+
npx create-arktos my-api
|
|
244
25
|
```
|
|
245
26
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
The generated project includes these pre-configured models:
|
|
249
|
-
|
|
250
|
-
### **Core Authentication**
|
|
251
|
-
- **Users** - Complete user management with roles (USER, ADMIN, MODERATOR)
|
|
252
|
-
- **LoginLog** - Comprehensive audit trail for all authentication attempts
|
|
253
|
-
- **EmailVerification** - Secure email verification with token expiration
|
|
254
|
-
- **PasswordReset** - Secure password reset workflow
|
|
255
|
-
- **RefreshToken** - JWT refresh token management with revocation
|
|
256
|
-
|
|
257
|
-
### **Business Models** (Ready to extend)
|
|
258
|
-
- **Booking** - For appointment/reservation systems
|
|
259
|
-
- **Product** - For e-commerce applications
|
|
260
|
-
- **Blog** - For content management systems
|
|
261
|
-
- **Payment** - For payment processing integration
|
|
262
|
-
|
|
263
|
-
All models include proper relationships, indexes, and cascade deletes for data integrity.
|
|
264
|
-
|
|
265
|
-
## 🔐 Security Features
|
|
266
|
-
|
|
267
|
-
### **Authentication & Authorization**
|
|
268
|
-
- JWT-based authentication with access & refresh tokens
|
|
269
|
-
- Role-based access control (RBAC)
|
|
270
|
-
- Email verification workflow
|
|
271
|
-
- Secure password reset flow
|
|
272
|
-
- Session management with token revocation
|
|
273
|
-
|
|
274
|
-
### **Security Middleware**
|
|
275
|
-
- **Rate Limiting** - Multi-tier limits (general, auth, API)
|
|
276
|
-
- **CORS Protection** - Configurable origins and credentials
|
|
277
|
-
- **Helmet.js** - Comprehensive security headers
|
|
278
|
-
- **Input Sanitization** - XSS protection and data cleaning
|
|
279
|
-
- **Request Validation** - Zod-based schema validation
|
|
280
|
-
|
|
281
|
-
### **Monitoring & Auditing**
|
|
282
|
-
- Login attempt logging with IP and user agent tracking
|
|
283
|
-
- Failed login attempt monitoring
|
|
284
|
-
- Request logging with Winston
|
|
285
|
-
- Database connection health monitoring
|
|
286
|
-
|
|
287
|
-
### **Password Security**
|
|
288
|
-
- Bcrypt hashing with configurable salt rounds
|
|
289
|
-
- Password strength requirements
|
|
290
|
-
- Secure password reset tokens
|
|
291
|
-
- Account lockout protection
|
|
292
|
-
|
|
293
|
-
## 🚀 Deployment
|
|
294
|
-
|
|
295
|
-
### **Vercel Deployment** (Recommended)
|
|
296
|
-
|
|
297
|
-
The generated project includes Vercel configuration for seamless deployment:
|
|
27
|
+
### Using bun
|
|
298
28
|
|
|
299
29
|
```bash
|
|
300
|
-
|
|
301
|
-
git add .
|
|
302
|
-
git commit -m "Initial commit"
|
|
303
|
-
git push origin main
|
|
304
|
-
|
|
305
|
-
# 2. Connect to Vercel
|
|
306
|
-
# - Go to vercel.com
|
|
307
|
-
# - Import your GitHub repository
|
|
308
|
-
# - Vercel will automatically detect the configuration
|
|
309
|
-
|
|
310
|
-
# 3. Set environment variables in Vercel dashboard
|
|
311
|
-
# All the variables from your .env file
|
|
30
|
+
bun create arktos my-api
|
|
312
31
|
```
|
|
313
32
|
|
|
314
|
-
|
|
33
|
+
---
|
|
315
34
|
|
|
316
|
-
|
|
35
|
+
## 🚀 Getting Started with Your New Project
|
|
317
36
|
|
|
318
37
|
```bash
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
DIRECT_URL=your_neon_production_direct_url
|
|
322
|
-
JWT_SECRET=your_production_jwt_secret_128_bits
|
|
323
|
-
JWT_REFRESH_SECRET=your_production_refresh_secret_128_bits
|
|
324
|
-
RESEND_API_KEY=your_production_resend_api_key
|
|
325
|
-
FRONTEND_URL=https://yourdomain.com
|
|
326
|
-
BACKEND_URL=https://your-api.vercel.app
|
|
327
|
-
CORS_ORIGIN=https://yourdomain.com,https://www.yourdomain.com
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
### **Other Deployment Options**
|
|
331
|
-
|
|
332
|
-
<details>
|
|
333
|
-
<summary>🐳 <strong>Docker Deployment</strong></summary>
|
|
334
|
-
|
|
335
|
-
```dockerfile
|
|
336
|
-
# Dockerfile will be generated in future versions
|
|
337
|
-
FROM node:18-alpine
|
|
338
|
-
WORKDIR /app
|
|
339
|
-
COPY package*.json ./
|
|
340
|
-
RUN npm ci --only=production
|
|
341
|
-
COPY . .
|
|
342
|
-
RUN npm run build
|
|
343
|
-
EXPOSE 3001
|
|
344
|
-
CMD ["npm", "start"]
|
|
345
|
-
```
|
|
346
|
-
</details>
|
|
347
|
-
|
|
348
|
-
<details>
|
|
349
|
-
<summary>☁️ <strong>Railway/Render Deployment</strong></summary>
|
|
38
|
+
# 1. Navigate to your project
|
|
39
|
+
cd my-api
|
|
350
40
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
</details>
|
|
41
|
+
# 2. Configure environment variables
|
|
42
|
+
cp .env.example .env
|
|
43
|
+
# Edit .env with your DATABASE_URL (Neon / PostgreSQL), JWT_SECRET, and RESEND_API_KEY
|
|
355
44
|
|
|
356
|
-
|
|
45
|
+
# 3. Install dependencies
|
|
46
|
+
pnpm install
|
|
357
47
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
# Test basic health
|
|
361
|
-
curl http://localhost:3001/health
|
|
48
|
+
# 4. Run database migrations
|
|
49
|
+
pnpm dlx prisma migrate dev
|
|
362
50
|
|
|
363
|
-
#
|
|
364
|
-
|
|
365
|
-
```
|
|
51
|
+
# 5. (Optional) Seed initial data
|
|
52
|
+
pnpm db:seed
|
|
366
53
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
# Register a new user
|
|
370
|
-
curl -X POST http://localhost:3001/api/auth/register \
|
|
371
|
-
-H "Content-Type: application/json" \
|
|
372
|
-
-d '{"email":"test@example.com","password":"password123","firstName":"John","lastName":"Doe"}'
|
|
373
|
-
|
|
374
|
-
# Login
|
|
375
|
-
curl -X POST http://localhost:3001/api/auth/login \
|
|
376
|
-
-H "Content-Type: application/json" \
|
|
377
|
-
-d '{"email":"test@example.com","password":"password123"}'
|
|
378
|
-
|
|
379
|
-
# Get profile (requires Bearer token)
|
|
380
|
-
curl -X GET http://localhost:3001/api/auth/profile \
|
|
381
|
-
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"
|
|
54
|
+
# 6. Start development server
|
|
55
|
+
pnpm dev
|
|
382
56
|
```
|
|
383
57
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
### **Basic Express Server**
|
|
387
|
-
The generated `src/app.ts` provides a production-ready Express server:
|
|
58
|
+
Your API is live and hot-reloading at **`http://localhost:3001`** 🚀
|
|
388
59
|
|
|
389
|
-
|
|
390
|
-
import express from 'express';
|
|
391
|
-
import DatabaseService from './services/database.service';
|
|
392
|
-
import { middleware } from './middleware';
|
|
393
|
-
import routes from './routes';
|
|
394
|
-
|
|
395
|
-
const app = express();
|
|
396
|
-
const dbService = DatabaseService.getInstance();
|
|
397
|
-
|
|
398
|
-
// Apply security middleware
|
|
399
|
-
app.use(middleware.security);
|
|
400
|
-
app.use(middleware.cors);
|
|
401
|
-
app.use(middleware.rateLimit.general);
|
|
402
|
-
|
|
403
|
-
// API routes
|
|
404
|
-
app.use('/api', routes);
|
|
405
|
-
|
|
406
|
-
export default app;
|
|
407
|
-
```
|
|
60
|
+
---
|
|
408
61
|
|
|
409
|
-
|
|
410
|
-
```typescript
|
|
411
|
-
// src/routes/custom.routes.ts
|
|
412
|
-
import { Router } from 'express';
|
|
413
|
-
import { middleware } from '../middleware';
|
|
62
|
+
## 🌟 What's Inside
|
|
414
63
|
|
|
415
|
-
|
|
64
|
+
- **⚡ Express 5 & TypeScript 5**: Type-safe REST APIs with clean layered architecture.
|
|
65
|
+
- **🔐 Enterprise Authentication**: Access & refresh tokens, password hashing (bcrypt), email verification, and password reset flows.
|
|
66
|
+
- **🗄️ Prisma ORM & PostgreSQL**: Neon serverless ready, migration pipelines, and type-safe database clients.
|
|
67
|
+
- **📧 Resend Integration**: Transactional emails with responsive HTML templates.
|
|
68
|
+
- **🛡️ Production Security**: Helmet HTTP headers, CORS whitelisting, IP rate limiting, and Zod input validation.
|
|
69
|
+
- **📝 Structured Logging**: Winston logger with log levels and formatted outputs.
|
|
416
70
|
|
|
417
|
-
|
|
418
|
-
router.get('/protected',
|
|
419
|
-
middleware.auth.required,
|
|
420
|
-
(req, res) => {
|
|
421
|
-
res.json({ message: 'Hello authenticated user!' });
|
|
422
|
-
}
|
|
423
|
-
);
|
|
71
|
+
---
|
|
424
72
|
|
|
425
|
-
|
|
426
|
-
router.get('/public', (req, res) => {
|
|
427
|
-
res.json({ message: 'Hello world!' });
|
|
428
|
-
});
|
|
73
|
+
## 🛠️ CLI Options
|
|
429
74
|
|
|
430
|
-
|
|
431
|
-
|
|
75
|
+
```bash
|
|
76
|
+
create-arktos [project-directory] [options]
|
|
432
77
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
// Example: Get all users
|
|
442
|
-
const users = await prisma.user.findMany({
|
|
443
|
-
select: {
|
|
444
|
-
id: true,
|
|
445
|
-
email: true,
|
|
446
|
-
firstName: true,
|
|
447
|
-
lastName: true,
|
|
448
|
-
}
|
|
449
|
-
});
|
|
450
|
-
|
|
451
|
-
// Example: Create a booking
|
|
452
|
-
const booking = await prisma.booking.create({
|
|
453
|
-
data: {
|
|
454
|
-
userId: user.id,
|
|
455
|
-
title: 'Meeting',
|
|
456
|
-
startDate: new Date(),
|
|
457
|
-
endDate: new Date(Date.now() + 3600000), // 1 hour later
|
|
458
|
-
}
|
|
459
|
-
});
|
|
78
|
+
Options:
|
|
79
|
+
-v, --version Display create-arktos version
|
|
80
|
+
--skip-git Skip automatic git repository initialization
|
|
81
|
+
--skip-update-check Skip checking for npm updates
|
|
82
|
+
--package-manager <pm> Specify package manager (pnpm, bun, yarn, npm)
|
|
83
|
+
--verbose Show detailed debug logs
|
|
84
|
+
-h, --help Display help
|
|
460
85
|
```
|
|
461
86
|
|
|
462
|
-
## 🤝 Contributing
|
|
463
|
-
|
|
464
|
-
We welcome contributions! Here's how you can help:
|
|
465
|
-
|
|
466
|
-
### **Reporting Issues**
|
|
467
|
-
- Use GitHub Issues for bug reports
|
|
468
|
-
- Include steps to reproduce
|
|
469
|
-
- Provide environment details
|
|
470
|
-
|
|
471
|
-
### **Feature Requests**
|
|
472
|
-
- Open a GitHub Issue with the "enhancement" label
|
|
473
|
-
- Describe the use case and expected behavior
|
|
474
|
-
|
|
475
|
-
### **Pull Requests**
|
|
476
|
-
1. Fork the repository
|
|
477
|
-
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
478
|
-
3. Make your changes
|
|
479
|
-
4. Add tests if applicable
|
|
480
|
-
5. Commit: `git commit -m 'Add amazing feature'`
|
|
481
|
-
6. Push: `git push origin feature/amazing-feature`
|
|
482
|
-
7. Open a Pull Request
|
|
483
|
-
|
|
484
|
-
## 📄 License
|
|
485
|
-
|
|
486
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
487
|
-
|
|
488
|
-
## 🙏 Acknowledgments
|
|
489
|
-
|
|
490
|
-
- **Express.js** team for the excellent web framework
|
|
491
|
-
- **Prisma** team for the amazing ORM and type safety
|
|
492
|
-
- **Resend** team for the modern email API
|
|
493
|
-
- **Neon** team for serverless PostgreSQL
|
|
494
|
-
- **Vercel** team for seamless deployment platform
|
|
495
|
-
- All the **open-source contributors** who made this possible
|
|
496
|
-
|
|
497
|
-
## ❓ FAQ
|
|
498
|
-
|
|
499
|
-
<details>
|
|
500
|
-
<summary><strong>Can I use this with a different database?</strong></summary>
|
|
501
|
-
|
|
502
|
-
Yes! While optimized for PostgreSQL, you can modify the Prisma schema to use MySQL, SQLite, or MongoDB. Update the `datasource` in `prisma/schema.prisma`.
|
|
503
|
-
</details>
|
|
504
|
-
|
|
505
|
-
<details>
|
|
506
|
-
<summary><strong>Can I use a different email provider?</strong></summary>
|
|
507
|
-
|
|
508
|
-
Absolutely! The email service is modular. You can replace Resend with SendGrid, AWS SES, or any other provider by modifying `src/services/email.service.ts`.
|
|
509
|
-
</details>
|
|
510
|
-
|
|
511
|
-
<details>
|
|
512
|
-
<summary><strong>How do I add more authentication providers?</strong></summary>
|
|
513
|
-
|
|
514
|
-
The architecture supports multiple auth providers. You can extend the `LoginType` enum in the Prisma schema and add OAuth routes in the auth controller.
|
|
515
|
-
</details>
|
|
516
|
-
|
|
517
|
-
<details>
|
|
518
|
-
<summary><strong>Is this production-ready?</strong></summary>
|
|
519
|
-
|
|
520
|
-
Yes! The boilerplate includes production-ready features like security middleware, error handling, logging, health checks, and deployment configurations.
|
|
521
|
-
</details>
|
|
522
|
-
|
|
523
87
|
---
|
|
524
88
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
**Built with ❤️ by [Zafer Gök](https://github.com/zzafergok)**
|
|
89
|
+
## 📄 License
|
|
528
90
|
|
|
529
|
-
|
|
91
|
+
This project is licensed under the **Business Source License 1.1 (BSL 1.1)**.
|
|
530
92
|
|
|
531
|
-
|
|
93
|
+
- Free for evaluation, personal, educational, internal development, and non-commercial use.
|
|
94
|
+
- Commercial or production deployments require a commercial license agreement with the author.
|
|
95
|
+
- On **January 1, 2030**, the license automatically converts to **Apache 2.0 / MIT**.
|
|
532
96
|
|
|
533
|
-
|
|
97
|
+
For commercial inquiries: [gok.zaferr@gmail.com](mailto:gok.zaferr@gmail.com) | [GitHub @zzafergok](https://github.com/zzafergok)
|