This project is a full-stack web application demonstrating advanced web development concepts including secure authentication, dynamic content rendering, persistent storage, responsive design, and UI interactivity. It was built using Node.js, Express.js, EJS, and Bootstrap.
- Users can register and log in using a username and password.
- Passwords are hashed using
bcryptand stored permanently in ausers.jsonfile. - User sessions are managed with
express-session.
// Registration (server.js)
app.post('/register', async (req, res) => {
const hashed = await bcrypt.hash(req.body.password, 10);
users.push({ username: req.body.username, password: hashed });
writeUsers(users); // saves to users.json
});- User data is stored in
data/users.json. - On each login or register request, the server reads and writes this file.
function readUsers() {
const data = fs.readFileSync(usersPath);
return JSON.parse(data);
}- After login, a loading screen is displayed with a dynamic percentage count.
- Enhances user transition experience.
- The app fetches tutorial content from a local JSON file (
tutorials.json) and renders it as Bootstrap cards using JavaScript.
fetch("/data/tutorials.json")
.then(res => res.json())
.then(data => {
// Dynamically generate tutorial cards
});- Built using Bootstrap 5.
- Includes feature highlight cards, modals, hover animations, and dark mode.
- A floating moon icon toggles dark/light themes.
- Saves user preference in
localStorage.
toggle.addEventListener("click", () => {
document.body.classList.toggle("dark-mode");
localStorage.setItem("darkMode", document.body.classList.contains("dark-mode"));
});-
User Visits
/login- Can register or log in.
- Form sends POST request to server.
-
Login Authenticates with JSON
- Server hashes password and compares with stored hash.
- If valid, user is redirected to
/loadingthen/index.
-
Home Page (
/index)- Shows animated hero, feature cards, tutorials section, and toggle for dark mode.
- Feature modals expand with more information.
project/
├── public/
│ ├── script.js
│ └── styles.css
├── views/
│ ├── index.ejs
│ ├── login.ejs
│ ├── register.ejs
│ └── loading.ejs
├── data/
│ ├── users.json
│ └── tutorials.json
├── server.js
└── README.md
npm install
node server.jsThen open http://localhost:3000
SIT774 Web Technologies and Development (Task 10.4HD)
Submitted by: ARNOLD SEBASTIAN