An open API service indexing awesome lists of open source software.

https://github.com/jbloch100/safefront

πŸ›‘οΈ A front-end web security toolkit with password strength checker, URL inspector, HTTP security headers audit, and XSS sanitizer demo. Built with React + Vite, deployed on Vercel.
https://github.com/jbloch100/safefront

dompurify http-headers javascript password-strength react security vercel vite web-security xss

Last synced: 4 months ago
JSON representation

πŸ›‘οΈ A front-end web security toolkit with password strength checker, URL inspector, HTTP security headers audit, and XSS sanitizer demo. Built with React + Vite, deployed on Vercel.

Awesome Lists containing this project

README

          

# SafeFront

[![Live](https://img.shields.io/badge/demo-online-green.svg)](https://safefront-eight.vercel.app/)
![React](https://img.shields.io/badge/React-18.x-61DAFB?logo=react&logoColor=white)
![Vite](https://img.shields.io/badge/Vite-5.x-646CFF?logo=vite&logoColor=white)
![Vercel](https://img.shields.io/badge/Hosted%20on-Vercel-black?logo=vercel)
![Security](https://img.shields.io/badge/Focus-Web%20Security-orange)

**SafeFront** is a front‑end web security toolkit built with **React + Vite**.
It includes a password strength tool, a suspicious URL inspector, a **security headers audit** (via API), and an **XSS sanitization** demo using DOMPurify.

πŸ”— **Live Demo**: https://safefront-eight.vercel.app/

---

## ✨ Features
- **Password Strength Checker** – entropy/length/character classes
- **URL Inspector** – flags punycode, IP hosts, suspicious TLDs, many subdomains, and non‑HTTPS
- **Security Headers Audit** – backend fetch to site and reports CSP, HSTS, XFO, X‑CTO, Referrer‑Policy, Permissions‑Policy
- **Sanitizer Demo** – shows how DOMPurify prevents XSS
- **Clean UI** – responsive, lightweight

---

## πŸ›  Tech Stack
- **Frontend**: React, Vite, CSS
- **Security**: DOMPurify
- **API**: Serverless endpoint on Vercel (`/api/headers`)
- **Hosting**: Vercel

---

## πŸ“‚ Structure
```
safefront/
β”œβ”€ api/ # Vercel serverless functions
β”‚ └─ headers.js # GET /api/headers?url=...
β”œβ”€ server/ # Local dev Express server (optional)
β”‚ └─ index.js
β”œβ”€ src/
β”‚ β”œβ”€ components/ # UI widgets
β”‚ β”œβ”€ sections/ # Tools pages
β”‚ β”œβ”€ App.jsx
β”‚ β”œβ”€ main.jsx
β”‚ └─ index.css
β”œβ”€ package.json
β”œβ”€ vite.config.js
└─ index.html
```

---

## πŸ”§ Local Setup
```bash
npm install
npm run dev:api # starts local API (optional for dev)
npm run dev # starts Vite (http://localhost:5173)
```

> Vite proxies `/api` to `http://localhost:5174` during dev (see `vite.config.js`).

---

## 🌐 Deployment
Deployed on **Vercel** (zero config):
- **Build:** `npm run build`
- **Output:** `dist`
- **API:** `api/headers.js` β†’ `/api/headers`

Live: https://safefront-eight.vercel.app/

---

## πŸ”Ž API: Security Headers Audit
**Endpoint**
```
GET /api/headers?url=https://example.com
```

**Response**
```json
{
"ok": true,
"url": "https://example.com/",
"status": 200,
"headers": { "content-security-policy": "...", "strict-transport-security": "..." },
"audit": {
"hsts": true,
"csp": true,
"xFrameOptions": true,
"xContentTypeOptions": true,
"referrerPolicy": true,
"permissionsPolicy": false,
"httpsRedirectLikely": true
}
}
```

---

## πŸ“Έ Screenshots
### Mobile View
SafeFront - Mobile

### Desktop View
SafeFront - Desktop

---

## πŸ§ͺ Troubleshooting
- **`react/jsx-runtime` not found** β†’ ensure `react` and `react-dom` are installed (18.x) and `@vitejs/plugin-react` is enabled in `vite.config.js`.
- **404 on `/api/headers` in prod** β†’ file must be at repo root: `api/headers.js`.
- **CORS locally** β†’ use `npm run dev:api` + Vite proxy (already set).

---

## 🏷 GitHub Topics
```
react vite javascript security web-security http-headers xss dompurify vercel
```

---

## πŸ“„ License
MIT β€” see `LICENSE`.