yamiclaws/auth-system-smtp
0
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.cssLocal Development
Backend
cd backend
pip install -r requirements.txt
uvicorn main:app --reload --port 8000Frontend
cd frontend
npm install
npm run devDeploy to Hugging Face Spaces
- Create a new Space at huggingface.co with Docker SDK
- Add secrets in Settings > Variables and secrets:
SECRET_KEY= any random stringDATABASE_URL=sqlite:////app/users.dbSMTP_SERVER=smtp.gmail.comSMTP_PORT=587SMTP_USER= your gmailSMTP_PASSWORD= your app password- Push code to the Space repo
