Automated Action ca6bca6445 Fix email-validator dependency error
Add email-validator package to requirements.txt to resolve
ImportError when using EmailStr in Pydantic models
2025-06-26 16:09:12 +00:00
2025-06-26 16:02:04 +00:00

Simple Messaging App

A simple messaging application built with FastAPI, SQLAlchemy, and SQLite.

Features

  • User registration and authentication with JWT tokens
  • Send and receive messages between users
  • View conversation history
  • Health check endpoint
  • API documentation with Swagger UI

Tech Stack

  • FastAPI: Modern, fast web framework for building APIs
  • SQLAlchemy: SQL toolkit and ORM
  • SQLite: Lightweight database
  • Alembic: Database migration tool
  • JWT: JSON Web Tokens for authentication
  • Bcrypt: Password hashing
  • Ruff: Fast Python linter

Installation

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

The application will be available at http://localhost:8000

API Documentation

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc
  • OpenAPI JSON: http://localhost:8000/openapi.json

Endpoints

Authentication

  • POST /auth/register - Register a new user
  • POST /auth/login - Login user and get access token

Messages

  • POST /messages/send - Send a message to another user
  • GET /messages/received - Get received messages
  • GET /messages/sent - Get sent messages
  • GET /messages/conversation/{user_id} - Get conversation with specific user
  • GET /messages/users - Get list of all users

Health

  • GET /health - Health check endpoint

Environment Variables

Set the following environment variables:

  • SECRET_KEY: JWT secret key for token signing (default: "your-secret-key-here")

Database

The application uses SQLite database stored at /app/storage/db/db.sqlite. The database schema is managed with Alembic migrations.

Description
Project: Simple Messaging App
Readme 40 KiB
Languages
Python 96.7%
Mako 3.3%