RESTful API backend for the Attendance IO application. Built with Spring Boot and Kotlin, providing authentication, attendance tracking, analytics, and student management features.
- OAuth2 Integration - Google OAuth2 authentication
- Session Management - Secure session handling with Spring Session
- Mobile Auth Support - Special authentication endpoints for mobile apps
- JWT-like Sessions - Long-lived sessions (30 days) with secure cookies
- Mark Attendance - Record present, absent, or cancelled classes
- Attendance History - Retrieve attendance records by date and subject
- Subject Statistics - Calculate attendance percentages per subject
- Institute Attendance Sync - Support for syncing with official institute records
- Attendance Calculation - Smart calculation considering institute attendance and manual entries
- Overall Analytics - Aggregate statistics across all semesters
- Semester Analytics - Detailed analytics per semester
- Distribution Charts - Attendance distribution across student population
- Range Analysis - Breakdown by attendance percentage ranges
- Caching - Optimized performance with Spring Cache
- Database Views - Pre-calculated views for fast queries
- Student Search - Search students by name or roll number
- Attendance Lookup - View any student's attendance history
- Cross-semester Support - Search across all semesters
- Subject Management - CRUD operations for subjects
- Timetable Management - Create and manage student timetables
- Schedule Management - Handle subject schedules and time slots
- Semester Management - Manage academic semesters
- Submit Feedback - Students can submit bugs, feedback, or suggestions
- Feedback Types - Categorize feedback (BUG, FEEDBACK, SUGGESTION)
- Feedback Storage - Persistent storage in database
- FCM Integration - Firebase Cloud Messaging for push notifications
- Sleep Reminders - Smart sleep reminder notifications based on first lecture
- Priority Alerts - Critical lecture notifications
- Environment-based Config - Separate configs for dev and production
- Database Auto-migration - Automatic schema updates (DDL auto-update)
- Timezone Support - IST (Asia/Kolkata) timezone configuration
- Health Checks - Actuator endpoints for monitoring
- Spring Boot 4.0.0 - Application framework
- Kotlin 2.2.21 - Programming language
- PostgreSQL - Relational database
- Spring Data JPA - Database abstraction layer
- Spring Security - Authentication and authorization
- Spring OAuth2 Client - OAuth2 integration
- Spring Session JDBC - Session management
- Spring Cache - Caching framework
- Hibernate - ORM framework
- Firebase Admin SDK - Push notifications
- Spring Actuator - Application monitoring
- Java 17+ (JDK)
- PostgreSQL 14+
- Gradle 8.14+ (or use Gradle wrapper)
- Firebase Service Account JSON file (for push notifications)
git clone <repository-url>
cd attendance-io-backendCreate a PostgreSQL database:
CREATE DATABASE attendance_io;Create an application.yaml file or set environment variables:
Required Environment Variables:
SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/attendance_io
SPRING_DATASOURCE_USERNAME=postgres
SPRING_DATASOURCE_PASSWORD=your_password
SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_CLIENT_ID=your_google_client_id
SPRING_SECURITY_OAUTH2_CLIENT_REGISTRATION_GOOGLE_CLIENT_SECRET=your_google_client_secret
FRONTEND_URL=http://localhost:8080
FIREBASE_SERVICE_ACCOUNT_PATH=path/to/firebase-service-account.json- Download Firebase service account JSON file
- Place it in the project root or configure the path in
application.yaml - Set
FIREBASE_SERVICE_ACCOUNT_PATHenvironment variable
Using Gradle:
./gradlew bootRunUsing JAR:
./gradlew bootJar
java -jar build/libs/attendance-io-backend-0.0.1-SNAPSHOT.jarUsing Docker:
docker build -t attendance-io-backend .
docker run -p 8080:8080 \
-e SPRING_DATASOURCE_URL=... \
-e SPRING_DATASOURCE_USERNAME=... \
-e SPRING_DATASOURCE_PASSWORD=... \
attendance-io-backendattendance-io-backend/
βββ src/
β βββ main/
β βββ kotlin/com/attendanceio/api/
β β βββ application/ # Business logic (App Actions)
β β β βββ analytics/
β β β βββ attendance/
β β β βββ search/
β β β βββ student/
β β β βββ subject/
β β β βββ timetable/
β β βββ config/ # Configuration classes
β β β βββ SecurityConfig.kt
β β β βββ CorsConfig.kt
β β β βββ CacheConfig.kt
β β β βββ AuthDebugFilter.kt
β β βββ controller/ # REST controllers
β β β βββ analytics/
β β β βββ attendance/
β β β βββ authentication/
β β β βββ feedback/
β β β βββ search/
β β β βββ semester/
β β β βββ student/
β β β βββ subject/
β β β βββ timetable/
β β βββ model/ # Data models
β β β βββ analytics/
β β β βββ attendance/
β β β βββ feedback/
β β β βββ schedule/
β β β βββ search/
β β β βββ semester/
β β β βββ student/
β β β βββ subject/
β β β βββ timetable/
β β βββ repository/ # Data access layer
β β β βββ analytics/
β β β βββ attendance/
β β β βββ feedback/
β β β βββ schedule/
β β β βββ semester/
β β β βββ student/
β β β βββ subject/
β β β βββ timetable/
β β βββ service/ # Services
β β βββ SleepReminderService.kt
β β βββ FcmNotificationService.kt
β β βββ ClassCalculationService.kt
β β βββ ...
β βββ resources/
β βββ application.yaml # Development config
β βββ application-prod.yaml # Production config
βββ scripts/ # SQL scripts
βββ Dockerfile # Docker configuration
βββ build.gradle.kts # Gradle build file
βββ run.sh # Docker run script
- OAuth2 Authentication - Google OAuth2 for user authentication
- Session-based Auth - Secure HTTP-only cookies
- CORS Configuration - Configured for frontend domain
- CSRF Protection - Enabled for web requests
- Secure Cookies - HTTP-only, secure, same-site cookies in production
The database schema is automatically managed by Hibernate with ddl-auto: update. Key tables include:
students- Student informationsubjects- Subject detailssemesters- Semester informationattendance- Attendance recordsinstitute_attendance- Official institute attendancestudent_subject- Student-subject relationshipsstudent_timetable- Student timetablessubject_schedule- Subject schedulesfeedback- Feedback submissionsspring_session- Session storage
student_attendance_analytics- Pre-calculated analytics view for performance
-
Build Docker Image:
docker build -t attendance-io-backend . -
Run Container:
docker run -d \ -p 8080:8080 \ -e SPRING_PROFILES_ACTIVE=prod \ -e SPRING_DATASOURCE_URL=... \ -e SPRING_DATASOURCE_USERNAME=... \ -e SPRING_DATASOURCE_PASSWORD=... \ attendance-io-backend
-
Using Docker Compose (create
docker-compose.yml):version: '3.8' services: backend: build: . ports: - "8080:8080" environment: - SPRING_PROFILES_ACTIVE=prod - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/attendance_io - SPRING_DATASOURCE_USERNAME=postgres - SPRING_DATASOURCE_PASSWORD=password db: image: postgres:14 environment: - POSTGRES_DB=attendance_io - POSTGRES_USER=postgres - POSTGRES_PASSWORD=password
Set SPRING_PROFILES_ACTIVE=prod to use production configuration:
- Secure cookies enabled
- HTTPS required
- Production logging levels
- Database connection pooling
- Spring Cache - Caching for analytics endpoints
- Database Views - Pre-calculated views for complex queries
- Batch Processing - Efficient batch operations
- Connection Pooling - Optimized database connections
- Indexes - Database indexes on frequently queried columns
This project is private and proprietary.
For issues, questions, or feedback, please contact the development team.
Made with β€οΈ for Attendance IO
Author: Param Savjani