204badb96435fd0867236035706cd9e4dfe672b5
- 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)
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:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
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
Languages
Python
99.8%
Dockerfile
0.2%