
User Authentication Service
A FastAPI-based user authentication service with JWT token authentication and SQLite database.
Features
- User registration and login
- JWT token-based authentication
- Password hashing with bcrypt
- SQLite database with SQLAlchemy ORM
- Alembic database migrations
- CORS enabled for all origins
- Health check endpoint
API Endpoints
GET /
- Service information and linksGET /health
- Health check endpointPOST /auth/register
- User registrationPOST /auth/login
- User loginGET /auth/me
- Get current user profile (requires authentication)GET /docs
- Interactive API documentationGET /redoc
- Alternative API documentation
Setup
-
Install dependencies:
pip install -r requirements.txt
-
Set environment variables:
export SECRET_KEY="your-secret-key-here"
Note: The SECRET_KEY environment variable is required for JWT token generation. Make sure to set it to a secure random string in production.
-
Run database migrations:
alembic upgrade head
-
Start the application:
uvicorn main:app --reload
The application will be available at http://localhost:8000
Environment Variables
SECRET_KEY
- Secret key for JWT token signing (required)
Database
The application uses SQLite database stored at /app/storage/db/db.sqlite
. The database directory will be created automatically on first run.
Description
Languages
Python
94.5%
Mako
5.5%