Skip to content

gastonzarate/sleekreply_back

Repository files navigation

SleekReply API

Backend for building and running SleekReply chatbots from company documentation. It is a Django 5 / DRF service with Celery for async work, PostgreSQL for persistence, Weaviate as the vector store, and OpenAI-powered embeddings and responses.

What’s Inside

  • Python 3.11, Django 5, Django REST Framework, SimpleJWT
  • Celery + Redis (worker queue) and Flower (monitoring)
  • PostgreSQL database
  • Weaviate vector database for document embeddings
  • Optional AWS S3 storage (production), Whitenoise for local static files
  • Google OAuth support and Pusher websocket notifications
  • Sentry hooks for production observability

Project Layout

  • apps/bots: Bot, flow, step, and vector DB logic plus Celery tasks
  • apps/accounts: Profiles, API keys, JWT + Google OAuth endpoints
  • apps/services: Weaviate and websocket service helpers
  • config: Django settings, URLs, ASGI/WSGI, Celery app
  • docker-compose.yml: API, Postgres, Weaviate, Redis, Celery worker, Flower
  • requirements/*.txt: Base, dev, test, and production dependencies

Prerequisites

  • Docker and docker-compose
  • Make sure ports 8000 (API), 5432 (Postgres), 8080/50051 (Weaviate), 5555 (Flower) are free

Quick Start (Docker)

  1. Copy environment defaults:
cp env.local .env
  1. Build and start the stack:
docker-compose build
docker-compose up
  1. Run migrations once the API container is up:
docker-compose exec api python manage.py migrate
  1. (Optional) Create an admin user:
docker-compose exec api python manage.py createsuperuser
  1. Services:

Development Workflow

  • Run tests:
docker-compose exec api pytest
  • Lint/format via pre-commit:
docker-compose exec api pre-commit install
docker-compose exec api pre-commit run --all-files
  • Migrations:
docker-compose exec api python manage.py makemigrations
docker-compose exec api python manage.py migrate
  • Django shell (with django-extensions):
docker-compose exec api python manage.py shell_plus

Environment Variables

Use env.local as a template (cp env.local .env). Key entries:

  • ENVIRONMENT, DJANGO_SETTINGS_MODULE (e.g., config.settings.dev)
  • DATABASE_URL, REDIS_URL
  • OPENAI_API_KEY
  • Weaviate: WEAVIATE_LOCAL, WEAVIATE_LOCAL_URL, WEAVIATE_LOCAL_HTTP_PORT, WEAVIATE_LOCAL_GRPC_PORT
  • Auth: ACCESS_TOKEN_LIFETIME, REFRESH_TOKEN_LIFETIME, ROTATE_REFRESH_TOKENS, BLACKLIST_AFTER_ROTATION
  • Storage: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_STORAGE_BUCKET_NAME, AWS_DEFAULT_REGION
  • Google OAuth: GOOGLE_CLIENT_ID, GOOGLE_PROJECT_ID, GOOGLE_CLIENT_SECRET
  • Pusher: PUSHER_APP_ID, PUSHER_APP_KEY, PUSHER_APP_SECRET, PUSHER_APP_CLUSTER

API Notes

  • JWT endpoints: /api/auth/login, /api/auth/login/refresh/, /api/auth/logout/
  • Core resources are namespaced under /api/v1/ (bots, flows, vector DB, schema/vectorial operations, profiles, API keys).

Deployment

  • Fly.io deploy helper: make deploy (builds, scales app and Celery, then runs migrations).

Troubleshooting

  • If migrations fail on first boot, rerun docker-compose exec api python manage.py migrate.
  • Ensure OPENAI_API_KEY is set before using embedding/chat features.
  • Weaviate must be up before ingestion tasks; restart the worker if it cannot reach the vector store.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages