LicenseManger / README.md
nitinrawatisMLeng
docs: document DB_SSLMODE as a required Neon deployment secret
73c7339
|
Raw
History Blame Contribute Delete
4.02 kB
---
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 |
---