Skip to content

codevalley/friday-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Friday API

A powerful life logging API built with FastAPI. Track your daily activities and moments with rich, structured data.

Python FastAPI OpenAPI Swagger Code style: black Typed with: pydantic

Features

  • 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

Getting Started

Prerequisites

  • Python 3.8+
  • MySQL 8.0+
  • Pipenv

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/friday-api.git
cd friday-api
  1. Install dependencies:
pipenv install
  1. 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
  1. Initialize the database:
# Run the SQL script in scripts/init_database.sql
  1. Start the server:
pipenv run uvicorn main:app --reload

The API will be available at:

API Documentation

See API Reference for detailed endpoint documentation.

Quick Examples

Create an Activity

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"
  }'

Log a Moment

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"
    }
  }'

Development

Project Structure

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

Running Tests

pipenv run pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A flexible and extensible life logger

Resources

License

Stars

Watchers

Forks

Packages

No packages published