# User Authentication Service A FastAPI-based user authentication service with JWT token support. ## Features - User registration and login - JWT token-based authentication - Password hashing with bcrypt - SQLite database with SQLAlchemy ORM - Database migrations with Alembic - Health check endpoint - CORS enabled for all origins - API documentation available at `/docs` and `/redoc` ## Environment Variables The following environment variables should be set: - `SECRET_KEY`: JWT secret key for token signing (defaults to "your-secret-key-change-in-production") ## Installation 1. Install dependencies: ```bash pip install -r requirements.txt ``` 2. Run database migrations: ```bash alembic upgrade head ``` 3. Start the application: ```bash uvicorn main:app --reload ``` ## API Endpoints ### Base - `GET /` - Service information - `GET /health` - Health check ### Authentication - `POST /auth/register` - Register a new user - `POST /auth/login` - Login user - `POST /auth/token` - OAuth2 compatible token endpoint - `GET /auth/me` - Get current user info (requires authentication) - `POST /auth/logout` - Logout user ## Database Structure The application uses SQLite with the following user table structure: - `id`: Primary key - `email`: Unique user email - `hashed_password`: Bcrypt hashed password - `is_active`: User status flag - `created_at`: Account creation timestamp - `updated_at`: Last update timestamp ## Development The project uses Ruff for code formatting and linting.