A self-hosted, lightweight blogging and portfolio platform built with FastAPI, SQLite, and Jinja2. This project is designed for simplicity and performance, utilizing client and server-side caching and Markdown rendering for dynamic content management.
- FastAPI Framework: High-performance asynchronous web framework.
- SQLite Database: Zero-configuration database for storing posts and pages.
- Markdown Support: Write content in Markdown; the engine renders it to HTML.
- Admin Interface: Built-in dashboard to create, edit, and delete posts securely.
- Session Authentication: Secure login system with hashed passwords and session management.
- Caching Strategy: Implements server-side caching for static files and pages to optimize load times and client-side preloading.
- CLI Configuration: Includes a command-line utility for easy initial setup.
- Clone the repository
git clone <repository-url>
cd <repository-name>
- Set up a virtual environment
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install dependencies Ensure you have the required packages installed (FastAPI, Uvicorn, Jinja2, Markdown, Cachetools, Colorama, Python-Multipart).
pip install -r requirements.txt
Before running the application, you must generate the configuration file. This handles site metadata, admin credentials, and legal information.
Run the interactive setup script:
python setup.py
Alternatively, you can run it non-interactively by passing arguments:
python setup.py --yes --admin-user "admin" --admin-pass "securepassword" --title "My Blog"
To start the application, run the main entry point. The server will host on 0.0.0.0:8000 by default.
python main.py
# OR
uvicorn main:app --host HOST --port PORT
- Navigate to
http://localhost:8000/admin. - Log in using the credentials defined during the
setup.pyprocess. - From the dashboard, you can manage blog posts and view site content.
-
main.py: The core application entry point and logic. -
setup.py: Configuration generation script. -
templates/: Jinja2 HTML templates. -
static/: CSS, JavaScript, images, and Markdown files. -
static/markdown/: Place.mdfiles here for static pages. -
static/css/themes/: CSS theme files. -
blog.db: SQLite database file (generated automatically upon first run).
Apache 2.0