create-vitnode-app 0.0.10-canary.8 → 0.1.0-rc.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 (27) hide show
  1. package/dist/index.cjs +33 -33
  2. package/package.json +4 -4
  3. package/templates/basic/.gitignore_template +2 -1
  4. package/templates/basic/apps/backend/src/app.module.ts +4 -0
  5. package/templates/basic/apps/backend/tsconfig.json +1 -1
  6. package/templates/basic/apps/backend/uploads/public/assets/favicon.ico +0 -0
  7. package/templates/basic/apps/frontend/global.d.ts +4 -2
  8. package/templates/basic/apps/frontend/public/sw.js +3 -0
  9. package/templates/basic/apps/frontend/src/app/[locale]/(main)/(layout)/footer.tsx +18 -0
  10. package/templates/basic/apps/frontend/src/app/[locale]/(main)/(layout)/layout.tsx +8 -1
  11. package/templates/basic/apps/frontend/src/app/global.css +11 -7
  12. package/templates/basic/apps/frontend/src/app/robots.ts +9 -0
  13. package/templates/basic/apps/frontend/src/app/sitemap.ts +9 -0
  14. package/templates/basic/apps/frontend/src/middleware.ts +1 -1
  15. package/templates/basic/apps/frontend/src/plugins/admin/langs/en.json +136 -113
  16. package/templates/basic/apps/frontend/src/plugins/core/langs/en.json +58 -32
  17. package/templates/basic/apps/frontend/src/plugins/welcome/langs/en.json +2 -4
  18. package/templates/basic/apps/frontend/src/plugins/welcome/templates/default-page.tsx +1 -1
  19. package/templates/basic/apps/frontend/tailwind.config.ts +1 -0
  20. package/templates/basic/apps/frontend/tsconfig.json +7 -1
  21. package/templates/basic/apps/shared/plugins/welcome/example.dto.ts +0 -3
  22. package/templates/basic/apps/shared/tsconfig.json +2 -2
  23. package/templates/basic/turbo.json +4 -0
  24. package/templates/docker/apps/backend/DockerFile +2 -1
  25. package/templates/docker/apps/frontend/DockerFile +1 -1
  26. package/templates/docker/deploy.sh +213 -0
  27. package/templates/docker/docker-compose.yml +3 -1
@@ -182,28 +182,25 @@
182
182
  },
