Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .gitignore
Binary file not shown.
5 changes: 3 additions & 2 deletions backend/app/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import os

DATABASE_URL = os.getenv("DATABASE_URL")

if not DATABASE_URL:
raise RuntimeError("DATABASE_URL is required and must point to a PostgreSQL database, e.g. postgresql://user:password@localhost:5432/stockvision")
raise ValueError("DATABASE_URL environment variable is required")

engine = create_engine(DATABASE_URL, pool_pre_ping=True, echo=False)
engine = create_engine(DATABASE_URL, pool_pre_ping=True)
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
Base = declarative_base()

Expand Down
2 changes: 2 additions & 0 deletions backend/env.example
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ REDIS_URL=redis://localhost:6379/0
# External APIs
ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key
YAHOO_FINANCE_API_KEY=your_yahoo_finance_api_key
POLYGON_API_KEY=your_polygon_api_key
FINNHUB_API_KEY=your_finnhub_api_key

# Security
SECRET_KEY=your_secret_key_here
Expand Down
9 changes: 8 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from dotenv import load_dotenv

# Import routers
from app.routers import stocks, market, portfolios, auth
from app.routers import stocks, market, portfolios, auth, chatbot

# Import database
from app.db import engine, Base
Expand Down Expand Up @@ -43,6 +43,13 @@
app.include_router(portfolios.router)
app.include_router(auth.router) # Auth routes added

# Include routers
app.include_router(auth.router, prefix="/api", tags=["Authentication"])
app.include_router(stocks.router, prefix="/api", tags=["Stocks"])
app.include_router(market.router, prefix="/api", tags=["Market"])
app.include_router(portfolios.router, prefix="/api", tags=["Portfolios"])
app.include_router(chatbot.router, prefix="/api", tags=["Chatbot"])
Comment on lines +47 to +51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

These routers (auth, stocks, market, portfolios) are already included on lines 41-44 without a prefix. Including them again here with the /api prefix creates duplicate API endpoints. To fix this, you should remove the redundant app.include_router calls on lines 41-44.


# Create all DB tables
Base.metadata.create_all(bind=engine)

Expand Down
3 changes: 2 additions & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ pandas>=2.1.0
numpy>=1.25.0
yfinance>=0.2.0
requests>=2.31.0
aiofiles>=23.2.0
aiofiles>=23.2.0
aiohttp>=3.8.0
7 changes: 5 additions & 2 deletions frontend/app/HomeClient.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
"use client";
import { useEffect, useState } from "react";
import Landing from "@/components/Landing";
import SimpleLanding from "@/components/SimpleLanding";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The SimpleLanding component is imported but is not used within this file. It should be removed to keep the code clean and avoid potential confusion.

import Preloader from "@/components/Preloder";

let hasShownPreloader = false;
export default function HomeClient() {
const [isLoading, setIsLoading] = useState(!hasShownPreloader);
// Temporarily disable preloader for debugging
const [isLoading, setIsLoading] = useState(false);
Comment on lines +9 to +10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change disables the preloader, likely for debugging purposes. This should be reverted to the original logic to ensure the preloader is shown to new visitors as intended.

Suggested change
// Temporarily disable preloader for debugging
const [isLoading, setIsLoading] = useState(false);
const [isLoading, setIsLoading] = useState(!hasShownPreloader);


useEffect(() => {
if (!hasShownPreloader) {
const timer = setTimeout(() => {
setIsLoading(false);
hasShownPreloader = true;
}, 2500);
}, 500); // Reduced to 0.5 seconds for testing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The preloader timeout has been significantly reduced for testing. This should be reverted to its original value of 2500 to ensure the intended user experience.

Suggested change
}, 500); // Reduced to 0.5 seconds for testing
}, 2500);


return () => clearTimeout(timer);
}
}, []);

// Use original Landing component
return isLoading ? <Preloader /> : <Landing />;
}
2 changes: 2 additions & 0 deletions frontend/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ThemeProvider } from "@/components/theme-provider";
import { Toaster as Sonner } from "@/components/ui/sonner";
import { Toaster } from "@/components/ui/toaster";
import { TooltipProvider } from "@/components/ui/tooltip";
import Chatbot from "./components/chatbot";
import "@/styles/globals.css";
import { Analytics } from '@vercel/analytics/react';
import { Inter } from "next/font/google";
Expand Down Expand Up @@ -50,6 +51,7 @@ export default function RootLayout({
<ThemeProvider defaultTheme="system" attribute="class">
<TooltipProvider>
{children}
<Chatbot />
<Toaster />
<Sonner />
</TooltipProvider>
Expand Down