A modern, full-featured blogging platform built with Python Flask and beautiful UI design.
- Modern, responsive design with Tailwind CSS
- Gradient backgrounds and smooth animations
- Mobile-first approach
- Dark/light theme support
- User registration and login
- JWT-based authentication
- User profiles with avatars and bios
- Role-based access control (User/Admin)
- Create, edit, and delete posts
- Rich text content with markdown support
- Post categories and tags
- Featured images
- Post drafts and publishing
- View count tracking
- Like posts and comments
- Comment system with replies
- Real-time notifications
- Share posts functionality
- User management
- Post moderation
- Comment approval system
- Analytics dashboard
- Content management
- Search functionality
- Responsive design
- SEO-friendly URLs
- Image upload support
- Email notifications (coming soon)
- Backend: Python Flask
- Database: SQLite (development) / PostgreSQL (production)
- Frontend: HTML5, CSS3, JavaScript, Tailwind CSS
- Authentication: JWT tokens
- Icons: Font Awesome
- Deployment: Gunicorn + Nginx
- Python 3.8+
- pip (Python package installer)
-
Clone the repository
git clone <repository-url> cd miniblog
-
Create virtual environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
pip install -r requirements.txt
-
Set environment variables
export SECRET_KEY="your-secret-key-here" export JWT_SECRET_KEY="your-jwt-secret-here" export DATABASE_URL="sqlite:///miniblog.db"
-
Run the application
python app.py
The application will be available at http://localhost:5000
- Register an account at
/register - Login at
/login - Create your first post from the dashboard
- Explore other users' posts on the homepage
To create an admin user, you can modify the database directly or use the Flask shell:
from app import app, db
from models import User
with app.app_context():
admin_user = User(username='admin', email='your-admin-email@example.com', role='admin')
admin_user.set_password('your-secure-password')
db.session.add(admin_user)
db.session.commit()POST /api/auth/register- Register new userPOST /api/auth/login- User loginPOST /api/auth/logout- User logoutGET /api/auth/me- Get current user info
GET /api/posts/- Get all posts (with pagination)GET /api/posts/<id>- Get specific postPOST /api/posts/- Create new postPUT /api/posts/<id>- Update postDELETE /api/posts/<id>- Delete postPOST /api/posts/<id>/like- Like/unlike post
GET /api/comments/post/<post_id>- Get post commentsPOST /api/comments/- Create commentPOST /api/comments/<id>/like- Like/unlike comment
GET /api/admin/users- Get all usersGET /api/admin/posts- Get all postsGET /api/admin/comments- Get all comments
miniblog/
βββ app.py # Main Flask application
βββ models.py # Database models
βββ routes.py # API routes and blueprints
βββ database.py # Database configuration
βββ requirements.txt # Python dependencies
βββ templates/ # HTML templates
β βββ base.html # Base template
β βββ index.html # Homepage
β βββ dashboard.html # User dashboard
β βββ create_post.html # Post creation form
β βββ edit_post.html # Post editing form
β βββ post_detail.html # Post view page
β βββ auth/ # Authentication templates
β βββ admin/ # Admin panel templates
βββ instance/ # Database files
βββ README.md # This file
The UI uses Bootstrap 5. Customize by editing templates and the small custom styles in templates/base.html.
The application uses SQLAlchemy ORM. You can:
- Switch to PostgreSQL for production
- Add new models in
models.py - Modify existing models and run migrations
To add new features:
- Create new routes in
routes.py - Add corresponding templates
- Update the navigation in
base.html - Add new API endpoints as needed
-
Use a production WSGI server
pip install gunicorn gunicorn -w 4 -b 0.0.0.0:5000 app:app
-
Set up a reverse proxy (Nginx)
server { listen 80; server_name your-domain.com; location / { proxy_pass http://127.0.0.1:5000; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; } }
-
Use environment variables for production
export FLASK_ENV=production export SECRET_KEY="your-production-secret-key" export DATABASE_URL="postgresql://user:password@localhost/miniblog"
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the documentation
- Search existing issues
- Create a new issue with detailed information
- Email notifications
- Image upload functionality
- Advanced search filters
- Post scheduling
- User following system
- Dark mode toggle
- Mobile app (React Native)
- API rate limiting
- Content moderation tools
- Analytics dashboard
MiniBlog - Share your story with the world! π