Spaces:
Sleeping
Sleeping
| title: Secure Auth System | |
| emoji: π‘οΈ | |
| colorFrom: gray | |
| colorTo: gray | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| # Secure Authentication System with SMTP OTP Verification | |
| A beginner-friendly authentication system with **FastAPI** backend and **React** frontend. Implements email OTP verification, JWT tokens, and password reset. | |
| ## Features | |
| - SMTP Email OTP Verification (register + forgot password) | |
| - Console fallback when SMTP is not configured | |
| - JWT Access & Refresh Token system with rotation | |
| - Token revocation on logout | |
| - Bcrypt password hashing | |
| - Rate limiting & request logging | |
| - Minimal dark-theme UI | |
| ## Tech Stack | |
| - **Backend**: FastAPI, SQLite, SQLAlchemy, Pydantic, bcrypt, python-jose | |
| - **Frontend**: React 18, Vite, plain CSS (no router, no axios) | |
| ## Project Structure | |
| ``` | |
| βββ Dockerfile | |
| βββ backend/ | |
| β βββ main.py # Single file: all routes, models, auth, email | |
| β βββ requirements.txt | |
| β βββ .env | |
| β βββ users.db | |
| βββ frontend/ | |
| βββ package.json | |
| βββ vite.config.js | |
| βββ index.html | |
| βββ src/ | |
| βββ main.jsx | |
| βββ App.jsx # Single component, all pages | |
| βββ App.css | |
| βββ index.css | |
| ``` | |
| ## Local Development | |
| ### Backend | |
| ```bash | |
| cd backend | |
| pip install -r requirements.txt | |
| uvicorn main:app --reload --port 8000 | |
| ``` | |
| ### Frontend | |
| ```bash | |
| cd frontend | |
| npm install | |
| npm run dev | |
| ``` | |
| ## Deploy to Hugging Face Spaces | |
| 1. Create a new Space at huggingface.co with **Docker** SDK | |
| 2. Add secrets in Settings > Variables and secrets: | |
| - `SECRET_KEY` = any random string | |
| - `DATABASE_URL` = `sqlite:////app/users.db` | |
| - `SMTP_SERVER` = `smtp.gmail.com` | |
| - `SMTP_PORT` = `587` | |
| - `SMTP_USER` = your gmail | |
| - `SMTP_PASSWORD` = your app password | |
| 3. Push code to the Space repo | |