A digital garden for organizing and sharing knowledge, powered by FastAPI and AI.
- Content management with Markdown and YAML front matter
- AI-powered metadata generation and content analysis
- Automatic content relationships and recommendations
- Search with semantic understanding
- Beautiful, responsive UI
-
Clone the repository:
git clone https://github.com/yourusername/digital_garden.git cd digital_garden
-
Run the setup script to create a virtual environment and install dependencies (Python 3.12+ required):
./setup.sh
If you prefer to run the steps manually:
uv venv source .venv/bin/activate # On Windows: .venv\Scripts\activate uv sync
-
Set up environment variables: Create a
.env
file in the project root with:# Required API keys ANTHROPIC_API_KEY=your_anthropic_api_key # Optional settings ENVIRONMENT=development # or production CLAUDE_MODEL=claude-3-5-sonnet-latest # or other model version CLAUDE_MAX_TOKENS=4096 CLAUDE_TEMPERATURE=0.7 BASE_URL=https://anoliphantneverforgets.com
-
Initialize the content directories:
python -c "from app.config import setup_directories; setup_directories()"
-
Run the development server:
uvicorn app.main:app --reload
The site will be available at http://localhost:8000
Content is organized in the following directories under app/content/
:
bookmarks/
: Links to interesting resourceshow_to/
: Step-by-step guidesnotes/
: General notes and articlespages/
: Static pages (about, now, etc.)til/
: Today I Learned snippets
Each content file should be a Markdown file with YAML front matter:
---
title: "Your Title Here"
created: "2024-03-14"
updated: "2024-03-14"
tags: [tag1, tag2]
status: "Evergreen" # or "Budding"
---
Your content here...
The site uses AI (Claude and GPT-4) for:
- Metadata generation and enhancement
- Content analysis and recommendations
- Semantic search
- Writing style consistency
- SEO optimization
Configure AI behavior in app/config.py
Run tests:
pytest
Format code:
black .
Type checking:
mypy .
The timed_lru_cache
decorator in app/main.py
keeps its data in process
memory and does not implement any locking. It is designed for single-threaded
execution. For deployments with multiple workers or threads, prefer an external
cache instead of this helper.