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.
11 changes: 7 additions & 4 deletions backend/app/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
from sqlalchemy.orm import sessionmaker, declarative_base
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")
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./stockvision.db")

# Create engine with appropriate settings for SQLite or PostgreSQL
if DATABASE_URL.startswith("sqlite"):
engine = create_engine(DATABASE_URL, connect_args={"check_same_thread": False}, echo=False)
else:
engine = create_engine(DATABASE_URL, pool_pre_ping=True, echo=False)

engine = create_engine(DATABASE_URL, pool_pre_ping=True, echo=False)
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 are being included a second time. They are already included on lines 41-44. This will create duplicate endpoints for auth, stocks, market, and portfolios—one set at the root and another under the /api prefix. Please remove the initial router inclusions on lines 41-44 to resolve this.


# 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. This unused import should be removed to keep the code clean.

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.

medium

This appears to be temporary debugging code that disables the preloader. Please revert this to the original logic before merging.

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.

medium

The timeout for the preloader has been reduced for testing purposes. Please revert it to the original value of 2500ms.

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";
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This import uses a relative path (./components/chatbot), which is inconsistent with other component imports in this file that use the @/ path alias (e.g., @/components/ui/tooltip on line 5). For consistency and better project structure, it's recommended to place shared components in the top-level components directory and import them using the alias.

Suggested change
import Chatbot from "./components/chatbot";
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