A networked TUI chat application with a Django backend and Python TUI client.
- Backend: Django web server with REST + WebSocket APIs, JWT authentication, and device auth flow
- Client: Python TUI (Textual) chat client, distributed via Homebrew
- Python 3.11+
- PostgreSQL (production) or SQLite (development)
- Redis (for WebSocket channel layers in production)
cd backend
pip install -r requirements.txtCreate a .env file in backend/:
DJANGO_SECRET_KEY=your-secret-key
DEBUG=True
ALLOWED_HOSTS=localhost,127.0.0.1
# PostgreSQL (production)
DATABASE_URL=postgres://user:pass@localhost:5432/logographic_chat
# Redis (production)
REDIS_URL=redis://localhost:6379
# OAuth (optional - for social login)
SOCIAL_AUTH_APPLE_CLIENT_ID=
SOCIAL_AUTH_APPLE_SECRET=
SOCIAL_AUTH_GOOGLE_CLIENT_ID=
SOCIAL_AUTH_GOOGLE_SECRET=cd backend
python manage.py migratepython manage.py createsuperuser# Development
python manage.py runserver
# Production with Daphne
daphne -b 0.0.0.0 -p 8000 config.asgi:applicationThe backend will be available at http://localhost:8000.
python manage.py shellfrom chat.models import Room
Room.objects.get_or_create(name="general")
Room.objects.get_or_create(name="questions")cd client
pip install -e .Or install in development mode with dev dependencies:
pip install -e ".[dev]"Run the client to start the device auth flow:
logographic-chat --server http://localhost:8000Or explicitly:
logographic-chat login --server http://localhost:8000This will:
- Display a device code in the terminal
- Open your browser to the verification URL
- Enter the code and log in via Django's authentication system
- Store credentials locally at
~/.config/logographic-chat/credentials.json
logographic-chat --server http://localhost:8000Controls:
- Type messages and press Enter to send
- Press Escape to quit
python manage.py migrate # Run database migrations
python manage.py createsuperuser # Create admin user
python manage.py runserver # Start dev server
python manage.py shell # Django shelllogographic-chat # Start chat (auto-login if credentials exist)
logographic-chat login # Authenticate with server
logographic-chat logout # Remove stored credentials
logographic-chat --server URL # Specify custom serverEnvironment variables:
LOGOGRAPHIC_SERVER- Default server URL
| Endpoint | Method | Description |
|---|---|---|
/api/auth/device/ |
POST | Start device auth flow |
/api/auth/token/ |
POST | Poll for auth token |
/auth/device/verify/ |
GET/POST | Device verification page |
/api/rooms/ |
GET | List chat rooms |
/api/rooms/<id>/messages/ |
GET | Get room messages |
/ws/chat/<id>/ |
WebSocket | Real-time chat |
- Set
DEBUG=False - Configure PostgreSQL database
- Configure Redis for channel layers
- Set
ALLOWED_HOSTSto your domain - Configure HTTPS (reverse proxy with nginx)
- Run migrations
- Create superuser
- Seed initial rooms
See Homebrew Distribution for building standalone binaries and creating a Homebrew tap.
logographic-chat/
├── backend/ # Django project
│ ├── logographic_chat/ # Django settings
│ ├── chat/ # Chat app (models, views, websockets)
│ ├── accounts/ # Auth app (device flow)
│ └── requirements.txt
├── client/ # TUI client
│ ├── src/logographic_chat/
│ │ ├── auth.py # Device auth
│ │ ├── api.py # REST client
│ │ ├── ws.py # WebSocket client
│ │ ├── tui.py # Textual UI
│ │ └── cli.py # CLI entry point
│ └── pyproject.toml
└── README.md
% git tag v0.1. % git push origin v0.1.0
git add . git commit -m "fix: use --paths for PyInstaller" git tag v0.1.8 git push origin main --tags
or
git add . git commit -m "fix: use --paths for PyInstaller" git tag v0.1.8 git push origin main git push origin v0.1.8
git tag --sort=-creatordate | head -5