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