Building a 3-tier web application from scratch with complete backend and frontend
-
Architchture :
USER │ ▼ React Ui │ ▼ Spring Boot REST API │ ▼ Hibernate / JPA │ ▼ MariaDB (AWS RDS) -
Full Infrastructure Architecture :
USER │ ▼ Web Browser │ │ HTTP ▼ Public EC2 IP (51.xx.xx.xx) │ ┌────────────┴────────────┐ │ │ ▼ ▼ React Frontend Spring Boot API (Attendance Dashboard) Port 8080 Student UI Teacher UI │ │ REST API ▼ Spring Controllers │ ▼ Service Layer │ ▼ JPA Repository │ ▼ Hibernate ORM │ ▼ MariaDB (AWS RDS) │ ▼ Attendance Tables Student Tables -
Backend Internel Architecture :
backend/ | |-controller/ StudentController AttendanceController ClassStatsController | |-model/ Student.java Attendance.java | |-repository/ StudentRepository AttendanceRepository | └──resources/ application.properties -
Frontend Internal Architecture :
frontend/ │ ├── src/ │ main.jsx │ index.css │ ├── components (future) │ StudentTable │ Dashboard │ Login │ └── build/ dist/ -
Security Layer (current) : NOTE : This feature and more other features are in production and will update soon
Update :This feature is now added to see the latest version click : https://github.com/ejazshaikh-devops/Student-Attendance-v2
Teacher access → full control
Student access → read only
-
Deployment Architecture :
AWS Cloud │ ├── EC2 │ ├── React Frontend │ └── Spring Boot Backend │ └── RDS └── MariaDB Database -
Process Of Creation :
Overview :
Project: Batch 5 Attendance System
Architecture: 3-Tier Web Application
Frontend: React (UI)
Backend: Spring Boot (Java REST API)
Database: AWS RDS MariaDB
Infrastructure: AWS EC2 (Ubuntu)
-
Necessary Process :
- Database Creation :
mysql -h RDS-ENDPOINT -u admin -p
CREATE DATABASE attendance;
spring.jpa.hibernate.ddl-auto=update
student attendance-
Backend Structure :
AttendanceApp/backend
Created Maven project structure:backend ├ pom.xml └ src └ main ├ java │ └ com │ └ attendance │ └ app │ ├ controller │ ├ model │ ├ repository │ └ service └ resources └ application.properties
pom.xml : Backend build file defines project dependencies contaions : spring boot, JPA, MariaDB Driver it will used by mvn clean packege. Which will give the output of : target/attendance-backend.jar
- Frontend Structure :
AttendanceApp/frontendfrontend └ attendance-frontend ├ src │ ├ main.jsx │ └ index.css ├ package.json └ vite.config.js
main.jsx (UI LOGIC)
Responsibilities:
- React app entry
- API calls
- UI rendering
Main Logic:
fetch(API/students)
POST(API/students)
DELETE(API/students/{id})
Implemented Features :
add student
delete student
attendance toggle
weekly attendance
percentage calculation
performance score
Ui Features :
Teacher Panel : Name, Batch, Course.
Students Control : Add Student, Remove Student.
Attendance Table : Weekes.
Analytics : Attendence %, Performance Score.
-
After Deployment :
UI action ↓ React API call ↓ Spring Controller ↓ Repository ↓ Hibernate ORM ↓ MariaDB database
Example: Mark attendance
UI → POST /attendance
Controller → save()
Repository → SQL insert
Database → attendance table
-
Debugging :
-
Port 8080 already in use
Problem : Previous Java process still running in background
Debugg : lsof -i :8080
ps aux | grep java found the process then
kill -9 'process id' -
RDS “Access Denied” Error
Problem : Access denied for user 'admin'
Debugg : Verified application.properties correct credentials + open port 3306 in RDS SG -
Java Error
Problem : the JDK version 17 requiered version 20
Debugg : dpkg --list | grep openjdk found openjdk-17-jdk than apt remove openjdk-17-jdk -y than apt autoremove -y to remove leftover dependencies than installed JDK version 20 -
Node version Incompatibility Problem : vite error : crypto.hash is not a function
Debugg : Node 18 installed vite required Node 20+ so installed new version -
Foreign Key Constraint on Delete Problem : Deleting student caused 500 error attendance table had FK reference to student fail to delete any student
Debugg : @OneToMany(mappedBy="student",
cascade=CascadeType.ALL,
orphanRemoval=true)
Relational integrity + cascading deletes -
Hibernate Dialect Not Determine
Problem : Unable to determine dialect DB connection failed so hibernate couldn’t detect DB type
Debugg : Issue in DB password corrected the password -
Whitelabel Error Page (404)
Problem : Accessed root / on backend no controller mapped to /
Debugg : Tested proper endpoint /student -
Backend Stops After SSH Close
Problem : Closing terminal stopped backend process tied to SSH session
Debugg : Run the process in background
nohup java -jar app.jar > app.log 2>&1 & -
CORS Issues
Problem : Frontend couldn’t call backend
Debugg : @CrossOrigin -
Build Failure (Compilation Error)
Problem : cannot find symbol reached end of file while parsing becoz of missing braces / duplicate methods
Debugg : Repaired class structure -
Maven Dependency Issues
Problem : Build failure due to missing dependencies
Debugg : Ensured pom.xml correct
mvn clean package -
Database SSL Warning
Problem : useSsl deprecated outdated connection parameters
Debugg : Updated connection string to newer format -
React build errors
Problem : missing package.json
Debugg : recreated Vite project
-
-
Future Use : If expanded further this project becomes:
1. Role based login
2. Student portal
3. File upload
4. Graph analytics
5. JWT authentication