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

  1. Install dependencies:
pip install -r requirements.txt
  1. Set environment variables:
export SECRET_KEY="your-secret-key-here"
  1. Run the application:
uvicorn main:app --reload

API Endpoints

Authentication

  • POST /auth/register - Register new user
  • POST /auth/login - Login user
  • GET /auth/profile - Get current user profile (protected)

System

  • GET / - Service information
  • GET /health - Health check
  • GET /docs - API documentation
  • GET /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
Project: User Authentication Service
Readme 37 KiB
Languages
Python 95.2%
Mako 4.8%