bot link: [https://t.me/hackdetbot]
backend documentation: [https://telegram-mini-app-x496.onrender.com/docs]
hackdetbot is an AI-powered platform for creating, managing, and enrolling in structured educational courses. It dynamically generates courses, modules, lessons, and quizzes based on user input, integrating AI-generated content, images, and text-to-speech (TTS) capabilities.
- User registration and profile management.
- Token-based authentication for secure access.
- Enroll and track progress in courses.
- AI-generated courses, including modules, lessons, and quizzes.
- Course enrollment and progress tracking.
- Auto-generated lesson images for enhanced visual learning.
- Text-to-speech (TTS) integration for audio lesson playback.
- Automatically generates structured courses using LLM.
- Retrieves relevant images using external APIs.
- Generates quizzes based on lesson content.
- Auto-generated quizzes with multiple-choice and true/false questions.
- Tracks user progress across courses and lessons.
- Rewards users with experience points and tokens for completing quizzes.
- Backend: FastAPI, SQLAlchemy, Alembic
- Database: SQLite
- AI Integration: OpenAI (GPT), SerpAPI (Image retrieval)
- TTS: EdgeTTS for lesson audio generation
- Async Processing: ThreadPoolExecutor, asyncio
- Authentication: JWT
- Infrastructure: Docker, Render (Deployment)
.
├── app
│ ├── alembic
│ │ ├── README
│ │ ├── env.py
│ │ ├── script.py.mako
│ │ └── versions
│ │ └── de7386bba624_progress_2.py
│ ├── alembic.ini
│ ├── api
│ │ ├── courses.py
│ │ ├── lessons.py
│ │ ├── modules.py
│ │ ├── questions.py
│ │ ├── quizzes.py
│ │ ├── user_progress.py
│ │ └── users.py
│ ├── database
│ │ ├── base.py
│ │ └── models.py
│ ├── llm
│ │ ├── config.py
│ │ ├── course_creator.py
│ │ └── image_finder.py
│ ├── main.py
│ ├── repositories
│ │ ├── course_enrollment.py
│ │ ├── courses.py
│ │ ├── lessons.py
│ │ ├── modules.py
│ │ ├── questions.py
│ │ ├── quizzes.py
│ │ ├── user_progress.py
│ │ └── users.py
│ ├── schemas
│ │ ├── course_enrollment.py
│ │ ├── courses.py
│ │ ├── lessons.py
│ │ ├── modules.py
│ │ ├── questions.py
│ │ ├── quizzes.py
│ │ ├── user_progress.py
│ │ └── users.py
│ └── tts
│ └── tts.py
└── requirements.txt
10 directories, 36 files
-
Clone the Repository:
git clone https://github.com/dimalbek/Telegram-Mini-App.git cd Telegram-Mini-App/backend
-
Set up a Virtual Environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate
-
Install Dependencies:
pip install -r requirements.txt
-
Create .env File in the root directory and fill it with the following content:
OPENAI_API_KEY=your_openai_api_key SERPAPI_API_KEY=your_serpapi_key
-
Initialize the Database:
alembic upgrade head
-
Run the Application:
uvicorn app.main:app --reload
The API will now be accessible at http://127.0.0.1:8000 . You may check endpoints at http://127.0.0.1:8000/docs .
- POST /users/ - Register or retrieve a user
- GET /users/me - Get current user profile
- DELETE /users/ - Delete user account
- POST /courses/ - Create a new course
- GET /courses/ - Get all courses
- GET /courses/{course_id} - Get a specific course
- GET /courses/{course_id}/enroll - Enroll in a course
- GET /courses/{course_id}/disenroll - Leave a course
- PATCH /courses/{course_id} - Update a course
- DELETE /courses/{course_id} - Delete a course
- POST /courses/{course_id}/modules/ - Add a module
- GET /courses/{course_id}/modules/ - List course modules
- POST /modules/{module_id}/lessons/ - Add a lesson
- GET /modules/{module_id}/lessons/ - List module lessons
- GET /lessons/{lesson_id}/audio - Get TTS audio for a lesson
- POST /lessons/{lesson_id}/quiz/ - Create a quiz
- GET /lessons/{lesson_id}/quiz/ - Get a quiz
- POST /quizzes/{quiz_id}/questions/ - Add a question
- GET /quizzes/{quiz_id}/questions/ - List quiz questions
- POST /lessons/{lesson_id}/quiz/submit - Submit quiz results
Backend Developed by Bekzhan Kimadiyev and Dinmukhamed Albek.
Fronted Developed by Dastan Tynyshtyq and Alikhan Nashtay.