A powerful Telegram bot for managing forms and data collection with Google Sheets integration
- 📝 Form Management: Create and manage forms through Telegram interface
- 📊 Google Sheets Integration: Seamlessly sync form responses to Google Sheets
- 🔐 Admin System: Super admin functionality for advanced management
- 💾 Local Database: H2 database for fast local data storage
- 🏗️ Clean Architecture: Well-structured codebase following SOLID principles
- 🔄 Real-time Updates: Instant form submission processing
This project follows Clean Architecture principles with clear separation of concerns:
src/main/kotlin/
├── data/ # Data layer - Database entities and repositories
├── domain/ # Business logic layer
│ ├── model/ # Domain models
│ ├── repository/ # Repository interfaces
│ ├── service/ # Business services
│ └── usecase/ # Use cases
├── infrastructure/ # External services
│ ├── di/ # Dependency injection modules
│ └── sheets/ # Google Sheets integration
└── presentation/ # UI layer
├── bot/ # Telegram bot handlers
├── controller/ # Controllers
├── model/ # Presentation models
├── util/ # Utilities
├── markdown/ # Markdown formatting
└── constants/ # Constants
- Presentation Layer: Handles Telegram bot interactions and user interface
- Domain Layer: Contains business logic, use cases, and domain models
- Data Layer: Manages data persistence and repository implementations
- Infrastructure Layer: Integrates external services (Google Sheets, DI)
- Language: Kotlin 2.2.0
- JVM: Java 24
- Build Tool: Gradle with Kotlin DSL
- Telegram Bot:
eu.vendeli.telegram-botv8.2.0 - Dependency Injection: Koin v4.0.3
- Database ORM: Jetbrains Exposed v0.61.0
- Database: H2 Database v2.2.224
- Google Sheets API: v4-rev20220927-2.0.0
- Authentication: Google Auth Library v1.19.0
- Kotlin Symbol Processing: KSP v2.2.0-2.0.2
- Build Config: GMazzo BuildConfig v5.3.5
- Java 24 or higher
- Kotlin 2.2.0 or higher
- Telegram Bot Token (from @BotFather)
- Google Sheets API Credentials
-
Clone the repository
git clone <repository-url> cd Formee
-
Configure environment variables Create
local.propertiesfile:TELEGRAM_BOT_TOKEN=your_telegram_bot_token_here -
Setup Google Sheets credentials
- Place your Google Service Account JSON file as
formee-468309-0becfcc54e77.json - Ensure the service account has access to your Google Sheets
- Place your Google Service Account JSON file as
-
Configure super admins
- Edit
super_admins.csvwith authorized admin user IDs
- Edit
-
Build the project
./gradlew build
-
Run the application
./gradlew run
TELEGRAM_BOT_TOKEN: Your Telegram bot token from BotFather
formee-468309-0becfcc54e77.json: Google Service Account credentialssuper_admins.csv: List of super admin user IDslocal.properties: Local configuration file (not committed to git)
The application uses H2 Database for local data storage:
- Database Files:
formee_db.mv.db,formee_db.lock.db - ORM: Jetbrains Exposed for type-safe SQL
- Features: ACID transactions, JSON support, Java Time API integration
The bot integrates with Google Sheets for data export and synchronization:
- Service Account Authentication: Uses JSON credentials file
- Real-time Sync: Form responses automatically saved to sheets
- API Version: Google Sheets API v4
- Interactive form filling
- Real-time validation
- Progress tracking
- Result confirmation
- Form creation and management
- Response monitoring
- Data export to Google Sheets
- User management
Formee/
├── .gradle/ # Gradle cache
├── .idea/ # IntelliJ IDEA settings
├── .kotlin/ # Kotlin compilation cache
├── build/ # Build outputs
├── gradle/ # Gradle wrapper
├── src/ # Source code
│ ├── main/kotlin/ # Main application code
│ └── test/ # Test code
├── build.gradle.kts # Build configuration
├── settings.gradle.kts # Gradle settings
└── README.md # This file
# Clean build
./gradlew clean build
# Run tests
./gradlew test
# Generate build config
./gradlew generateBuildConfigRun the test suite:
./gradlew testThe project uses JUnit Platform for testing with Kotlin test integration.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow Kotlin coding conventions
- Use meaningful variable and function names
- Add KDoc comments for public APIs
- Maintain clean architecture principles
- API Keys: Never commit API keys or tokens to version control
- Service Accounts: Secure your Google Service Account JSON file
- Admin Access: Carefully manage super admin permissions
- Data Privacy: Ensure compliance with data protection regulations
This project is licensed under the MIT License - see the LICENSE file for details.
- Issues: Report bugs and feature requests via GitHub Issues
- Documentation: Check the
REFACTORING_SUMMARY.mdfor recent changes - Community: Join our community discussions
- Web dashboard for form management
- Advanced form field types
- Multi-language support
- Analytics and reporting
- Integration with more external services
Made with ❤️ using Kotlin and Clean Architecture