Files
pleskSaas/docs/ai-bootstrap.md
2026-03-08 09:58:56 +00:00

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:

  1. Code pushed to repository
  2. Jenkins pipeline runs
  3. Next.js application builds
  4. Docker image builds
  5. Image exported via docker save
  6. Image transferred via SSH/SCP
  7. Image loaded on application host
  8. Container recreated
  9. 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:

https://portal.rdbcloud.co.uk


Database & Auth

Supabase is self-hosted on an internal server.

Current API endpoint:

http://192.168.68.52:54321

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:

http://192.168.68.52:54321

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:

  1. Fix Supabase HTTPS endpoint
  2. Verify authentication flow
  3. Continue SaaS portal feature development