Initial commit: deardiary project setup

This commit is contained in:
lotherk
2026-03-26 19:57:20 +00:00
commit 3f9bc1f484
73 changed files with 8627 additions and 0 deletions

131
README.md Normal file
View File

@@ -0,0 +1,131 @@
# DearDiary
> Your day, analyzed. A journal that writes itself.
AI-powered daily journal that captures life through multiple input methods and generates thoughtful, reflective journal entries.
## Features
- **Multiple Input Types**: Text notes, photos, voice memos, health data
- **AI Journal Generation**: OpenAI, Anthropic, Ollama, or LM Studio
- **Self-Hostable**: Run it yourself or use any hosted version
- **Same Codebase**: Single deployment works for single-user or multi-tenant
- **Task History**: Full logging of AI requests and responses
## Quick Start
### Docker (Recommended)
```bash
git clone https://github.com/your-repo/deardiary.git
cd deardiary
# Create .env file
cp backend/.env.example .env
# Edit .env and set JWT_SECRET
# Start
docker compose up -d
```
Visit http://localhost:5173
### Manual Development
```bash
# Backend
cd backend
bun install
bunx prisma generate
bunx prisma db push
bun run dev
# Frontend (separate terminal)
cd frontend
npm install
npm run dev
```
## Configuration
### Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `DATABASE_URL` | `file:./data/deardiary.db` | SQLite, PostgreSQL, or MySQL |
| `JWT_SECRET` | (required) | Secret for JWT signing |
| `MEDIA_DIR` | `./data/media` | Directory for uploads |
| `PORT` | `3000` | Server port |
| `CORS_ORIGIN` | `*` | Allowed origins |
### Database Examples
```bash
# SQLite (default)
DATABASE_URL="file:./data/deardiary.db"
# PostgreSQL
DATABASE_URL="postgresql://user:pass@host:5432/deardiary"
# MySQL
DATABASE_URL="mysql://user:pass@host:3306/deardiary"
```
## AI Providers
Configure in Settings after logging in:
| Provider | Setup |
|----------|-------|
| **OpenAI** | API key required |
| **Anthropic** | API key required |
| **Ollama** | Local URL (default: http://localhost:11434) |
| **LM Studio** | Local URL (default: http://localhost:1234/v1) |
## Project Structure
```
deardiary/
├── backend/ # Bun + Hono API server
│ ├── src/
│ │ ├── routes/ # API endpoints
│ │ ├── services/ # AI providers
│ │ └── middleware/
│ └── prisma/ # Database schema
├── frontend/ # React + Vite web app
├── android/ # Native Android app (Kotlin + Compose)
├── docker-compose.yml
└── PLAN.md # Full specification
```
## API
All endpoints require `Authorization: Bearer {api_key}` header.
```
POST /api/v1/auth/register
POST /api/v1/auth/login
POST /api/v1/auth/api-key
GET /api/v1/days
GET /api/v1/days/:date
DELETE /api/v1/days/:date
POST /api/v1/entries
GET /api/v1/entries/:id
PUT /api/v1/entries/:id
DELETE /api/v1/entries/:id
POST /api/v1/entries/:id/photo
POST /api/v1/entries/:id/voice
POST /api/v1/journal/generate/:date
GET /api/v1/journal/:date
GET /api/v1/journal/:date/tasks
GET /api/v1/settings
PUT /api/v1/settings
```
## License
MIT