A powerful life logging API built with FastAPI. Track your daily activities and moments with rich, structured data.
- Activity Management: Create and manage activity types with custom JSON schemas
- Moment Logging: Log moments with structured data based on activity schemas
- Flexible Querying: Filter moments by time range and activity type
- Data Validation: Automatic validation of moment data against activity schemas
- UTC Time Handling: Proper timezone handling for global usage
- Python 3.8+
- MySQL 8.0+
- Pipenv
- Clone the repository:
git clone https://github.com/yourusername/friday-api.git
cd friday-api
- Install dependencies:
pipenv install
- Set up your environment variables in
.env
:
APP_ENV=development
APP_NAME=friday-api
DATABASE_DIALECT=mysql
DATABASE_HOSTNAME=localhost
DATABASE_NAME=test_fridaystore
DATABASE_PASSWORD=your_password
DATABASE_PORT=3306
DATABASE_USERNAME=your_username
- Initialize the database:
# Run the SQL script in scripts/init_database.sql
- Start the server:
pipenv run uvicorn main:app --reload
The API will be available at:
- REST API: http://localhost:8000/v1
- API Documentation: http://localhost:8000/docs
See API Reference for detailed endpoint documentation.
curl -X POST "http://localhost:8000/v1/activities" \
-H "Content-Type: application/json" \
-d '{
"name": "Reading",
"description": "Track reading sessions",
"activity_schema": {
"type": "object",
"properties": {
"book": { "type": "string" },
"pages": { "type": "number" },
"notes": { "type": "string" }
}
},
"icon": "📚",
"color": "#4A90E2"
}'
curl -X POST "http://localhost:8000/v1/moments" \
-H "Content-Type: application/json" \
-d '{
"activity_id": 1,
"timestamp": "2024-12-11T05:30:00Z",
"data": {
"book": "The Pragmatic Programmer",
"pages": 50,
"notes": "Great chapter on code quality"
}
}'
friday-api/
├── configs/ # Configuration modules
├── models/ # SQLAlchemy models
├── schemas/ # Pydantic schemas
│ └── pydantic/ # Data validation schemas
├── repositories/ # Database operations
├── services/ # Business logic
├── routers/ # API endpoints
│ └── v1/ # API version 1
└── docs/ # Documentation
pipenv run pytest
This project is licensed under the MIT License - see the LICENSE file for details.