183
183
  "settings": {
184
184
  "title": "Settings",
185
- "desc": "Manage your account settings.",
186
185
  "open_sheet": "Open Menu",
187
186
  "open_sheet_desc": "You can change your account settings here.",
188
- "change_avatar": {
189
- "title": "Change Avatar",
190
- "desc": "Choose one option to change your avatar.",
191
- "options": {
192
- "upload": {
193
- "title": "Upload a new avatar",
194
- "success": "Your avatar has been changed.",
195
- "error": "An error occurred while uploading your avatar."
196
- },
197
- "delete": {
198
- "title": "Delete avatar",
199
- "success": "Your avatar has been deleted.",
200
- "error": "An error occurred while deleting your avatar."
187
+ "overview": {
188
+ "title": "Overview",
189
+ "change_avatar": {
190
+ "title": "Change Avatar",
191
+ "desc": "Show your personality with a new avatar.",
192
+ "submit": "Change Avatar",
193
+ "success": "Your avatar has been changed.",
194
+ "types": {
195
+ "upload": "Upload a new avatar",
196
+ "delete": "Delete avatar"
201
197
  }
202
198
  },
203
- "submit": "Change Avatar"
204
- },
205
- "overview": {
206
- "title": "Overview"
199
+ "basic_info": {
200
+ "title": "Basic Information",
201
+ "email": "Email",
202
+ "joined_at": "Joined at"
203
+ }
207
204
  },
208
205
  "files": {
209
206
  "title": "My Files",
@@ -232,29 +229,59 @@
232
229
  "sign_in": {
233
230
  "title": "Login",
234
231
  "desc": "You don't have an account? <link></link>.",
232
+ "or": "or",
235
233
  "sign_up": "Sign Up",
236
234
  "email": "Email",
237
235
  "password": "Password",
238
- "remember": {
239
- "label": "Remember me",
240
- "desc": "Not recommended on shared computers."
241
- },
242
236
  "submit": "Log In",
237
+ "sso_first_login": {
238
+ "title": "Almost there!",
239
+ "desc": "Please complete your registration by entering your name."
240
+ },
243
241
  "error": {
244
242
  "title": "Invalid credentials",
245
243
  "desc": "The email address or password was incorrect. Please try again (make sure your caps lock is off)."
246
244
  },
247
245
  "not_verified": {
248
246
  "title": "Email is not verified",
249
- "desc": "Please check your inbox and click the link to activate your account."
247
+ "desc": "Please check your inbox and click the link to activate your account.",
248
+ "resend": "To resend the verification email you have to sign in again. We'll send you a new email if the previous has 10 minutes or more."
249
+ },
250
+ "forgot_password": {
251
+ "title": "Forgot Password?",
252
+ "desc": "Don't worry! We'll help you reset your password.",
253
+ "email": "Email",
254
+ "go_back_login": "Go back to login",
255
+ "send": "Send Email",
256
+ "success": {
257
+ "title": "Email Sent!",
258
+ "desc": "We've sent a password reset email to <email></email>.",
259
+ "warning": "Please check your inbox and follow the instructions."
260
+ },
261
+ "change_password": {
262
+ "title": "Change Password",
263
+ "desc": "Almost done!",
264
+ "new_password": "New Password",
265
+ "error": "We can't reset your password. Please check the link or try again.",
266
+ "success": {
267
+ "title": "Password Changed!",
268
+ "desc": "Your password has been changed successfully!",
269
+ "sign_in": "Go to Sign In"
270
+ }
271
+ },
272
+ "content_email": {
273
+ "subject": "Reset your password",
274
+ "preview": "You're receiving this email because you requested a password reset for your account.",
275
+ "p": "Someone recently requested a password change for your account. If this was you, you can set a new password here:",
276
+ "button": "Reset Password",
277
+ "security": "This link will expire in 15 minutes. If you don't want to change your password or didn't request this, just ignore and delete this message."
278
+ }
250
279
  }
251
280
  },
252
281
  "sign_up": {
253
282
  "title": "Register",
254
283
  "desc": "You already have an account? <link></link>.",
255
284
  "sign_in": "Sign In",
256
- "week_password": "Week",
257
- "strong_password": "Strong",
258
285
  "email_invalid": "This email address is invalid.",
259
286
  "name": {
260
287
  "label": "Nickname",
@@ -269,7 +296,11 @@
269
296
  },
270
297
  "password": {
271
298
  "label": "Password",
272
- "desc": "Min 8 characters, lowercase uppercase letter, number and special character."
299
+ "desc": "Password must have:",
300
+ "min_length": "At least 8 characters",
301
+ "uppercase": "At least one uppercase letter",
302
+ "number": "At least one number",
303
+ "special_char": "At least one special character"
273
304
  },
274
305
  "terms": {
275
306
  "label": "Accept terms and conditions",
@@ -312,9 +343,8 @@
312
343
  },
313
344
  "legal": {
314
345
  "title": "Legal & Policies",
315
- "title_page": "Explore our Legal documents and Policies",
346
+ "title_page": "Legal documents and Policies",
316
347
  "last_updated": "Last updated: <date></date>",
317
- "read_document": "Read Document",
318
348
  "empty": "No documents found."
319
349
  }
320
350
  },
@@ -328,8 +358,6 @@
328
358
  "settings_email": "Email",
329
359
  "settings_authorization": "Authorization",
330
360
  "settings_legal": "Legal & Policies",
331
- "security": "Security",
332
- "security_spam": "Spam Protection",
333
361
  "plugins": "Plugins",
334
362
  "styles": "Styles",
335
363
  "styles_theme-editor": "Theme Editor",
@@ -349,8 +377,6 @@
349
377
  "can_manage_settings_authorization": "Can manage authorization settings?",
350
378
  "can_manage_settings_legal": "Can manage legal settings?",
351
379
  "can_manage_plugins": "Can manage plugins?",
352
- "security": "Security",
353
- "can_manage_security_spam": "Can manage spam protection?",
354
380
  "styles": "Styles",
355
381
  "can_manage_styles_theme-editor": "Can manage theme editor?",
356
382
  "can_manage_styles_nav": "Can manage navigation?",
@@ -9,9 +9,7 @@
9
9
  },
10
10
  "admin_welcome": {
11
11
  "nav": {
12
- "title": "Welcome",
13
- "test": "Test",
14
- "test_testchild": "Test Child"
12
+ "title": "Welcome"
15
13
  }
16
14
  }
17
- }
15
+ }
@@ -7,7 +7,7 @@ export default function DefaultPage() {
7
7
  const t = useTranslations('welcome.home');
8
8
 
9
9
  return (
10
- <main className="container my-10 flex max-w-5xl flex-wrap items-center justify-between gap-8 px-8">
10
+ <main className="container flex max-w-5xl flex-wrap items-center justify-between gap-8 px-8 py-10">
11
11
  <div className="max-w-md space-y-4">
12
12
  <h1 className="text-balance text-3xl font-bold tracking-tight md:text-4xl">
13
13
  {t('title')}
@@ -9,6 +9,7 @@ const config = {
9
9
  './src/components/**/*.tsx',
10
10
  './src/app/**/*.tsx',
11
11
  './src/plugins/**/templates/**/*.tsx',
12
+ './src/plugins/**/components/**/*.tsx',
12
13
  ],
13
14
  } satisfies Config;
14
15
 
@@ -22,6 +22,12 @@
22
22
  "@/*": ["./src/*"]
23
23
  }
24
24
  },
25
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25
+ "include": [
26
+ "next-env.d.ts",
27
+ "**/*.ts",
28
+ "**/*.tsx",
29
+ ".next/types/**/*.ts",
30
+ "public/sw.js"
31
+ ],
26
32
  "exclude": ["node_modules"]
27
33
  }
@@ -1,3 +0,0 @@
1
- export interface ExampleBody {
2
- name: string;
3
- }
@@ -3,8 +3,8 @@
3
3
  "extends": "eslint-config-typescript-vitnode/tsconfig.nest.json",
4
4
  "compilerOptions": {
5
5
  "target": "ESNext",
6
- "module": "commonjs",
7
- "moduleResolution": "Node",
6
+ "module": "Node16",
7
+ "moduleResolution": "Node16",
8
8
  "outDir": "./dist",
9
9
  "rootDir": "./plugins",
10
10
  "esModuleInterop": true,
@@ -18,6 +18,10 @@
18
18
  "lint:fix": {
19
19
  "dependsOn": ["^lint:fix"]
20
20
  },
21
+ "config:init": {
22
+ "dependsOn": ["^config:init"],
23
+ "cache": false
24
+ },
21
25
  "db": {
22
26
  "dependsOn": ["^db"],
23
27
  "cache": false
@@ -5,7 +5,7 @@ RUN npm i -g pnpm
5
5
 
6
6
  FROM base AS builder
7
7
  WORKDIR /app
8
- RUN npm i -g turbo@~2.0.6
8
+ RUN npm i -g turbo@^2
9
9
  COPY . .
10
10
  RUN turbo telemetry disable
11
11
  RUN turbo prune backend --docker
@@ -15,6 +15,7 @@ WORKDIR /app
15
15
  COPY --from=builder /app/out/json/ .
16
16
  RUN pnpm i
17
17
  COPY --from=builder /app/out/full/ .
18
+ RUN pnpm config:init -- --skip-database
18
19
  RUN pnpm turbo build --filter=backend...
19
20
 
20
21
  FROM base AS runner
@@ -12,7 +12,7 @@ RUN turbo prune frontend --docker
12
12
  FROM base AS installer
13
13
  WORKDIR /app
14
14
  COPY --from=builder /app/out/json/ .
15
- RUN pnpm i
15
+ RUN pnpm i --ignore-scripts
16
16
  COPY --from=builder /app/out/full/ .
17
17
  COPY --from=builder /app/.prettierrc.mjs ./
18
18
 
@@ -0,0 +1,213 @@
1
+ #!/bin/bash
2
+
3
+ # Environment variables
4
+ DOMAIN_MAIN_NAME="your_website.com"
5
+ DOMAIN_FRONTEND_NAME="your_website.com"
6
+ DOMAIN_BACKEND_NAME="backend.your_website.com"
7
+ EMAIL="contact@your_website.com"
8
+ DB_USER=$(openssl rand -base64 8) # Generate a random 8-character username
9
+ DB_PASSWORD=$(openssl rand -base64 12) # Generate a random 12-character password
10
+ DB_DATABASE="vitnode"
11
+ LOGIN_TOKEN_SECRET=$(openssl rand -base64 32) # Generate a random 32-character secret
12
+
13
+ # Other variables (do not change unless you know what you are doing)
14
+ SWAP_SIZE="1G" # Swap size of 1GB
15
+
16
+ # ================================
17
+ # ================================
18
+ # ================================
19
+
20
+ # Update package list and upgrade existing packages
21
+ sudo apt update && sudo apt upgrade -y
22
+
23
+ # Add Swap Space
24
+ if ! sudo swapon --show | grep -q '/swapfile'; then
25
+ sudo fallocate -l $SWAP_SIZE /swapfile
26
+ sudo chmod 600 /swapfile
27
+ sudo mkswap /swapfile
28
+ sudo swapon /swapfile
29
+
30
+ # Make swap permanent
31
+ echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
32
+ else
33
+ echo "Swap file already exists and is active."
34
+ fi
35
+
36
+ # ================================
37
+ # Install Nginx
38
+ sudo apt install nginx -y
39
+
40
+ # Delete the default Nginx configuration file if it exists
41
+ if [ -f /etc/nginx/sites-available/default ]; then
42
+ sudo rm -f /etc/nginx/sites-available/default
43
+ fi
44
+
45
+ if [ -L /etc/nginx/sites-enabled/default ]; then
46
+ sudo rm -f /etc/nginx/sites-enabled/default
47
+ fi
48
+
49
+ # Stop Nginx temporarily to allow Certbot to run in standalone mode
50
+ sudo systemctl stop nginx
51
+
52
+ # Obtain SSL certificate using Certbot standalone mode
53
+ sudo apt install certbot -y
54
+ sudo certbot certonly --standalone -d $DOMAIN_FRONTEND_NAME -d $DOMAIN_BACKEND_NAME --non-interactive --agree-tos -m contact@vitnode.com --cert-name $DOMAIN_MAIN_NAME
55
+
56
+ # Ensure SSL files exist or generate them
57
+ if [ ! -f /etc/letsencrypt/options-ssl-nginx.conf ]; then
58
+ sudo wget https://raw.githubusercontent.com/certbot/certbot/main/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf -P /etc/letsencrypt/
59
+ fi
60
+
61
+ if [ ! -f /etc/letsencrypt/ssl-dhparams.pem ]; then
62
+ sudo openssl dhparam -out /etc/letsencrypt/ssl-dhparams.pem 2048
63
+ fi
64
+
65
+ # Create Nginx config with reverse proxy, SSL support, rate limiting, and streaming support for both frontend and backend
66
+ sudo tee /etc/nginx/sites-available/vitnode > /dev/null <<EOL
67
+ limit_req_zone \$binary_remote_addr zone=mylimit:10m rate=10r/s;
68
+
69
+ # Frontend Server Block
70
+ server {
71
+ listen 80;
72
+ server_name $DOMAIN_FRONTEND_NAME;
73
+
74
+ # Redirect all HTTP requests to HTTPS
75
+ return 301 https://\$host\$request_uri;
76
+ }
77
+
78
+ server {
79
+ listen 443 ssl;
80
+ server_name $DOMAIN_FRONTEND_NAME;
81
+
82
+ ssl_certificate /etc/letsencrypt/live/$DOMAIN_MAIN_NAME/fullchain.pem;
83
+ ssl_certificate_key /etc/letsencrypt/live/$DOMAIN_MAIN_NAME/privkey.pem;
84
+ include /etc/letsencrypt/options-ssl-nginx.conf;
85
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
86
+
87
+ # Enable rate limiting
88
+ limit_req zone=mylimit burst=20 nodelay;
89
+
90
+ location / {
91
+ proxy_pass http://localhost:3000;
92
+ proxy_http_version 1.1;
93
+ proxy_set_header Upgrade \$http_upgrade;
94
+ proxy_set_header Connection 'upgrade';
95
+ proxy_set_header Host \$host;
96
+ proxy_cache_bypass \$http_upgrade;
97
+
98
+ # Disable buffering for streaming support
99
+ proxy_buffering off;
100
+ proxy_set_header X-Accel-Buffering no;
101
+ }
102
+ }
103
+
104
+ # Backend Server Block
105
+ server {
106
+ listen 80;
107
+ server_name $DOMAIN_BACKEND_NAME;
108
+
109
+ # Redirect all HTTP requests to HTTPS
110
+ return 301 https://\$host\$request_uri;
111
+ }
112
+
113
+ server {
114
+ listen 443 ssl;
115
+ server_name $DOMAIN_BACKEND_NAME;
116
+
117
+ ssl_certificate /etc/letsencrypt/live/$DOMAIN_MAIN_NAME/fullchain.pem;
118
+ ssl_certificate_key /etc/letsencrypt/live/$DOMAIN_MAIN_NAME/privkey.pem;
119
+ include /etc/letsencrypt/options-ssl-nginx.conf;
120
+ ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
121
+
122
+ # Enable rate limiting
123
+ limit_req zone=mylimit burst=20 nodelay;
124
+
125
+ location / {
126
+ proxy_pass http://localhost:8080;
127
+ proxy_http_version 1.1;
128
+ proxy_set_header Upgrade \$http_upgrade;
129
+ proxy_set_header Connection 'upgrade';
130
+ proxy_set_header Host \$host;
131
+ proxy_cache_bypass \$http_upgrade;
132
+
133
+ # Disable buffering for streaming support
134
+ proxy_buffering off;
135
+ proxy_set_header X-Accel-Buffering no;
136
+ }
137
+ }
138
+ EOL
139
+
140
+ # Create symbolic link if it doesn't already exist
141
+ if [ ! -f /etc/nginx/sites-enabled/vitnode ]; then
142
+ sudo ln -s /etc/nginx/sites-available/vitnode /etc/nginx/sites-enabled/vitnode
143
+ fi
144
+
145
+ # Restart Nginx to apply the new configuration
146
+ sudo systemctl restart nginx
147
+
148
+ # ================================
149
+
150
+ # Add Docker's official GPG key:
151
+ sudo apt-get update
152
+ sudo apt-get install ca-certificates curl
153
+ sudo install -m 0755 -d /etc/apt/keyrings
154
+ sudo curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
155
+ sudo chmod a+r /etc/apt/keyrings/docker.asc
156
+
157
+ # Add the repository to Apt sources:
158
+ echo \
159
+ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \
160
+ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
161
+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
162
+ sudo apt-get update
163
+ sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
164
+
165
+ # Install Docker Compose
166
+ sudo rm -f /usr/local/bin/docker-compose
167
+ sudo curl -L "https://github.com/docker/compose/releases/download/v2.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
168
+
169
+
170
+ # Wait for the file to be fully downloaded before proceeding
171
+ if [ ! -f /usr/local/bin/docker-compose ]; then
172
+ echo "Docker Compose download failed. Exiting."
173
+ exit 1
174
+ fi
175
+
176
+ sudo chmod +x /usr/local/bin/docker-compose
177
+
178
+ # Ensure Docker Compose is executable and in path
179
+ sudo ln -sf /usr/local/bin/docker-compose /usr/bin/docker-compose
180
+
181
+ # Verify Docker Compose installation
182
+ docker-compose --version
183
+ if [ $? -ne 0 ]; then
184
+ echo "Docker Compose installation failed. Exiting."
185
+ exit 1
186
+ fi
187
+
188
+ # Ensure Docker starts on boot and start Docker service
189
+ sudo systemctl enable docker
190
+ sudo systemctl start docker
191
+
192
+ # Create a .env file
193
+ if [ ! -f "./.env" ]; then
194
+ echo "LOGIN_TOKEN_SECRET=$LOGIN_TOKEN_SECRET" > "./.env"
195
+ echo "NEXT_PUBLIC_BACKEND_CLIENT_URL=https://$DOMAIN_BACKEND_NAME" >> "./.env"
196
+ echo "NEXT_PUBLIC_FRONTEND_URL=https://$DOMAIN_FRONTEND_NAME" >> "./.env"
197
+ echo "DB_USER=$DB_USER" >> "./.env"
198
+ echo "DB_PASSWORD=$DB_PASSWORD" >> "./.env"
199
+ echo "DB_DATABASE=$DB_DATABASE" >> "./.env"
200
+ else
201
+ echo ".env file already exists. Skipping creation."
202
+ fi
203
+
204
+ sudo docker-compose -f ./docker-compose.yml -p vitnode up --build -d
205
+
206
+ sudo chown -R 1001:1001 ./apps/backend/src/plugins/core
207
+ sudo chown -R 1001:1001 ./apps/backend/uploads
208
+
209
+ # Check if Docker Compose started correctly
210
+ if ! sudo docker-compose ps | grep "Up"; then
211
+ echo "Docker containers failed to start. Check logs with 'docker-compose logs'."
212
+ exit 1
213
+ fi
@@ -27,12 +27,14 @@ services:
27
27
  DB_HOST: ${DB_HOST:-database}
28
28
  env_file:
29
29
  - .env
30
- command: sh -c "cd apps/backend && pnpm config:init && node dist/main.js"
30
+ command: sh -c "cd apps/backend && npm run config:init && node dist/main.js"
31
31
  ports:
32
32
  - '8080:8080'
33
33
  volumes:
34
34
  - ./apps/backend/uploads:/app/apps/backend/uploads # uploads
35
35
  - ./apps/backend/src/plugins/core:/app/apps/backend/src/plugins/core # core
36
+ - ./apps/frontend/src/plugins/admin/langs:/app/apps/frontend/src/plugins/admin/langs # admin - langs
37
+ - ./apps/frontend/src/plugins/core/langs:/app/apps/frontend/src/plugins/core/langs # core - langs
36
38
  networks:
37
39
  - vitnode
38
40
  frontend: