--- title: LicenseManager emoji: 🔑 colorFrom: green colorTo: blue sdk: docker pinned: false app_port: 7860 --- # LicenseManager A full-stack B2B license management system built with **Go + React**. Manages clients, devices, products, subscriptions, and cryptographic license generation (RSA-SHA256). ## Stack | Layer | Technology | |---|---| | Backend | Go 1.23 + Gin | | Frontend | React 19 + Tailwind CSS v4 + Vite | | Database | PostgreSQL 16 | | Auth | JWT (HS256) + bcrypt | | License Signing | RSA-2048 / SHA-256 | | Email Alerts | SMTP (Zoho / any SMTP provider) | --- ## Deploying to Hugging Face Spaces ### Step 1 — Get a free PostgreSQL database [Neon.tech](https://neon.tech) gives you a free serverless PostgreSQL. After signing up, create a project and copy the **connection string** — you'll need the individual parts below. ### Step 2 — Create a new Hugging Face Space (Docker type) 1. Go to [huggingface.co/new-space](https://huggingface.co/new-space) 2. Choose **Docker** as the SDK — NOT Static, NOT Gradio 3. Set visibility to Public or Private 4. Click **Create Space** ### Step 3 — Set Secrets in the Space settings Go to your Space → **Settings** → **Repository secrets** and add: | Secret name | Value | Notes | |---|---|---| | `DB_HOST` | `ep-xxx.us-east-2.aws.neon.tech` | From Neon dashboard | | `DB_PORT` | `5432` | | | `DB_USER` | `neondb_owner` | From Neon connection string | | `DB_PASSWORD` | `your-neon-password` | Mark as Secret | | `DB_NAME` | `neondb` | From Neon dashboard | | `DB_SSLMODE` | `require` | **Required for Neon** — connection defaults to `disable` if unset, which Neon rejects | | `JWT_SECRET` | `<64-char random string>` | Generate: `openssl rand -hex 32` | | `MAIL_HOST` | `smtp.zoho.com` | Optional — leave blank to disable email | | `MAIL_PORT` | `587` | Optional | | `MAIL_USERNAME` | `you@zoho.com` | Optional | | `MAIL_PASSWORD` | `your-zoho-app-password` | Optional — mark as Secret | ### Step 4 — Log in Once running, open your Space URL. The default admin credentials are: | Field | Value | |---|---| | Email | `admin@futurealgos.com` | | Password | `changeme` | **Change the password immediately** after first login. --- ## CI/CD — Auto-deploy from GitHub Every push to `main` on GitHub automatically deploys to your Hugging Face Space. ### How it works ``` git push origin main │ ▼ GitHub Actions — build-check (go build + npm run build) │ passes ▼ GitHub Actions — deploy (git push to HF Space) │ ▼ HF Spaces detects push → builds Dockerfile → redeploys (~5 min) ``` ### One-time setup **1. Get a Hugging Face write token** Go to [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) → **New token** → **Write** access. **2. Add to GitHub → Settings → Secrets and variables → Actions** | Type | Name | Value | |---|---|---| | Secret | `HF_TOKEN` | your HF write token | | Variable | `HF_USERNAME` | your HF username e.g. `futurealgos` | | Variable | `HF_SPACE_NAME` | your Space name e.g. `licensemanager` | **3. Push** ```bash git add . git commit -m "ci: add deploy pipeline" git push origin main ``` GitHub Actions tab will show **Build check** then **Deploy to HF Spaces**. First deploy takes ~5 min on HF's side. --- ## Local Development **Option A — Docker (PostgreSQL included, zero setup):** ```bash # from the repo root docker compose up --build # App → http://localhost:8080 ``` **Option B — without Docker (frontend hot reload):** ```bash # Terminal 1 — backend cd Apps/licensemanagerApp/backend go run ./cmd/server # Terminal 2 — frontend cd Apps/licensemanagerApp/frontend npm install && npm run dev # http://localhost:5173 (proxies /api → :8080) ``` ### PORT behaviour | Environment | PORT | How it's set | |---|---|---| | Local (no Docker) | `8080` | default in code | | Local Docker | `8080` | `docker-compose.yml` env | | HF Spaces | `7860` | `Dockerfile` ENV | ---