Skip to content

SRHSolution/SRHWebServer

Repository files navigation

SRH Solutions webserver for the public site, customer portal, and admin console.

The current admin and portal screens can run in demo mode, while the backend harness below provides the Supabase schema and Next.js Route Handlers needed to move customer management, license issuance, installations, and invoicing onto a real database.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Useful routes:

  • / public site
  • /portal customer portal
  • /admin SRH operator console
  • /api/admin/harness backend harness health check

Supabase Harness

  1. Create a Supabase project.
  2. Copy .env.example to .env.local and fill in the Supabase URL, anon key, and service-role key.
  3. Apply supabase/migrations/001_srh_admin_core.sql in Supabase SQL editor or with the Supabase CLI.
  4. Optionally run supabase/seed.sql for starter organizations, products, licenses, invoices, and installation records.
  5. Restart npm run dev.

When Supabase env vars are missing, the API harness returns the existing demo data from app/admin/data.ts. When the env vars are present, the same routes read and mutate Supabase.

Admin API

If SRH_ADMIN_API_TOKEN is set, send Authorization: Bearer <token>.

curl http://localhost:3000/api/admin/harness
curl -X POST http://localhost:3000/api/admin/licenses \
  -H "Content-Type: application/json" \
  -d "{\"organizationId\":\"ORG-HUONS-2019\",\"productId\":\"imaging\",\"seats\":8,\"durationDays\":365,\"environment\":\"Production\",\"site\":\"Anyang HQ\"}"
curl -X POST http://localhost:3000/api/admin/invoices \
  -H "Content-Type: application/json" \
  -d "{\"organizationId\":\"ORG-HUONS-2019\",\"licenseIds\":[\"L-1042\",\"L-1043\"]}"

Data Model

Core tables:

  • organizations, organization_members
  • products
  • licenses, installations
  • invoices, invoice_line_items
  • activity_events

The migration enables RLS. Authenticated customer users can read rows for their own organization through organization_members. Admin Route Handlers use the server-only Supabase service-role key and should stay server-side.

This project uses Next.js App Router and next/font.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

Releases

No releases published

Packages

 
 
 

Contributors