# Marketplace — Server Deployment Info

## Server Access
- **IP**: 173.212.212.157
- **OS**: Ubuntu 24.04.2 LTS
- **SSH User**: root
- **SSH Password**: V8Padp8oIwl8m3RP0Mi28o5TVrkh
- **Connect**: `sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' ssh root@173.212.212.157`

## Domain & SSL
- **Domain**: marketplace.173.212.212.157.sslip.io
- **URL**: https://marketplace.173.212.212.157.sslip.io
- **DNS Provider**: sslip.io (automatic IP-based DNS, no account needed)
- **SSL**: Let's Encrypt via Certbot
- **Certificate Path**: /etc/letsencrypt/live/marketplace.173.212.212.157.sslip.io/
- **Certificate Expiry**: 2026-05-23
- **Auto-renewal**: certbot.timer (systemd), runs twice daily

## Server Software
- **Node.js**: v20.20.0
- **Nginx**: 1.24.0
- **PostgreSQL**: 16
- **PM2**: process manager
- **Certbot**: 2.9.0

## File Paths
- **Frontend (static)**: /var/www/marketplace/
- **Backend (app)**: /var/www/marketplace-app/
- **Server code**: /var/www/marketplace-app/server/
- **Uploads**: /var/www/marketplace-app/server/uploads/
- **Nginx config**: /etc/nginx/sites-available/marketplace
- **Server .env**: /var/www/marketplace-app/server/.env

## Database
- **Type**: PostgreSQL 16
- **Host**: localhost:5432
- **Database**: marketplace
- **User**: marketplace
- **Password**: marketplace_dev
- **Connection**: `postgresql://marketplace:marketplace_dev@localhost:5432/marketplace`

## Backend
- **Port**: 3001
- **PM2 name**: marketplace-api
- **Start command**: `pm2 start "npx tsx src/index.ts" --name marketplace-api`
- **Health check**: https://marketplace.173.212.212.157.sslip.io/api/health

## JWT Secrets
- **Access Token**: mkt-jwt-secret-prod-2026-xK9mP2
- **Refresh Token**: mkt-refresh-secret-prod-2026-qW7nL4

## Nginx Configuration
- HTTP (port 80) -> HTTPS redirect
- `/` -> SPA with try_files fallback to index.html
- `/api/*` -> proxy to http://127.0.0.1:3001/api/
- `/socket.io/*` -> WebSocket proxy to http://127.0.0.1:3001/socket.io/
- `/uploads/*` -> alias to /var/www/marketplace-app/server/uploads/
- `/assets/*` -> cached 1 year, immutable

## Git Repository
- **Gitea**: https://git.sensey24.ru/aibot777/marketplace
- **Credentials**: aibot777:aibot777
- **Clone**: `git clone https://aibot777:aibot777@git.sensey24.ru/aibot777/marketplace.git`

## Deployment Steps

### Frontend (client)
```bash
cd /Users/tony/Downloads/marketplace
npm run build --workspace=client
sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' scp -r client/dist/* root@173.212.212.157:/var/www/marketplace/
```

### Backend (server)
```bash
sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' ssh root@173.212.212.157 'cd /var/www/marketplace-app && git pull && cd server && npm install && npx prisma db push && pm2 restart marketplace-api'
```

### Full redeploy
```bash
npm run build --workspace=client
sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' scp -r client/dist/* root@173.212.212.157:/var/www/marketplace/
sshpass -p 'V8Padp8oIwl8m3RP0Mi28o5TVrkh' ssh root@173.212.212.157 'cd /var/www/marketplace-app && git pull && cd server && npm install && npx prisma db push && pm2 restart marketplace-api'
```

## Figma
- **Design File**: https://www.figma.com/design/Xh5WPACLvwgtng6x4Fx2La/
- **API Key**: figd_Jw3hjrUMoPIN5x_xxSAyGY0hFovmxoHRBkzUwSJp
- **Expires**: ~90 days from 2026-02-22 (approx. 2026-05-23)
- **MCP URL**: https://mcp.figma.com/mcp

## Stripe (Not configured yet)
- STRIPE_SECRET_KEY: (empty)
- STRIPE_WEBHOOK_SECRET: (empty)
- Test card: 4242 4242 4242 4242
