opensitetrust.com · Version: v0.26 · Default language: English (中文 README)
Project by Prysaic Libs · GitHub: https://github.com/prysaic-labs/OpenSiteTrust
Give every website a transparent 0–100 trust/risk score using Rules + Community + Explanations. Ship a browser extension, open API, and a lightweight forum.
Status: v0.25 delivers a working API and UI with caching, probes, dynamic scoring, admin tools, GitHub/Email auth, and expanded i18n.
OpenSiteTrust is an open, explainable, and reusable website scoring ecosystem. We compose multiple dimensions into one score and show evidence cards:
- S Security (HTTPS, security headers, TLS expiry, DNSSEC)
- C Credibility (domain heuristics, optional Google Safe Browsing v4, lightweight SEO presence)
- T Transparency (privacy/terms/about/contact, security.txt, humans.txt, imprint, security page, bounty)
- U User/Community signals (Wilson lower bound; excluded when no votes)
Use cases:
- Users: see a green/amber/red bar with a score and “why” at a glance.
- Creators/Media: assess source credibility quickly.
- Researchers/Developers: consume an open API and data for tools and studies.
- Site owners: appeal and improve transparency signals.
- Scoring engine with probes and explanations (caching via Redis, Postgres persistence).
- Open API: GET /v1/sites/{host}, GET /v1/sites/{host}/explain, POST /v1/votes.
- Web UI (Next.js + Tailwind + shadcn-like components), multi-language via
?lang=
(en default; zh/zh-Hant/ja/es supported). Added About/Contact/Privacy pages, robots.txt & sitemap, and a drawer menu with SEO links. - Caddy reverse proxy, Docker Compose deployment.
Vision: open, explainable site‑trust ecosystem with S/C/T/U signals, public APIs, and community participation.
Near‑term roadmap (0.x):
- Enrich probes and evidence cards; improve transparency/credibility coverage
- Browser extension and basic moderation workflows
- Public data export and snapshotting; abuse safeguards
- More identity providers (optional) and appeal flows
1.x ideas (post‑MVP):
- Rule marketplace and pluggable scorers; data partnerships
- Advanced dashboards and research APIs; federation options
Prerequisites:
- Docker Engine 24+ and Docker Compose v2
- A domain pointing to your server if using Caddy for TLS
Steps (Linux server):
- Clone repo and enter folder
- Copy
.env.example
to.env
and edit for your environment (see below) - Build and start
Services:
- api: FastAPI on 8000 (internal), proxied by Caddy
- web: Next.js on 3000 (internal), proxied by Caddy
- db: PostgreSQL 16 (with healthcheck)
- redis: Redis 7
- caddy: serves ports 80/443
See also docs/deployment.md
for details.
Recommended if you prefer running each service locally.
Prerequisites:
- Node.js 20+
- Python 3.11+
- PostgreSQL 16
- Redis 7
Setup:
-
Backend API
- Create and export env vars:
DATABASE_URL
,REDIS_URL
,JWT_SECRET
(optional for votes), optionalGOOGLE_SAFE_BROWSING_API_KEY
- Install deps:
pip install -r apps/api/requirements.txt
- Run:
uvicorn app.main:app --reload
fromapps/api
- Create and export env vars:
-
Web app
- From
apps/web
:npm i
thennpm run dev
- Visit http://localhost:3000
Notes:
- The web header shows version from
NEXT_PUBLIC_VERSION
(keep in.env
andVERSION
). - i18n via
?lang=
; defaults toen
. Supported: en, zh, zh-Hant, ja, es.
Do NOT commit .env
. Copy .env.example
to .env
and set:
- DATABASE_URL (postgres), REDIS_URL (redis)
- JWT_SECRET (long random string)
- WEB_ORIGIN (e.g.,
https://your.domain
) - GitHub OAuth (optional): GITHUB_CLIENT_ID/SECRET/REDIRECT_URI
- SMTP (optional): host/user/pass/sender for email codes
- GSB key (optional): GSB_API_KEY for Safe Browsing
- NEXT_PUBLIC_VERSION (UI version badge)
See .env.example
for details and safe defaults.
Common variables (via .env
or environment):
DATABASE_URL
(e.g.,postgres://user:pass@localhost:5432/site
)REDIS_URL
(e.g.,redis://localhost:6379
)JWT_SECRET
(optional; needed for protected endpoints if any later)GOOGLE_SAFE_BROWSING_API_KEY
(optional; raw key or full API URL with?key=
)COMMUNITY_RAMP_N
(optional; ramp-up for U weight)COMMUNITY_BASELINE
(optional; smoothing baseline for U)NEXT_PUBLIC_VERSION
(optional; UI version badge)
Two paths (can be mixed):
- Serverless rapid path
- Frontend: UniApp H5
- Backend: uniCloud (Node)
- DB: managed document store (Mongo-like)
- Cache/Rate limiting: managed cache or built-ins
- Containerized and controllable (recommended)
- Frontend: Next.js (or UniApp H5)
- API: FastAPI (Python) or NestJS (Node)
- Worker: Celery/RQ (Python) or BullMQ (Node)
- Database: PostgreSQL
- Cache/Queue/Rate limit: Redis
- Proxy: Caddy/Nginx; CDN/WAF: Cloudflare
- Orchestration: Docker Compose (dev), then split services later
- SQL schema: see docs/data-model.sql
- API spec and examples: see docs/api.md
- No votes: U displays 0 with a "No ratings" note and is EXCLUDED from the score (weights re-normalize over S/C/T).
- Google Safe Browsing v4 (optional): set
GOOGLE_SAFE_BROWSING_API_KEY
; supports raw key or full API URL with?key=
. - SEO signals: title, description, canonical, robots.txt/meta, Open Graph, JSON-LD, sitemap.xml.
- Transparency: privacy, terms, about, contact, imprint/impressum, security page, bug bounty, security.txt, humans.txt.
- Security: HTTPS behavior, headers (HSTS/CSP/XCTO/XFO/Referrer-Policy/ Permissions-Policy), TLS expiry, DNSSEC.
- Target OS: Ubuntu 24.04 LTS. See docs/deployment.md.
- Compose and
.env.example
are provided. - Caddy terminates TLS on 80/443; point your DNS A/AAAA to the server and Caddy will issue certs.
- Env lives in
.env
next todocker-compose.yml
.
Minimum server spec (for a small instance):
- 1 vCPU, 1–2 GB RAM, 10 GB disk (demo) Recommended: 2 vCPU, 2–4 GB RAM, 20+ GB disk
Prerequisites:
- Ubuntu 24.04 LTS or similar Linux
- Docker Engine 24+ and Docker Compose v2
- A domain pointing to this server (A/AAAA records)
- Clone and prepare env
- Clone the repo and enter it.
- Copy
.env.example
to.env
and fill values:DATABASE_URL
,REDIS_URL
,JWT_SECRET
,WEB_ORIGIN
- Optional:
GITHUB_CLIENT_ID
,GITHUB_CLIENT_SECRET
,GITHUB_REDIRECT_URI
- Optional: SMTP settings for email codes
- Optional:
GSB_API_KEY
for Safe Browsing NEXT_PUBLIC_VERSION
(keep consistent withVERSION
)
- Configure DNS and Caddy
- Point your domain to this server's public IP.
- Caddy will terminate TLS automatically using the
Caddyfile
.
- Build and start services
Run on the server:
docker compose up -d --build
docker compose ps
- Verify
- API health:
GET /v1/health
should return version and time. - Public config:
GET /v1/config
shows flags like SMTP/GitHub configured. - Visit your domain in a browser; TLS should be valid.
- Create or use an account
- Email code registration needs SMTP env set.
- GitHub registration requires OAuth app configured (see below).
- Admin features are gated by the
ADMIN_EMAILS
list.
- Update/redeploy
git pull
docker compose up -d --build api web
docker compose logs -f --tail=200 api
- Logs and maintenance
docker compose logs -f api
docker compose logs -f web
docker compose ps
docker compose restart api web
- Backup (PostgreSQL volume)
# Dump
docker compose exec -T db pg_dump -U postgres site > backup.sql
# Restore (destructive)
docker compose exec -T db psql -U postgres site < backup.sql
- Create an OAuth app at GitHub Developers.
- Homepage URL: your
WEB_ORIGIN
. - Authorization callback URL:
WEB_ORIGIN/login/github-callback
. - Put
GITHUB_CLIENT_ID
,GITHUB_CLIENT_SECRET
, and optionallyGITHUB_REDIRECT_URI
into.env
.
- Fill
SMTP_HOST
,SMTP_PORT
,SMTP_USER
,SMTP_PASSWORD
, andSMTP_SENDER
in.env
. - Test
POST /v1/auth/send-code
with your email; check logs for delivery.
- Compose fails to build:
- Check Docker version and available disk space.
- Verify
.env
exists next todocker-compose.yml
.
- GitHub OAuth returns 400/redirect issues:
- Ensure
GITHUB_CLIENT_ID/SECRET
and redirect URI match exactly. - Check
/v1/config
forgithub_configured: true
.
- Ensure
- Email code not received:
- Verify SMTP creds; check provider console.
- Rate limit: see
/v1/config.email_code_rate_limit
.
- DB column missing (e.g.,
users.handle
):- The API runs best-effort DDL on startup; restart
api
after upgrade.
- The API runs best-effort DDL on startup; restart
- Port conflicts:
- Ensure ports 80/443 are free (stop any nginx/apache).
For Windows developers using PowerShell:
docker compose up -d --build
docker compose ps
docker compose logs -f --tail 200 api
See docs/privacy-security.md for details on data minimization, k-anonymity, CSRF/XSS protections, rate limits, reputation weighting, and signed snapshots.
- Backend / scoring engine: AGPL-3.0
- Browser extension / SDKs: Apache-2.0
- User-labeled data: CC BY-SA 4.0
Details in docs/open-source-governance.md.
See CONTRIBUTING.md and CODE_OF_CONDUCT.md. Security issues: see SECURITY.md. Contact: [email protected]
- Default project language is English; switch via
?lang=xx
(en/zh/zh-Hant/ja/es). - We version starting from v0.01 and update DEVLOG.md on every meaningful change.
— OpenSiteTrust Contributors