This article details the architecture of "Mirror Career," a micro-web application designed for ultra-fast performance and strong user privacy. It highlights the use of vanilla JavaScript, client-side data processing, and lightweight UI techniques to achieve high Lighthouse scores and zero maintenance debt, showcasing a minimalist approach to system design.
Read original on Dev.to #architectureThe "Mirror Career" project was conceived to address common pain points in modern web applications: complex sign-ups, excessive personal data collection, and slow loading times. Its core tenets are simplicity (KISS principle), user privacy, and sub-second browser-side computation. This architectural philosophy prioritizes a seamless user experience by minimizing overhead and maximizing client-side efficiency.
A key architectural decision was to build the application using only pure web standards (Vanilla HTML5, CSS3, ES6+ JavaScript), eschewing heavy third-party frameworks like React or Vue. This choice drastically reduces the bundle size (avoiding 50MB+ framework files) and eliminates framework-specific dependencies, contributing to exceptional performance and maintainability.
Client-Side Processing for Privacy
All user response data is processed 100% on the client's web browser memory. This means no user data is ever transmitted to a server, inherently mitigating personal information leakage risks and ensuring zero network latency for computations. This is a powerful privacy-by-design architectural choice.
function calculateNormalizedScores(userAnswers, weightMatrix) {
const dimensions = { dimensionA: 0, dimensionB: 0, dimensionC: 0, dimensionD: 0, dimensionE: 0 };
userAnswers.forEach((answerValue, index) => {
const weights = weightMatrix[index];
if (weights) {
Object.keys(weights).forEach(dimKey => {
dimensions[dimKey] += answerValue * weights[dimKey];
});
}
});
const normalizedResults = {};
Object.keys(dimensions).forEach(key => {
const rawVal = dimensions[key];
normalizedResults[key] = Math.min(100, Math.max(0, Math.round(rawVal)));
});
return normalizedResults;
}The provided JavaScript algorithm demonstrates the core logic for multidimensional scoring and normalization, executed entirely within the browser. This approach not only ensures data privacy but also delivers instant feedback to the user without any server-side processing delays. The algorithm calculates various psychological and behavioral scores based on user inputs and a predefined weight matrix.