User Authentication Service

A FastAPI-based user authentication service with JWT authentication.

Features

  • User registration and login
  • JWT authentication
  • User profile management
  • SQLite database with SQLAlchemy ORM
  • Alembic migrations
  • Health check endpoint

Requirements

  • Python 3.8+
  • FastAPI
  • SQLAlchemy
  • Alembic
  • Pydantic
  • Python-jose (JWT)
  • Passlib (Password hashing)

Project Structure

.
├── alembic/              # Database migrations
├── app/                  # Application code
│   ├── api/              # API endpoints
│   │   ├── deps.py       # Dependencies
│   │   └── routes/       # API route handlers
│   ├── core/             # Core functionality
│   │   ├── config.py     # Configuration settings
│   │   └── security.py   # Security utilities
│   ├── db/               # Database
│   │   ├── crud.py       # CRUD operations
│   │   └── session.py    # DB session
│   ├── models/           # SQLAlchemy models
│   └── schemas/          # Pydantic schemas
├── alembic.ini           # Alembic configuration
├── main.py               # FastAPI application
└── requirements.txt      # Dependencies

Setup

  1. Clone the repository
  2. Install dependencies:
pip install -r requirements.txt
  1. Run the migrations:
alembic upgrade head
  1. Start the application:
uvicorn main:app --reload

API Endpoints

Authentication

  • POST /api/v1/auth/register - Register a new user
  • POST /api/v1/auth/login - Login and get JWT token
  • GET /api/v1/auth/me - Get current user info (requires authentication)

Health Check

  • GET /health - Check service health

API Documentation

  • Swagger UI: /docs
  • ReDoc: /redoc

Development

To run the application in development mode:

uvicorn main:app --reload

This application was bootstrapped by BackendIM, the AI-powered backend generation platform.

Description
Project: User Authentication Service
Readme 42 KiB
Languages
Python 96.7%
Mako 3.3%