Compare commits

...
7 changed files with 109 additions and 65 deletions

No files matched your search

Vendored
BIN
View File
Binary file not shown.
+50 -30
View File
@@ -1,27 +1,43 @@
# Retirement Calculator
## 2800-202510-BBY14
### 2800-202510-BBY14
## Overview
Retirement Calculator - The goal of the application is to help users manage and track their financial progress in a way that reflects real life. Instead of just acting as a calculator, the app functions as a dynamic tracker. It shows the user a percentage of how much of their goal has been achieved and compares their actual performance to their planned targets.
RCalculator is a dynamic financial tracking application designed to help users manage and monitor their progress towards long-term financial goals, particularly retirement. It moves beyond simple calculations by providing personalized insights, tracking actual performance against planned targets, and offering a clear view of your financial journey towards achieving your desired future.
---
## Features
- Do calculator stuff
- **Personalized Financial Profile:** Users complete a comprehensive questionnaire to build a financial profile, enabling tailored guidance and projections.
- **Comprehensive Asset Management:** Add, track, and manage various types of assets including savings, stocks, real estate, and other investments for a holistic view of net worth.
- **Strategic Goal Planning:** Define long-term financial objectives (e.g., retirement, home purchase, education) and create detailed plans with actionable steps.
- **Clear Financial Projections:** Visualize potential investment growth and assess the feasibility of financial plans through easy-to-understand projections and charts.
- **User-Friendly Dashboard:** An intuitive dashboard provides an at-a-glance overview of financial health, asset allocation, and progress towards goals.
- **Secure User Authentication:** Robust authentication system to protect sensitive financial data, including secure registration and login processes.
- **Dynamic Currency Conversion:** (If applicable) Utilizes geolocation to provide relevant currency information and conversion rates for international users or assets.
---
## Technologies Used
Example:
- **Frontend**: HTML, CSS, JavaScript
- **Backend**: Express.js
- **Database**: MongoDB
- **Frontend:** EJS (Embedded JavaScript templates), Tailwind CSS, Vanilla JavaScript
- **Backend:** Node.js, Express.js
- **Database:** MongoDB
- **Authentication:** express-session for session management, bcrypt for password hashing.
- **Data Validation:** Joi for schema validation.
- **APIs:** Google Gemini API for generating financial advice. **Geolocation API** for currency conversion.
---
## Prerequisites
1. You'll need to setup an instance of MongoDB. You can use the cloud platform, MongoDB Atlas, or create your own instance locally.
i. [Create your MongoDB Altas instance.](https://www.mongodb.com/docs/manual/tutorial/getting-started/)
ii. [Create your local MongoDB server instance.](https://www.mongodb.com/docs/manual/administration/install-community/)
After this, you'll need to get your MongoURI from your database instance, as well as your database name for later configuration in the `.env` file.
## Usage
1. **Clone the repository:**
@@ -47,32 +63,30 @@ Example:
The application should now be running, typically on `http://localhost:3000` (or the port specified in your `.env` file).
---
## Project Structure
```
retirementCalculator/
├── src/
| ├── auth/
| ├── database/
│ ├── public/
│ │ ├── images/
│ │ ├── scripts/
│ │ └── svgs/
| |
│ ├── router/
── utils/
└── views/
│ └── partials/
├── auth/ # Authentication logic (e.g., passport setup, strategies)
├── database/ # MongoDB connection, schemas, models
│ ├── public/ # Static assets
│ │ ├── images/ # Site images and icons
│ │ ├── scripts/ # Client-side JavaScript files
│ │ └── svgs/ # SVG icons
│ ├── router/ # Express route definitions
│ ├── util/ # Utility functions (e.g., calculations, helpers)
── views/ # EJS templates
└── partials/ # Reusable EJS partials (headers, footers, nav)
├── .env.example
├── .gitignore
├── app.js
├── CONTRIBUTING.md
├── LICENSE
├── package-lock.json
├── package.json
└── README.md
├── .env.example # Example environment variables file
├── .gitignore # Specifies intentionally untracked files that Git should ignore
├── app.js # Main application entry point
├── CONTRIBUTING.md # Guidelines for contributing to the project
├── LICENSE # Project license information
├── package-lock.json # Records exact versions of dependencies
├── package.json # Project metadata and dependencies
└── README.md # This file
```
---
@@ -84,16 +98,22 @@ retirementCalculator/
- **[Mitchell Schaeffer](https://github.com/knighthawk4227)** - BCIT CST Student with a passion for technology.
---
## more details to come...
## Limitations and Future Work
### Limitations
- None
- **Generalized Advice:** The application provides financial guidance based on user input and common models; it does not substitute professional financial advisory services.
- **Market Volatility:** Projections are based on assumed rates of return and do not account for all potential market fluctuations or unforeseen economic events.
- **Manual Data Entry:** Asset information and updates currently require manual input.
- **Single User Focus:** Primarily designed for individual financial planning.
### Future Work
- All work
- **Third-Party API Integrations:** Connect with financial institutions (e.g., Plaid) for automated asset tracking and transaction importing.
- **Advanced Reporting:** Implement more detailed financial reports, customizable charts, and data export options (e.g., PDF, CSV).
- **Enhanced Security Features:** Implement Two-Factor Authentication (2FA) and advanced security audits.
- **Educational Resources:** Integrate a section with articles, tips, and resources on financial literacy and planning.
---
+1 -1
View File
@@ -47,7 +47,7 @@ module.exports = (users) => {
$set: { resetToken: token, resetTokenExpires: expiration }
});
const resetUrl = `https://rcalculator.sowinski.dev/${PORT}/reset/${token}`;
const resetUrl = `https://rcalculator.sowinski.dev/reset/${token}`;
const mailSend = {
from: process.env.EMAIL_USER,
+1 -1
View File
@@ -6,7 +6,7 @@ const factSubmitButton = document.getElementById("factSubmitButton");
var path = window.location.pathname;
var page = path.split("/").pop();
if(page !== "login" && page !== "signup" && page !== "forgotPassword" && page !== "") {
if(page !== "login" && page !== "signup" && page !== "forgotPassword" && page !== "aboutUs" && page !== "") {
factButton.classList.remove("hidden");
}
+3 -15
View File
@@ -172,6 +172,8 @@ module.exports = (middleware, users, plans, assets) => {
const progress = await calculateProgress(plan, assets, users, req.session.userId);
const suggestions = await generateSuggestions(totalUserAssetValue, plan);
res.render('planDetail', {
user: req.session.user,
plan: plan,
@@ -179,7 +181,7 @@ module.exports = (middleware, users, plans, assets) => {
totalUserAssetValue: totalUserAssetValue,
assets: userAssets,
progress: progress,
suggestions: await suggestions.generateSuggestions(),
suggestions: suggestions,
});
} catch (err) {
@@ -189,20 +191,6 @@ module.exports = (middleware, users, plans, assets) => {
}
});
// router.get('/newPlan', (req, res) => {
// if (!req.session.user.financialData || !req.session.user) {
// req.session.errMessage = "Please complete your financial data before creating a plan.";
// return res.status(status.Unauthorized).redirect('/questionnaire');
// }
// const errMessage = req.session.errMessage;
// req.session.errMessage = "";
// res.render('newPlan', {
// user: req.session.user,
// errMessage: errMessage,
// geoData: req.session.geoData
// });
// });
router.post('/newPlan', async (req, res) => {
if (!req.session.user.financialData || !req.session.user) {
+6 -2
View File
@@ -10,10 +10,14 @@ async function generateFact(factInput) {
return response.text;
}
async function generateSuggestions() {
async function generateSuggestions(totalUserAssetValue, plan) {
const response = await ai.models.generateContent({
model: "gemini-2.0-flash",
contents: "Return a mock investment suggestion 3-5 lines only",
contents: `Return an investment suggestion 3-5 based on the user's total asset value and their plan. Please do not include any extra text or explanation.
Total User Asset Value: ${totalUserAssetValue}
Plan: ${plan}`,
});
return response.text;
}
+48 -16
View File
@@ -10,27 +10,59 @@
<section class="bg-gray-900 py-12 md:py-20">
<div class="max-w-screen-lg mx-auto px-4 text-center">
<h1 class="mb-4 text-4xl font-extrabold tracking-tight leading-none md:text-5xl lg:text-6xl text-white">About RCalculator</h1>
<p class="mb-12 text-lg font-normal lg:text-xl sm:px-16 text-gray-400">Welcome to RCalculator, your partner in building a secure and fulfilling financial future.</p>
<p class="mb-12 text-lg font-normal lg:text-xl sm:px-16 text-gray-400">Welcome to RCalculator, your partner in navigating the path to a secure and fulfilling financial future. We simplify financial planning, making it accessible and actionable for everyone.</p>
</div>
<div class="max-w-screen-md mx-auto px-4">
<h2 class="mb-4 text-3xl font-bold tracking-tight text-white text-center">Our Mission</h2>
<p class="mb-6 font-normal text-gray-400 text-lg text-center">
Our mission is to empower you with the tools and insights needed to take control of your long-term financial goals.
</p>
<div class="prose lg:prose-lg mx-auto text-gray-400">
<p class="mb-4">
We believe that planning for your desired future, especially retirement, shouldn't be daunting. It doesn't matter what your current age or career status is starting now is what counts.
</p>
<p class="mb-4">
At RCalculator, we help you trace a personalized plan that suits your unique aspirations. We provide clear, actionable advice and projections to guide you on how to get there, whether you're just starting your career, mid-way through, or nearing retirement.
</p>
<p>
Let us help you navigate the path to financial independence and achieve the retirement lifestyle you envision.
</p>
<!-- What RCalculator Offers Section -->
<div class="max-w-screen-md mx-auto px-4 mb-16">
<h2 class="mb-8 text-3xl font-bold tracking-tight text-white text-center">What RCalculator Offers</h2>
<div class="space-y-8 text-gray-400 text-lg">
<div class="p-6 border border-gray-700 rounded-lg bg-gray-800/30 shadow-lg">
<h3 class="font-semibold text-xl text-white mb-2">Personalized Financial Insights</h3>
<p>Start by completing our comprehensive questionnaire. Your answers help us tailor financial guidance and projections specifically to your situation and goals.</p>
</div>
<div class="p-6 border border-gray-700 rounded-lg bg-gray-800/30 shadow-lg">
<h3 class="font-semibold text-xl text-white mb-2">Comprehensive Asset Tracking</h3>
<p>Easily add and monitor various types of assets, from savings accounts and stocks to real estate and other investments. Get a clear overview of your net worth in one place.</p>
</div>
<div class="p-6 border border-gray-700 rounded-lg bg-gray-800/30 shadow-lg">
<h3 class="font-semibold text-xl text-white mb-2">Strategic Goal Planning</h3>
<p>Define your long-term financial objectives, such as retirement, buying a home, or funding education. Create detailed plans and see how you can achieve them.</p>
</div>
<div class="p-6 border border-gray-700 rounded-lg bg-gray-800/30 shadow-lg">
<h3 class="font-semibold text-xl text-white mb-2">Clear Financial Projections</h3>
<p>Understand the potential growth of your investments and the feasibility of your financial plans with our easy-to-understand projections and visual tools.</p>
</div>
</div>
</div>
<!-- Getting Started Section -->
<div class="max-w-screen-md mx-auto px-4 mb-16">
<h2 class="mb-8 text-3xl font-bold tracking-tight text-white text-center">Getting Started with RCalculator</h2>
<ol class="list-decimal list-inside space-y-6 text-gray-400 text-lg">
<li class="p-4 border border-gray-700 rounded-lg bg-gray-800 shadow-md">
<span class="font-semibold text-white">Sign Up & Build Your Profile:</span> Create your account and fill out our initial questionnaire. This provides the foundation for personalized advice.
</li>
<li class="p-4 border border-gray-700 rounded-lg bg-gray-800 shadow-md">
<span class="font-semibold text-white">Log Your Assets:</span> Navigate to the 'Assets' section to add details about your current savings, investments, and other valuable possessions.
</li>
<li class="p-4 border border-gray-700 rounded-lg bg-gray-800 shadow-md">
<span class="font-semibold text-white">Create Financial Plans:</span> Head to the 'Plans' section to outline your financial goals. Set targets, timelines, and see projected outcomes.
</li>
<li class="p-4 border border-gray-700 rounded-lg bg-gray-800 shadow-md">
<span class="font-semibold text-white">Monitor & Adjust:</span> Regularly review your dashboard to track your progress. Adjust your plans and asset information as your circumstances change.
</li>
</ol>
</div>
<!-- Our Commitment Section -->
<div class="max-w-screen-md mx-auto px-4">
<h2 class="mb-6 text-3xl font-bold tracking-tight text-white text-center">Our Commitment</h2>
<p class="text-gray-400 text-lg text-center">
Our mission is to empower you with clarity and confidence in your financial decisions. We believe that with the right tools and guidance, anyone can achieve their financial aspirations. Let RCalculator be your guide to financial independence.
</p>
</div>
<% if (!geoData) { %>
<div class="flex flex-col space-y-4 sm:flex-row sm:justify-center sm:space-y-0">
<a href="/signup" class="inline-flex justify-center items-center mt-4 py-3 px-5 text-base font-medium text-center text-white rounded-lg bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-900">