Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .env

This file was deleted.

31 changes: 31 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Gemini API key for AI services (used in vite and backend)
GEMINI_API_KEY=your_gemini_api_key_here
# Duplicate alias for services/geminiService.ts (API_KEY fallback)
API_KEY=${GEMINI_API_KEY}

# Database connection URL (SQLite for local dev / production volume)
# For Docker volume mount use: DATABASE_URL="file:/app/data/data.db"
DATABASE_URL="file:./data.db"

# Mapit shipping provider
MAPIT_API_KEY=your_mapit_api_key_here
MAPIT_API_URL=https://api.mapit.example/v1/shipments
MAPIT_WEBHOOK_SECRET=your_mapit_webhook_secret_here

# MyFatora payment provider
MYFATORA_API_KEY=your_myfatora_api_key_here
MYFATORA_API_URL=https://api.myfatora.example/v1/payments
MYFATORA_WEBHOOK_SECRET=your_myfatora_webhook_secret_here

# Telegram bot for notifications
TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here
TELEGRAM_TEST_CHAT_ID=your_telegram_chat_id_here

# Server configuration
# Adjust PORT to match Dockerfile or systemd service
PORT=3000
CORS_ORIGIN=https://onlainee.space
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing important environment variables in the example file. The NODE_ENV variable is referenced in the health endpoint (line 28 of server.ts) but is not documented in .env.example. Add NODE_ENV=development to the example file for completeness.

Suggested change
CORS_ORIGIN=https://onlainee.space
CORS_ORIGIN=https://onlainee.space
NODE_ENV=development

Copilot uses AI. Check for mistakes.
NODE_ENV=development

# Optional Telegram default chat id for testing notifications
TELEGRAM_DEFAULT_CHAT_ID=
69 changes: 69 additions & 0 deletions .github/workflows/auto-deploy-onlainee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Auto Deploy to onlainee.space

on:
push:
branches:
- copilot/add-integration-repository-setup
workflow_dispatch:

jobs:
deploy:
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 and build frontend
run: |
npm ci
npm run build

- name: Deploy to Hostinger via SSH
uses: appleboy/ssh-action@v1.0.1
with:
host: ${{ secrets.VPS_HOST }}
username: ${{ secrets.VPS_USER }}
key: ${{ secrets.VPS_SSH_KEY }}
script: |
set -e
cd /srv/logisa
echo "Pulling latest code..."
git fetch --all --prune
git checkout copilot/add-integration-repository-setup
git pull origin copilot/add-integration-repository-setup

echo "Installing dependencies..."
npm ci

echo "Generating Prisma..."
npx prisma generate

echo "Running migrations..."
npx prisma migrate deploy || true

echo "Building frontend..."
npm run build

echo "Restarting service..."
systemctl restart logisa

echo "✅ Deployment successful!"
systemctl status logisa --no-pager || true

- name: Notify on Success
if: success()
run: |
echo "✅ Deployment to https://onlainee.space completed successfully!"
echo "Frontend: https://onlainee.space"
echo "API: https://onlainee.space/api/"

- name: Notify on Failure
if: failure()
run: |
echo "❌ Deployment failed. Check logs above."
55 changes: 55 additions & 0 deletions .github/workflows/deploy-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Deploy to GitHub Pages

on:
push:
branches:
- fahad
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
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

- name: Build frontend
run: npm run build
env:
VITE_BASE: /fahad332/

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build

steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
61 changes: 61 additions & 0 deletions .github/workflows/deploy-ssh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy via SSH

on:
push:
branches:
- copilot/add-integration-repository-setup
workflow_dispatch:

jobs:
deploy:
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: Build frontend
run: |
npm ci
npm run build

- name: Package dist
run: |
tar -czf dist.tar.gz dist

- name: Deploy dist + backend (rsync) over SSH
uses: appleboy/scp-action@v0.2.4
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
source: "dist.tar.gz"
target: "${{ secrets.APP_DIR }}/"

- name: Remote unpack + install + restart
uses: appleboy/ssh-action@v1.0.1
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
script: |
set -e
cd ${{ secrets.APP_DIR }}
tar -xzf dist.tar.gz
rm -f dist.tar.gz
if [ ! -d node_modules ]; then npm ci; fi
npx prisma generate
npx prisma migrate deploy || true
systemctl restart logisa || echo "Service not found"
echo "Deployment finished"

# Required Secrets:
# SSH_HOST=147.93.120.99
# SSH_USER=deploy (or root)
# SSH_KEY=private key content
# APP_DIR=/srv/logisa
62 changes: 62 additions & 0 deletions .github/workflows/smoke-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Smoke Tests

on:
push:
branches:
- fahad
pull_request:
branches:
- fahad

permissions:
contents: read

jobs:
smoke-tests:
runs-on: ubuntu-latest

env:
DATABASE_URL: "file:./test.db"
PORT: 3001
CORS_ORIGIN: "*"

steps:
- name: Checkout repository
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

- name: Generate Prisma client
run: npx prisma generate

- name: Run database migrations
run: npx prisma migrate deploy || npx prisma db push

- name: Start backend server
run: |
npm run dev:backend &
echo $! > /tmp/server.pid
env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_TEST_CHAT_ID: ${{ secrets.TELEGRAM_TEST_CHAT_ID }}

- name: Run smoke tests
run: |
chmod +x scripts/test/smoke.sh
./scripts/test/smoke.sh
env:
BASE_URL: http://localhost:3001

- name: Stop backend server
if: always()
run: |
if [ -f /tmp/server.pid ]; then
kill $(cat /tmp/server.pid) || true
fi
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,16 @@ dist-ssr
*.njsproj
*.sln
*.sw?

# Environment variables (keep secrets out of git)
.env
.env.local
.env.*.local
!.env.example

# Prisma
prisma/*.db
prisma/*.db-journal

# Build outputs
build/
Loading