Skip to main content

A lightweight async Python CMS for crafting modern websites

Project description

Skrift

A modern Litestar-powered content management framework with multi-provider OAuth authentication, role-based access control, and WordPress-like template resolution.

Features

  • Multi-Provider OAuth: Authenticate with Google, GitHub, Microsoft, Discord, Facebook, or Twitter/X
  • Role-Based Access Control: Flexible permission system with Admin, Editor, Author, and Moderator roles
  • Setup Wizard: Guided first-time configuration without manual file editing
  • Admin Interface: Web-based management for users, pages, and site settings
  • WordPress-like Templates: Hierarchical template resolution for content pages
  • Dynamic Controllers: Load controllers from app.yaml configuration
  • SQLAlchemy Integration: Async database support with SQLite/PostgreSQL
  • Client-Side Sessions: Encrypted cookie sessions for horizontal scalability

Quick Start

Prerequisites

  • Python 3.13+

Installation

# Install Skrift
pip install skrift

# Or install from git
pip install git+https://github.com/ZechCodes/skrift.git

Getting Started

Create a project directory and set up your environment:

mkdir mysite && cd mysite

# Create minimal environment file
echo "SECRET_KEY=$(python -c 'import secrets; print(secrets.token_urlsafe(32))')" > .env

# Start Skrift
skrift

Open http://localhost:8080 to launch the setup wizard.

Setup Wizard

The setup wizard guides you through initial configuration:

  1. Database Configuration: Choose SQLite (dev) or PostgreSQL (production)
  2. Authentication Providers: Configure OAuth credentials
  3. Site Settings: Set site name, tagline, and copyright info
  4. Admin Account: Create your first admin user via OAuth login

After completing the wizard, an app.yaml configuration file is created in your project directory.

Manual Configuration

Alternatively, create app.yaml manually:

controllers:
  - skrift.controllers.auth:AuthController
  - skrift.admin.controller:AdminController
  - skrift.controllers.web:WebController

db:
  url: sqlite+aiosqlite:///./app.db

auth:
  redirect_base_url: http://localhost:8080
  providers:
    google:
      client_id: $GOOGLE_CLIENT_ID
      client_secret: $GOOGLE_CLIENT_SECRET
      scopes: [openid, email, profile]

Then run migrations and start the server:

skrift-db upgrade head
skrift

Documentation

Project Structure

skrift/
├── skrift/              # Main Python package
│   ├── asgi.py          # Application factory
│   ├── config.py        # Settings management
│   ├── controllers/     # Route handlers
│   ├── admin/           # Admin panel
│   ├── auth/            # RBAC and guards
│   ├── db/              # Models and services
│   ├── lib/             # Template resolver
│   └── setup/           # Setup wizard
├── templates/           # Jinja2 templates
├── static/              # Static assets
├── alembic/             # Database migrations
├── docs/                # Documentation
├── app.yaml             # Application config (generated)
└── main.py              # Development entry point

Configuration

Environment Variables

Variable Required Description
SECRET_KEY Yes Session encryption key
DEBUG No Enable debug mode (default: false)
DATABASE_URL No Database connection string
OAUTH_REDIRECT_BASE_URL No OAuth callback base URL

OAuth credentials are configured per-provider (e.g., GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET).

app.yaml

Application configuration is stored in app.yaml (generated by setup wizard):

controllers:
  - skrift.controllers.auth:AuthController
  - skrift.admin.controller:AdminController
  - skrift.controllers.web:WebController

db:
  url: $DATABASE_URL
  pool_size: 5

auth:
  redirect_base_url: $OAUTH_REDIRECT_BASE_URL
  providers:
    google:
      client_id: $GOOGLE_CLIENT_ID
      client_secret: $GOOGLE_CLIENT_SECRET

Environment variables (prefixed with $) are interpolated at runtime.

Deployment

Minimal VPS Deployment

# Install Skrift
pip install skrift

# Create project directory
mkdir -p /opt/skrift && cd /opt/skrift

# Configure environment
cat > .env << EOF
SECRET_KEY=$(python -c "import secrets; print(secrets.token_urlsafe(32))")
DATABASE_URL=sqlite+aiosqlite:///./app.db
OAUTH_REDIRECT_BASE_URL=https://yourdomain.com
EOF

# Start server (use setup wizard or create app.yaml manually)
skrift

Production with Gunicorn

pip install gunicorn
gunicorn skrift.asgi:app -w 4 -k uvicorn.workers.UvicornWorker -b 0.0.0.0:8080

See the Deployment Guide for detailed instructions including Docker, Docker Compose, and Kubernetes deployments.

Database Migrations

# Apply migrations
skrift-db upgrade head

# Create new migration
skrift-db revision --autogenerate -m "description"

# Rollback
skrift-db downgrade -1

Template Resolution

Templates follow WordPress-like hierarchical resolution:

URL Path Templates Tried
/about page-about.html -> page.html
/services/web page-services-web.html -> page-services.html -> page.html

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

License

MIT

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

skrift-0.1.0a5.tar.gz (63.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

skrift-0.1.0a5-py3-none-any.whl (89.8 kB view details)

Uploaded Python 3

File details

Details for the file skrift-0.1.0a5.tar.gz.

File metadata

  • Download URL: skrift-0.1.0a5.tar.gz
  • Upload date:
  • Size: 63.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for skrift-0.1.0a5.tar.gz
Algorithm Hash digest
SHA256 176f3b84b4277806e18de6661ce6f871922eb9bbb1d76edcea306d4533b0849f
MD5 c10c3521ba9b81d5458faafe7ba411d7
BLAKE2b-256 3b94cd9b3a0275d4c2d02d756d11f8ff400424d12109a37238b5ae038e7d67a0

See more details on using hashes here.

File details

Details for the file skrift-0.1.0a5-py3-none-any.whl.

File metadata

  • Download URL: skrift-0.1.0a5-py3-none-any.whl
  • Upload date:
  • Size: 89.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.27 {"installer":{"name":"uv","version":"0.9.27","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for skrift-0.1.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 4f96a56f8a8b246ae16adbfb98f10789771fcdd384491352717e9c15f6a6d0cb
MD5 28dd7716095ca7a66b70a38445add2af
BLAKE2b-256 469ef7856203902eb8db356d13749c9f92b7f9edeb2db4d7ac16579ab82d440d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page