Skip to content

HardMax71/Flet-Chat

Repository files navigation

Flet-Chat

CI Tests Lint Type Check codecov Codacy Badge

Python Version License: MIT Ruff Code style: black

🚀 Features

  • Real-time messaging
  • User authentication and authorization
  • Persistent login sessions (secure token storage)
  • Client-side form validation with real-time feedback
  • Strong password requirements and validation
  • Group chat functionality
  • Message history and search
  • Responsive UI design
  • Docker support for easy deployment

🛠️ Tech Stack

  • Frontend: Flet - A framework for building interactive multi-platform applications in Python
  • Backend: FastAPI - A modern, fast (high-performance) web framework for building APIs with Python
  • Database: PostgreSQL - A powerful, open-source object-relational database system
  • ORM: SQLAlchemy - The Python SQL toolkit and Object-Relational Mapping (ORM) library
  • Data Validation: Pydantic - Data validation and settings management using Python type annotations
  • Secure Storage: Keyring - Cross-platform token and credential storage
  • Containerization: Docker and Docker Compose

🚀 Getting Started

Follow these steps to get Flet-Chat up and running on your local machine:

Click to expand step-by-step instructions

Prerequisites

  • Docker and Docker Compose
  • Python 3.11 or higher

Environment Configuration

  1. Set up Environment Variables

    Copy the example environment file and configure with your values:

    cp .env.example .env

    Edit the .env file and replace the placeholder values with secure configurations:

    # Generate strong secrets using Python
    python3 -c "import secrets; print('SECRET_KEY=' + secrets.token_urlsafe(32))"
    python3 -c "import secrets; print('REFRESH_SECRET_KEY=' + secrets.token_urlsafe(32))"
    python3 -c "import secrets; print('POSTGRES_PASSWORD=' + secrets.token_urlsafe(16))"

    ⚠️ Security Note: Never commit the .env file to version control. Use strong, unique passwords and secret keys in production.

Starting the Application

  1. Start the Backend Services

    Navigate to the project root directory and run:

    docker-compose up -d

    This command will start the PostgreSQL database, Redis, and the FastAPI backend service.

  2. Start the Frontend Flet App

    a. Create a virtual environment:

    python -m venv venv

    b. Activate the virtual environment:

    • On Windows:
      venv\Scripts\activate
    • On macOS and Linux:
      source venv/bin/activate

    c. Install the required packages:

    pip install -r requirements.txt

    d. Run the Flet application:

    python main.py --web  # also possible: flet run

This will launch the Flet application, and you should see a window open with the chat interface.

  1. Accessing the Application
  • The Flet frontend application will be running as a desktop app.
  • The FastAPI backend will be accessible at http://localhost:8000.

📚 Documentation

For comprehensive documentation on Flet-Chat, please refer to our GitHub Wiki. The wiki provides detailed information on installation, usage, architecture, and more.

For API-specific documentation, once the application is running, you can access:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

📞 Contact

For any questions or feedback, please open an issue on the GitHub repository.

Happy chatting! 🎉

About

A modern, real-time chat application built with Flet, FastAPI, and PostgreSQL.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •