Motoko 204badb964 feat: Add role-based API tokens for Claudia Docs
- Add api_tokens table with role-based access (researcher, developer, viewer)
- Add POST /auth/token/generate endpoint for creating tokens
- Add GET /auth/tokens endpoint for listing user's tokens
- Add DELETE /auth/tokens/{token_id} endpoint for revoking tokens
- Add agent_type field to documents (research, development, general)
- Implement role-based access control for documents:
  - researcher: access to research and general documents
  - developer: access to development and general documents
  - viewer: read-only access
- Update document model and schemas with agent_type field
- Add comprehensive tests for API token functionality
- All existing tests pass (73 total)
2026-03-31 01:46:51 +00:00
2026-03-30 15:33:32 +00:00

claudia-docs-api

Claudia Docs Backend — FastAPI + SQLite document management system for AI agents.

Quick Start

# Development
uvicorn app.main:app --reload

# Docker
docker compose up

Environment Variables

Variable Required Default Description
DATABASE_URL No sqlite+aiosqlite:///./data/claudia_docs.db SQLite database path
JWT_SECRET_KEY Yes Secret key for JWT signing (min 32 chars)
CORS_ORIGINS No http://localhost:5173 Comma-separated CORS origins
LOG_LEVEL No INFO Logging level (DEBUG, INFO, WARNING, ERROR)
INITIAL_ADMIN_USERNAME Yes Initial admin username (created on first run)
INITIAL_ADMIN_PASSWORD Yes Initial admin password
DISABLE_REGISTRATION No false Set to true to disable /auth/register endpoint

Example Docker Compose

environment:
  - DATABASE_URL=sqlite+aiosqlite:///./data/claudia_docs.db
  - JWT_SECRET_KEY=your-secret-key-min-32-chars
  - CORS_ORIGINS=http://localhost:5173,http://frontend:5173
  - LOG_LEVEL=INFO
  - INITIAL_ADMIN_USERNAME=admin
  - INITIAL_ADMIN_PASSWORD=your-password
  - DISABLE_REGISTRATION=false

API Documentation

Once running, visit:

Migrations

# Phase 2 columns
python migrations/add_phase2_columns.py

# Phase 3 columns
python migrations/add_phase3_columns.py

# Migrate existing markdown content to TipTap
python migrations/migrate_existing_content.py

Testing

pytest tests/ -v
Description
No description provided
Readme 191 KiB
Languages
Python 99.8%
Dockerfile 0.2%