FastAPI backend for Memoryful - Your AI-Powered Life Journal and Analysis Platform
Memoryful is an intelligent life journaling platform that combines personal data recording with AI-powered analysis to provide meaningful insights and recommendations for life improvement. The backend serves as the core engine, handling data processing, AI analysis, and integration with various external services.
- Life Journaling: Record and organize daily experiences, memories, and activities
- AI-Powered Analysis: Automated insights and recommendations using MemoryfulAI
- External Service Integration: Seamless connection with health, gaming, and location services
- Smart Search: Natural language queries about your life events and patterns
- Secure Authentication: JWT-based authentication with email verification
- Months: Track monthly summaries with descriptions and highlights
- Days: Detailed daily entries including:
- Descriptions and content
- Location data (country/city)
- Learning progress
- Custom tags
- Photo attachments
- Integration data
- Daily Analysis: Quick insights and notes
- Weekly Analysis: Trend identification and pattern recognition
- Monthly Analysis: Comprehensive summaries and statistics
- Yearly Analysis: Long-term insights and achievements
- Framework: FastAPI
- Database: PostgreSQL with Async SQLAlchemy 2.0
- Caching: Redis
- Message Broker: RabbitMQ
- Task Queue: Celery with Flower monitoring
- Authentication: JWT (Access + Refresh tokens)
- API Documentation: OpenAPI/Swagger
- Samsung Health (steps and activity data)
- Gaming platforms (Steam, Epic Games, EA)
- Google APIs (location and purchase history)
- Mobile gaming platforms
memoryful-backend/
├── app/
│ ├── core/ # Core functionality
│ ├── routers/ # API endpoints
│ ├── models/ # Database models
│ ├── schemas/ # Pydantic schemas
│ ├── tasks/ # Celery tasks
│ ├── templates/ # HTML templates (e.g. for email notifications)
│ ├── init_db.py # Database initialization script
│ └── main.py # FastAPI application entry point
├── docker/
│ ├── Dockerfile # Production container definition
│ ├── Dockerfile.dev # Development container definition
│ ├── Dockerfile.celery # Celery worker container definition
│ ├── docker-compose.local.yml # Local development orchestration
│ ├── docker-compose.prod.yml # Production orchestration (FastAPI only)
│ └── docker-compose.celery.yml # Celery worker deployment (for VM)
├── scripts/
│ └── deploy-celery-vm.sh # Script to create Celery worker VM
├── .env.local # Local development environment variables
├── .env.prod # Production environment template
├── .gitignore # Git ignore rules
├── mypy.ini # MyPy type checking configuration
├── requirements.txt # Python dependencies
├── requirements.dev.txt # Development dependencies
└── README.md # Project documentation
- Docker
- Docker Compose
This project supports two distinct environments:
- All services run locally in Docker containers
- No external dependencies or cloud services
- Uses local PostgreSQL, Redis, RabbitMQ, MinIO, Ollama
- Perfect for development and testing
- Uses GCP managed services (Cloud SQL, GCS, Pub/Sub)
- Secrets managed via GCP Secret Manager
- Optimized for Cloud Run deployment
- Celery workers run on separate e2-micro VM
-
Clone the repository:
git clone https://github.com/vlad-proger-rgb/memoryful-backend.git cd memoryful-backend -
Start with docker-compose
- Local:
docker-compose -p memoryful -f docker/docker-compose.local.yml --env-file=.env.local up --build
- Production using GCP services:
# First, create .env from template cp .env.prod .env # Edit .env with your actual values, then run: docker-compose -p memoryful -f docker/docker-compose.prod.yml --env-file=.env up --build
For production, you'll need to set up the following:
- Create a GCP project and enable the necessary APIs
- Set up Cloud SQL, GCS, and Pub/Sub
- Create secrets in GCP Secret Manager
- Deploy the application to Cloud Run
- Redis (e.g., Upstash Redis with free tier)
- Set up the Celery worker VM
Store these in GCP Secret Manager for production:
POSTGRES_USERPOSTGRES_PASSWORDPOSTGRES_HOSTREDIS_HOSTREDIS_PASSWORDACCESS_SECRET_KEYREFRESH_SECRET_KEYRESEND_API_KEYMAIL_FROMS3_ACCESS_KEY_ID(for GCS)S3_SECRET_ACCESS_KEY(for GCS)OPENAI_API_KEY(if using OpenAI)ANTHROPIC_API_KEY(if using Anthropic)
Once the server is running, access the API documentation at:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
This project is currently under active development. The backend is being developed as a solo project, focusing on creating a robust and scalable architecture that can support the complex requirements of the Memoryful platform.