A modern web application built with Flask that provides user authentication, posts, messaging, and search functionality. Thoughtlet is a social platform where users can share thoughts, follow others, send messages, and search for content.
- π User Authentication: Registration, login, logout, and password reset
- π Posts: Create, view, and manage posts with timestamps
- π¬ Messaging: Private messaging system between users
- π₯ Social Features: Follow/unfollow users, view followers and following
- π Search: Search functionality for posts and users
- π§ Email Integration: Email notifications and password reset
- π Internationalization: Multi-language support
- π± Responsive Design: Mobile-friendly interface
- π Background Tasks: Asynchronous task processing with Redis Queue
- π Notifications: Real-time user notifications
- Backend: Flask (Python)
- Database: SQLite (development) / PostgreSQL (production)
- Authentication: Flask-Login
- Forms: Flask-WTF
- Email: Flask-Mail
- Database Migrations: Flask-Migrate (Alembic)
- Task Queue: Redis Queue (RQ)
- Frontend: Bootstrap, JavaScript
- Deployment: Gunicorn
Before you begin, ensure you have the following installed:
- Python 3.8 or higher
- pip (Python package installer)
- Git
- PowerShell (for running the startup script)
- Visual Studio Build Tools (for some Python packages)
- Build essentials (gcc, make, etc.)
- Python development headers
git clone https://github.com/iaaryanraj/thoughtlet.git
cd thoughtletWindows:
python -m venv .venv
.\.venv\Scripts\Activate.ps1Linux/macOS:
python3 -m venv .venv
source .venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root directory:
# Basic Configuration
SECRET_KEY=your-secret-key-here
FLASK_ENV=development
# Database Configuration
DATABASE_URL=sqlite:///app.db
# Email Configuration (optional)
MAIL_SERVER=smtp.gmail.com
MAIL_PORT=587
MAIL_USE_TLS=1
MAIL_USERNAME=[email protected]
MAIL_PASSWORD=your-app-password
ADMINS=[email protected]flask db upgradeIf you encounter migration issues, you can initialize the database:
flask db init
flask db migrate -m "Initial migration"
flask db upgradeThe project includes a convenient PowerShell script that handles all setup:
.\start-thoughtlet.ps1Development Mode:
# Set environment variables
export FLASK_APP=thoughtlet.py
export FLASK_ENV=development
# Run the application
flask runWindows (PowerShell):
$env:FLASK_APP = "thoughtlet.py"
$env:FLASK_ENV = "development"
flask runflask run --host=0.0.0.0 --port=5000The application will be available at http://localhost:5000
| Variable | Description | Default |
|---|---|---|
SECRET_KEY |
Flask secret key for sessions | you-will-never-guess |
DATABASE_URL |
Database connection string | SQLite in project directory |
FLASK_ENV |
Flask environment mode | production |
FLASK_HOST |
Server host address | 127.0.0.1 |
FLASK_PORT |
Server port | 5000 |
MAIL_SERVER |
SMTP server for emails | None |
MAIL_PORT |
SMTP port | 25 |
MAIL_USE_TLS |
Enable TLS for email | False |
MAIL_USERNAME |
Email username | None |
MAIL_PASSWORD |
Email password | None |
ADMINS |
Admin email addresses | None |
thoughtlet/
βββ app/ # Application package
β βββ api/ # REST API blueprint
β βββ auth/ # Authentication blueprint
β βββ errors/ # Error handling
β βββ main/ # Main application blueprint
β βββ static/ # Static files (CSS, JS, images)
β βββ templates/ # Jinja2 templates
β βββ cli.py # Command line interface
β βββ email.py # Email utilities
β βββ models.py # Database models
β βββ search.py # Search functionality
β βββ tasks.py # Background tasks
βββ migrations/ # Database migrations
βββ logs/ # Application logs
βββ instance/ # Instance-specific files
βββ tests.py # Test suite
βββ thoughtlet.py # Application entry point
βββ config.py # Configuration
βββ requirements.txt # Python dependencies
βββ start-thoughtlet.ps1 # Windows startup script
- User: User accounts and profiles
- Post: User posts and content
- Message: Private messages between users
- Notification: User notifications
- Task: Background task tracking
python tests.pyCreate a new migration:
flask db migrate -m "Description of changes"Apply migrations:
flask db upgradeRollback migrations:
flask db downgrade-
Virtual Environment Issues
# Recreate virtual environment rm -rf .venv python -m venv .venv source .venv/bin/activate # Linux/macOS .\.venv\Scripts\Activate.ps1 # Windows pip install -r requirements.txt
-
Database Issues
# Reset database rm instance/app.db flask db upgrade -
Port Already in Use
# Use different port flask run --port=5001 -
Permission Issues (Windows)
# Enable script execution Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Application logs are stored in the logs/ directory. Check logs/thoughtlet.log for debugging information.


