https://github.com/y1j2x34/springboot-ktorm-boilerplate
https://github.com/y1j2x34/springboot-ktorm-boilerplate
boilerplate captcha kotlin ktorm spring-boot spring-security spring-security-jwt
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/y1j2x34/springboot-ktorm-boilerplate
- Owner: y1j2x34
- Created: 2023-04-09T16:10:52.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2026-04-07T07:20:25.000Z (2 months ago)
- Last Synced: 2026-04-07T09:21:55.106Z (2 months ago)
- Topics: boilerplate, captcha, kotlin, ktorm, spring-boot, spring-security, spring-security-jwt
- Language: Kotlin
- Homepage:
- Size: 2.8 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spring Boot Ktorm Boilerplate
Enterprise-ready Spring Boot application with Ktorm ORM, featuring complete Docker configurations for both development and production environments.
## π Documentation
### Quick Links
| Language | Development | Production |
|----------|-------------|------------|
| **English** | [Quick Start](docs/en/DOCKER-QUICKSTART.md) | [Production Guide](docs/en/README.md) |
| **δΈζ** | [εΏ«ιεΌε§](docs/zh-CN/DOCKER-QUICKSTART.md) | [ηδΊ§ι¨η½²](docs/zh-CN/README-PRODUCTION.md) |
### Complete Documentation
- **English**: [docs/en/](docs/en/)
- **δΈζ**: [docs/zh-CN/](docs/zh-CN/)
## π Quick Start
### Development Environment
```bash
# Start all services
./start-all.sh
# Access:
# - API: http://localhost:8081/api
```
### Production Environment
```bash
# 1. Configure environment
cp env.prod.example .env.prod
vim .env.prod
# 2. Deploy
./deploy-prod.sh --with-monitoring
```
## π¦ Features
### Development
- β
One-command startup
- β
Hot reload support
- β
Easy debugging
- β
Docker-based development
### Production
- β
Security hardening (non-root user, network isolation)
- β
Resource management (CPU/memory limits)
- β
Complete monitoring (Prometheus + Grafana + Loki)
- β
Automated deployment scripts
- β
Health checks and auto-restart
- β
Log management and rotation
## ποΈ Project Structure
```
.
βββ docs/
β βββ en/ # English documentation
β βββ zh-CN/ # Chinese documentation
βββ docker/
β βββ configs/ # Database configurations
β βββ mariadb/
βββ app/ # Main application
βββ common/ # Common modules
βββ captcha/ # Captcha module
βββ jwt-auth/ # JWT authentication
βββ user/ # User module
βββ monitoring/ # Monitoring configurations
βββ docker-compose.yml # Development environment
βββ docker-compose.prod.yml # Production environment
βββ docker-compose.monitoring.yml # Monitoring stack
βββ deploy-prod.sh # Deployment script
```
## π οΈ Tech Stack
- **Backend**: Spring Boot 2.7.1, Kotlin 1.8.20
- **ORM**: Ktorm 3.6.0
- **Database**: MariaDB 11.2
- **Auth**: JWT
- **Captcha**: Anji-Plus Captcha
- **Containerization**: Docker, Docker Compose
- **Monitoring**: Prometheus, Grafana, Loki
## π Services
### Development Environment
| Service | Port | Description |
|---------|------|-------------|
| Spring Boot | 8081 | Main API |
| MariaDB | 3306 | Database |
### Production Environment (Additional)
| Service | Port | Description |
|---------|------|-------------|
| Grafana | 3000 | Monitoring dashboards |
| Prometheus | 9090 | Metrics collection |
| Loki | 3100 | Log aggregation |
## π Security Features (Production)
- Non-root user execution
- Network isolation (internal/external networks)
- Environment variable management for secrets
- Security options (no-new-privileges)
- SSL/TLS support
- Regular security updates
## π Monitoring (Production)
- Real-time metrics (CPU, Memory, Requests)
- Application performance monitoring
- Log aggregation and search
- Pre-configured alerts (20+ rules)
- Grafana dashboards
- Health checks
## πΎ Backup & Recovery (Production)
- Automated database backups
- Volume backup scripts
- Point-in-time recovery
- Backup retention policies
- Disaster recovery procedures
## π― Use Cases
### Development
```bash
./start-all.sh # Start
./logs.sh all # View logs
./stop-all.sh # Stop
make help # View all commands
```
### Production
```bash
./deploy-prod.sh # Deploy
./deploy-prod.sh --with-monitoring # Deploy with monitoring
./stop-prod.sh # Stop
./stop-prod.sh --volumes # Stop and remove data
```
## π Documentation Index
### Getting Started
- [Development Quick Start (EN)](docs/en/DOCKER-QUICKSTART.md) | [εΌεεΏ«ιεΌε§ (CN)](docs/zh-CN/DOCKER-QUICKSTART.md)
- [Production Quick Start (EN)](docs/en/README.md) | [ηδΊ§εΏ«ιεΌε§ (CN)](docs/zh-CN/README-PRODUCTION.md)
### Complete Guides
- [Production Deployment Guide (EN)](docs/en/PRODUCTION.md) | [ηδΊ§ι¨η½²ζε (CN)](docs/zh-CN/PRODUCTION.md)
- [Production Checklist (EN)](docs/en/PRODUCTION-CHECKLIST.md) | [ηδΊ§ζ£ζ₯ζΈ
ε (CN)](docs/zh-CN/PRODUCTION-CHECKLIST.md)
### Reference
- [Development vs Production (EN)](docs/en/DEV-VS-PROD.md) | [εΌεvsηδΊ§ (CN)](docs/zh-CN/DEV-VS-PROD.md)
- [Documentation Index (EN)](docs/en/INDEX.md) | [ζζ‘£η΄’εΌ (CN)](docs/zh-CN/INDEX.md)
## π Troubleshooting
### Service won't start
```bash
# Development
./logs.sh all
# Production
docker compose -f docker-compose.prod.yml logs
```
### Port conflicts
Edit port mappings in `docker-compose.yml` or `docker-compose.prod.yml`
### Database connection issues
```bash
# Check database status
docker compose ps
docker exec mariadb-db mysql -uroot -p -e "SELECT 1"
```
## π€ Contributing
Contributions are welcome! Please read our contributing guidelines before submitting pull requests.
## π License
[Your License]
## π Support
- Documentation: [docs/](docs/)
- Issues: [GitHub Issues](your-repo-issues)
- Email: your-email@example.com
---
**β οΈ Important Notes:**
- For production deployment, read the complete [Production Guide](docs/en/PRODUCTION.md)
- Always use strong passwords in production
- Enable monitoring for production environments
- Backup data regularly
- Test thoroughly before production deployment