A private, family-oriented chat and forum application built with Flask. Perfect for keeping families connected with organized discussions, event planning, and private messaging. Without the overhead, secutity risks, and flood of garbage you get with most social media these days.
-
Organized Rooms: Create and manage discussion rooms for different topics. Some defaults to get you started
- Family Events
- General Discussion
- News
- Music
- The Zoo (pets and animals)
- Technology
-
Posts & Replies: Threaded discussions with rich content support
- Text posts with titles
- Image attachments (PNG, JPG, JPEG, GIF)
- Automatic image resizing for optimal display
- Pagination for large discussion threads
-
Private Messaging: Direct communication between family members
- One-on-one private message rooms
- Message history with timestamps
- Image support in messages
-
User Management
- Self-signup with admin approval (optional)
- User profiles with email addresses
- Account enable/disable functionality
- Password change functionality
-
Admin Panel: Comprehensive administrative controls
- User management (add, edit, delete, approve/reject)
- Room creation and management
- Post and reply deletion
- Private room permission controls
- User authorization for restricted rooms
- Secure password hashing using Werkzeug's PBKDF2
- CSRF protection on all forms
- Input validation and sanitization
- Session-based authentication
- Email format validation
- File upload security (extension validation, directory traversal prevention)
- Python 3.8 or higher
- pip (Python package manager)
-
Clone or download the project
cd FamilyChat -
Create a virtual environment (recommended)
python -m venv venv # On Windows venv\Scripts\activate # On macOS/Linux source venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Configure the application
The application requires a secret key for session management. You can either:
Option A: Set environment variable (recommended for production)
export SECRET_KEY="your-secure-random-key-here" # or on Windows: set SECRET_KEY=your-secure-random-key-here
Option B: Use auto-generated key (development only) The app will generate a new random key each run if no SECRET_KEY is provided.
-
Initialize the database
python database.py
This creates:
- SQLite database (
family_chat.db) - Default admin account (username:
admin, password:admin) - Default discussion rooms
- SQLite database (
Edit config.py to customize:
# Database path
DATABASE_URL = 'sqlite:///family_chat.db'
# Upload settings
UPLOAD_FOLDER = 'static/uploads'
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'}
MAX_IMAGE_SIZE = (800, 600) # Maximum dimensions for resized images
# Pagination
POSTS_PER_PAGE = 10
REPLIES_PER_PAGE = 15
# Self-signup (set to False to require admin-created accounts)
SELF_SIGNUP_ENABLED = Truepython app.pyThe application will start on http://0.0.0.0:7000
- Username:
admin - Password:
admin
Important: Change the admin password immediately after first login!
- Login with your credentials
- Browse rooms from the main dashboard
- Create posts in any room (click "Create New Post")
- Reply to posts at the bottom of each post
- Send private messages via the private message system
- Upload images with posts, replies, and messages
Access the admin panel by logging in as an administrator:
- Manage Users: View, edit, delete, approve/reject users
- Create Rooms: Add new discussion rooms
- Edit Rooms: Modify room names, descriptions, and permissions
- Delete Content: Remove posts or replies (deletes all associated replies)
- Room Permissions: Control access to private rooms
FamilyChat/
├── app.py # Main application file
├── config.py # Configuration settings
├── database.py # Database initialization and setup
├── models.py # SQLAlchemy database models
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
├── README.md # This file
├── static/
│ ├── style.css # Application styles
│ ├── logo.jpg # Site logo
│ ├── logo2.jpg # Alternative logo
│ └── uploads/ # User-uploaded images
└── templates/ # HTML templates
├── base.html # Base template
├── login.html # Login page
├── signup.html # Registration page
├── index.html # Main dashboard
├── room.html # Room view
├── post.html # Post detail view
├── messages.html # Private messages list
├── message.html # Individual message room
├── admin.html # Admin panel
└── ... # Other templates
-
Set a strong SECRET_KEY: Generate a cryptographically secure random string
python -c "import secrets; print(secrets.token_hex(32))" -
Disable self-signup if you want to control account creation:
SELF_SIGNUP_ENABLED = False
-
Use a production web server: This app uses Flask's development server. For production, use:
- Gunicorn
- uWSGI
- Waitress (Windows)
-
Enable HTTPS: Always use HTTPS in production to encrypt data in transit
-
Regular backups: Back up your
family_chat.dbfile regularly
- ✅ CSRF protection on all forms
- ✅ Secure password hashing (PBKDF2)
- ✅ Input validation and sanitization
- ✅ File upload security checks
- ✅ Session-based authentication
- ✅ Email format validation
If you encounter database errors, try:
# Delete the old database and recreate
rm family_chat.db
python database.py- Ensure the
static/uploads/directory exists and is writable - Check file size limits in your web server configuration
- Verify image formats are supported (PNG, JPG, JPEG, GIF)
- Default credentials:
admin/admin - If accounts are disabled, check admin panel
- Self-signup accounts require admin approval by default
Edit the default_rooms list in database.py to customize initial rooms.
Edit static/style.css to change colors, fonts, and layout.
The modular structure makes it easy to add:
- New room types
- Additional user roles
- Email notifications
- Rich text editing
- File sharing beyond images
This is a family project. Feel free to use and modify as needed for your family's communication needs.
Enjoy keeping your family connected! 🏠💬
Some screenshots