-
Notifications
You must be signed in to change notification settings - Fork 0
Deployment
sobhan azimzadeh edited this page Sep 18, 2025
·
1 revision
This guide covers deployment options and configurations for TECSOQR.
The project is configured for automatic deployment to GitHub Pages using GitHub Actions.
name: Deploy to GitHub Pages
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install Dependencies
run: npm ci --legacy-peer-deps
- name: Build
run: npm run build
env:
VITE_APP_TITLE: TeCSO QR
VITE_APP_DESCRIPTION: Modern QR Code Generator
VITE_APP_URL: https://sobhanaz.github.io/tecsoqr
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: dist
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4If you need to deploy manually:
# Build the project
npm run build
# Deploy to GitHub Pages
git add dist -f
git commit -m "Deploy to GitHub Pages"
git push origin gh-pages- Add CNAME file to
publicfolder:
qrcode.tecso.team
- Configure DNS settings:
Type: CNAME
Name: qrcode
Value: sobhanaz.github.io
Create .env.production:
VITE_APP_TITLE=TecsoQR
VITE_APP_DESCRIPTION=Modern QR Code Generator
VITE_APP_URL=https://qrcode.tecso.team-
Connect your GitHub repository to Cloudflare Pages
-
Configure build settings:
Build command: npm run build
Build output directory: dist
Node.js version: 20.x
- Add environment variables:
VITE_APP_TITLE=TecsoQR
VITE_APP_DESCRIPTION=Modern QR Code Generator
VITE_APP_URL=https://your-cloudflare-pages-url
- Add domain in Cloudflare Pages dashboard
- Configure DNS settings
- Wait for SSL certificate provisioning
// vite.config.ts
import { VitePWA } from "vite-plugin-pwa";
export default defineConfig({
plugins: [
VitePWA({
registerType: "autoUpdate",
includeAssets: ["assets/logo.svg"],
manifest: {
name: "TECSOQR",
short_name: "TECSOQR",
description: "Create Custom QR Codes for Free",
theme_color: "#0967D2",
background_color: "#ffffff",
display: "standalone",
icons: [
{
src: "assets/logo.svg",
sizes: "any",
type: "image/svg+xml",
purpose: "any maskable",
},
],
start_url: "/tecsoqr/",
scope: "/tecsoqr/",
},
workbox: {
globPatterns: ["**/*.{js,css,html,svg}"],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: "CacheFirst",
options: {
cacheName: "google-fonts-cache",
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365,
},
cacheableResponse: {
statuses: [0, 200],
},
},
},
],
},
}),
],
});The service worker is automatically generated and managed by the VitePWA plugin.
- Static Assets
- JavaScript files
- CSS files
- SVG images
- HTML files
- External Resources
- Google Fonts (CacheFirst strategy)
- API responses (NetworkFirst strategy)
- Configure Vite build:
// vite.config.ts
export default defineConfig({
build: {
outDir: "dist",
assetsDir: "assets",
sourcemap: true,
},
});- Enable chunking:
build: {
rollupOptions: {
output: {
manualChunks: {
vendor: ['react', 'react-dom'],
qr: ['qrcode']
}
}
}
}- Image optimization:
- Use SVG for logos
- Optimize PNGs and JPGs
- Implement lazy loading
- Font optimization:
- Use system fonts when possible
- Implement font-display: swap
- Preload critical fonts
- Content Security Policy:
Content-Security-Policy: default-src 'self'; img-src 'self' data:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com;
- CORS Headers:
Access-Control-Allow-Origin: https://qrcode.tecso.team
Ensure SSL is properly configured:
- Enable HTTPS
- Configure SSL certificates
- Enable HSTS
- Console error logging
- Error boundary implementation
- Service worker error handling
- Core Web Vitals tracking
- Load time monitoring
- User interaction tracking
- Regular code backups
- Database backups (if applicable)
- Configuration backups
- Rollback procedures
- Emergency contact list
- Incident response plan