A REST API providing user authentication, multi-tenant note management, and an asynchronous background job for summarizing note content. This project was built as part of a candidate backend assignment.
🚀 Containerized with Docker for easy setup and deployed to the cloud for quick access.
- ⚙️ Tech Stack
- ✨ Features
- 🖥️ Local Setup
- 🔑 Example Environment Variables
- 📡 API Endpoints
- ☁️ Deployment
- 📜 License
| Layer | Technology |
|---|---|
| Language | Python 3.11 |
| Framework | FastAPI |
| Database | PostgreSQL |
| Async Tasks | Celery & Redis |
| ORM | SQLAlchemy |
| Migrations | Alembic |
| AI Model | Hugging Face Transformers (sshleifer/distilbart-cnn-6-6) |
| Containerization | Docker & Docker Compose |
✅ Authentication: Secure email/password signup & login with JWTs.
✅ Multi-Tenancy: Role-based access (ADMIN, AGENT). Agents see only their own notes, Admins manage all.
✅ Asynchronous Summarization: Celery worker handles summarization in the background — API stays responsive.
✅ Job Status Tracking: Check summarization status (queued, processing, done, failed).
✅ Local AI Model: Self-contained Hugging Face model — no API keys required.
✅ Containerized Setup: Single docker-compose up to launch the whole stack.
You’ll need Docker and Docker Compose installed.
git clone https://github.com/Balghi/mini-crm-ai.git
cd mini-crm-aiCopy .env.example to .env:
cp .env.example .envDefault values are pre-configured for local use.
docker-compose up --buildRun in detached mode:
docker-compose up --build -dAfter containers are running:
docker-compose exec api alembic upgrade headYour API is now live at http://localhost:8000 🎉
Create a .env file using the template below:
# URL for local Postgres database inside Docker
DATABASE_URL="postgresql://user:password@db:5432/notesdb"
# URL for local Redis broker inside Docker
CELERY_BROKER_URL="redis://redis:6379/0"
# Secret key for signing JWTs - CHANGE FOR PRODUCTION
SECRET_KEY="a_very_secret_key_that_should_be_long_and_random"
ALGORITHM="HS256"
ACCESS_TOKEN_EXPIRE_MINUTES=30Interactive Swagger Docs available at http://localhost:8000/docs.
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/signup |
Create a new user (defaults to AGENT role). |
| POST | /api/v1/login |
Get a JWT token. |
| POST | /api/v1/notes |
Create a new note (queues summarization job). |
| GET | /api/v1/notes/{id} |
Fetch note & check summarization status. |
The API is deployed on Koyeb:
🔗 Live URL: standard-kelcy-balghi-9b55f2cb.koyeb.app
⚠️ Note: On the free tier, background summarization is disabled (due to memory limits). All Auth, Tenancy, and CRUD features work as expected. Run locally via Docker to experience full functionality with async AI summarization.
This project is provided as part of a candidate assignment and is open for review and educational purposes.
💡 Tip: If you find this useful or want to test the full async AI-powered version, clone and run it locally!
Made with ❤️ using FastAPI & Hugging Face