{"id":30612431,"url":"https://github.com/991o2o9/tg_bot_shop","last_synced_at":"2026-05-16T18:04:07.815Z","repository":{"id":311772711,"uuid":"1044959638","full_name":"991o2o9/tg_bot_shop","owner":"991o2o9","description":"Telegram bot for e-commerce with product catalog, shopping cart, bulk pricing, order management, and admin panel. Built with Aiogram 3, SQLAlchemy 2.0, and PostgreSQL.","archived":false,"fork":false,"pushed_at":"2025-08-26T13:05:20.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-26T17:49:34.441Z","etag":null,"topics":["bot","postgres","python","shop","telegrambot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/991o2o9.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-26T13:01:11.000Z","updated_at":"2025-08-26T13:07:57.000Z","dependencies_parsed_at":"2025-08-26T17:51:05.652Z","dependency_job_id":"efa0aea1-00ca-4956-a904-09527b2fc4b3","html_url":"https://github.com/991o2o9/tg_bot_shop","commit_stats":null,"previous_names":["991o2o9/tg_bot_shop"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/991o2o9/tg_bot_shop","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/991o2o9%2Ftg_bot_shop","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/991o2o9%2Ftg_bot_shop/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/991o2o9%2Ftg_bot_shop/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/991o2o9%2Ftg_bot_shop/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/991o2o9","download_url":"https://codeload.github.com/991o2o9/tg_bot_shop/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/991o2o9%2Ftg_bot_shop/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272805572,"owners_count":24995916,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bot","postgres","python","shop","telegrambot"],"created_at":"2025-08-30T05:13:56.456Z","updated_at":"2026-05-16T18:04:07.782Z","avatar_url":"https://github.com/991o2o9.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shop Bot\n\nA Telegram bot for product catalog management, shopping cart functionality, order processing, and admin panel operations through bot commands.\n\n## Features\n\n### User Features\n- **Product Catalog**: Browse products with prices, descriptions, and photos\n- **Shopping Cart**: Add/remove items and place orders\n- **Bulk Discounts**: Special pricing for bulk quantities (price from N items)\n- **Contact Management**: Save user contact information for orders\n- **Order Tracking**: View order history and status\n\n### Admin Features\n- **Product Management**: Add, edit, and delete products\n- **Order Management**: View and manage customer orders\n- **Broadcasting**: Send messages to all users\n- **Branding**: Customize bot appearance and messages\n- **Review Management**: Manage product reviews\n\n## Technologies\n\n- **Bot Framework**: Aiogram 3.6.0\n- **Database**: PostgreSQL with SQLAlchemy 2.0 (async, asyncpg)\n- **Migrations**: Alembic\n- **Validation**: Pydantic\n- **Logging**: Loguru\n- **Async Runtime**: uvloop (Linux/macOS)\n\n## Project Structure\n\n```\nshop-bot/\n├── app/\n│   ├── bot/\n│   │   ├── handlers/\n│   │   │   ├── admin/          # Admin command handlers\n│   │   │   │   ├── branding.py\n│   │   │   │   ├── products.py\n│   │   │   │   └── reviews.py\n│   │   │   └── user/           # User command handlers\n│   │   │       └── catalog.py\n│   │   ├── keyboards/          # Inline keyboards\n│   │   ├── middlewares/        # Custom middlewares\n│   │   └── services/           # Business logic services\n│   ├── core/\n│   │   └── config.py          # App configuration\n│   ├── db/\n│   │   └── session.py         # Database session management\n│   ├── models/                # SQLAlchemy models\n│   │   ├── branding.py\n│   │   ├── order.py\n│   │   ├── product.py\n│   │   ├── review.py\n│   │   └── user.py\n│   ├── repositories/          # Data access layer\n│   ├── schemas/               # Pydantic schemas\n│   ├── utils/                 # Utility functions\n│   └── main.py               # Application entry point\n├── migrations/                # Alembic migrations\n├── scripts/                   # Utility scripts\n├── tests/                     # Test files\n└── pyproject.toml            # Poetry configuration\n```\n\n## Quick Start\n\n### Prerequisites\n\n- Python 3.10-3.12\n- PostgreSQL database\n- Telegram Bot Token (from [@BotFather](https://t.me/botfather))\n\n### Installation\n\n1. **Clone the repository**\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd shop-bot\n   ```\n\n2. **Set up environment variables**\n   ```bash\n   cp .env.example .env\n   ```\n\n3. **Configure environment variables in `.env`**\n   ```env\n   BOT_TOKEN=your_telegram_bot_token\n   DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/shop_bot\n   ADMIN_IDS=123456789,987654321  # Optional: Comma-separated admin user IDs\n   ```\n\n4. **Install dependencies**\n\n   **Using Poetry (recommended):**\n   ```bash\n   poetry install\n   poetry shell\n   ```\n\n   **Using pip:**\n   ```bash\n   python -m venv venv\n   source venv/bin/activate  # On Windows: venv\\Scripts\\activate\n   pip install -r \u003c(python - \u003c\u003c'PY'\n   print('\\n'.join([\n       'aiogram==3.6.0',\n       'uvloop==0.19.0',\n       'python-dotenv==1.0.1',\n       'SQLAlchemy==2.0.34',\n       'asyncpg==0.29.0',\n       'alembic==1.13.2',\n       'pydantic==2.7.4',\n       'pydantic-settings==2.3.4',\n       'loguru==0.7.2',\n   ]))\n   PY\n   )\n   ```\n\n5. **Set up database**\n   ```bash\n   # Run migrations\n   alembic upgrade head\n   ```\n\n6. **Start the bot**\n   ```bash\n   python -m app.main\n   ```\n\n## Configuration\n\n### Environment Variables\n\n| Variable | Description | Required | Default |\n|----------|-------------|----------|---------|\n| `BOT_TOKEN` | Telegram Bot API token | Yes | - |\n| `DATABASE_URL` | PostgreSQL connection string | Yes | - |\n| `ADMIN_IDS` | Comma-separated admin user IDs | No | - |\n| `DEBUG` | Enable debug mode | No | `False` |\n\n### Database Configuration\n\nThe bot uses PostgreSQL with async SQLAlchemy. Make sure your database URL follows this format:\n```\npostgresql+asyncpg://username:password@host:port/database_name\n```\n\n## Development\n\n### Running Tests\n```bash\n# Using Poetry\npoetry run pytest\n\n# Using pip\npytest\n```\n\n### Code Formatting\n```bash\n# Using Poetry\npoetry run ruff check .\npoetry run ruff format .\n\n# Using pip\nruff check .\nruff format .\n```\n\n### Database Migrations\n\n**Create a new migration:**\n```bash\nalembic revision --autogenerate -m \"description\"\n```\n\n**Apply migrations:**\n```bash\nalembic upgrade head\n```\n\n**Rollback migration:**\n```bash\nalembic downgrade -1\n```\n\n## Usage\n\n### User Commands\n- `/start` - Start the bot and see the main menu\n- Browse catalog through inline keyboards\n- Add items to cart and place orders\n\n### Admin Commands\n- Product management through bot interface\n- Order management and tracking\n- User broadcasting capabilities\n- Branding customization\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Support\n\nFor support and questions:\n- Create an issue in the repository\n- Contact the maintainers\n\n---\n\n**Note**: Make sure to keep your bot token and database credentials secure. Never commit them to version control.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F991o2o9%2Ftg_bot_shop","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F991o2o9%2Ftg_bot_shop","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F991o2o9%2Ftg_bot_shop/lists"}