3.9 KiB
AI Bootstrap Context -- Plesk Agency Portal
This document is intended to be uploaded into a new AI conversation so the assistant can quickly understand the project state.
Project Overview
The Plesk Agency Portal is a multi-tenant SaaS platform that allows agencies to manage multiple Plesk servers, hosting subscriptions, and domains from a single interface.
Goals:
- Connect multiple Plesk servers
- Sync subscriptions and domains
- Manage hosting environments
- Provide SaaS billing integration
- Enforce tenant isolation using Supabase Row Level Security (RLS)
Technology Stack
Frontend Next.js (App Router)
Backend Next.js API routes
Authentication Supabase Auth (Magic Link)
Database Supabase PostgreSQL
CI/CD Jenkins
Containerisation Docker
Reverse Proxy Nginx Proxy Manager
Infrastructure Self-hosted Linux servers
Current Deployment Architecture
CI/CD Pipeline:
- Code pushed to repository
- Jenkins pipeline runs
- Next.js application builds
- Docker image builds
- Image exported via
docker save - Image transferred via SSH/SCP
- Image loaded on application host
- Container recreated
- Smoke test verifies service
Images are transferred using:
docker save → scp → docker load
This avoids requiring a Docker registry during early development.
Infrastructure
Jenkins Host Responsible for:
- building Docker images
- running CI/CD pipeline
- deploying containers
Application Host
Deployment path:
/opt/plesk-agency-portal
Docker container:
plesk-agency-portal
Application port:
3000
Reverse Proxy:
Nginx Proxy Manager
Public domain:
Database & Auth
Supabase is self-hosted on an internal server.
Current API endpoint:
Because the portal runs via HTTPS, this causes a browser mixed-content error.
Current Blocking Issue
Supabase authentication fails because the frontend attempts to call:
while the portal itself is served via HTTPS.
Browsers block the request.
Planned Fix
Expose Supabase through HTTPS using Nginx Proxy Manager.
Target domain:
https://supabase.rdbcloud.co.uk
Proxy configuration:
Forward host: 192.168.68.52
Forward port: 54321
After that update environment variables:
NEXT_PUBLIC_SUPABASE_URL SUPABASE_URL
Then redeploy the portal.
Deployment Verification
Example deployed image:
plesk-agency-portal:build-62
Verification command:
docker inspect plesk-agency-portal --format '{{.Image}} {{.Created}}'
Health endpoint:
/api/health
Repository Documentation
Important docs:
docs/ai-project-context.md
docs/system-architecture.md
docs/next-steps.md
docs/handovers/*
Typical AI Assistance Areas
- CI/CD debugging
- Docker deployment
- Next.js development
- Supabase integration
- SaaS multi-tenant architecture
- Stripe billing integration
- Plesk API integration
Current Development Stage
Infrastructure and deployment pipeline are working.
Next priorities:
- Fix Supabase HTTPS endpoint
- Verify authentication flow
- Continue SaaS portal feature development