User Authentication Service
A secure user authentication API built with FastAPI and SQLite.
Features
- User registration with email validation
- Secure password hashing using bcrypt
- JWT token-based authentication
- Protected routes with authentication middleware
- Health check endpoint
- SQLite database with Alembic migrations
Setup
- Install dependencies:
pip install -r requirements.txt
- Set environment variables:
export SECRET_KEY="your-secret-key-here"
- Run the application:
uvicorn main:app --reload
API Endpoints
Authentication
POST /auth/register
- Register new userPOST /auth/login
- Login userGET /auth/profile
- Get current user profile (protected)
System
GET /
- Service informationGET /health
- Health checkGET /docs
- API documentationGET /openapi.json
- OpenAPI schema
Environment Variables
The following environment variables should be set:
SECRET_KEY
- JWT secret key for token signing (required for production)
Database
The application uses SQLite database located at /app/storage/db/db.sqlite
. Database migrations are managed with Alembic.
Documentation
API documentation is available at /docs
when the application is running.
Description
Languages
Python
95.2%
Mako
4.8%