A comprehensive fullstack web application that allows users to search for stock data, analyze detailed financial statements, manage personal stock portfolios, and leave insights via comments.
This project demonstrates a robust, scalable backend using the Controller -> Service -> Repository design pattern, paired with a fast, responsive frontend.
- Secure Authentication: User registration and login powered by ASP.NET Core Identity and JWT Authentication.
- In-Depth Financial Data: Integration with the Financial Modeling Prep API to display:
- Company Profiles
- Income Statements
- Balance Sheets
- Cashflow Statements
- Portfolio Management: Authenticated users can easily add or remove specific stocks from their personal tracking portfolio.
- Community Comments: Users can leave and read comments on individual stock pages.
- React (Vite)
- TypeScript
- Tailwind CSS
- ASP.NET Core Web API (.NET 8)
- Entity Framework Core 8
- MS Identity & JWT
- Newtonsoft.Json
- Microsoft SQL Server
- Financial Modeling Prep (FMP) API
The application is split into two main directories. The backend utilizes a strict Controller -> Service -> Repository pattern to ensure a clean separation of concerns, making the codebase highly maintainable and testable.
Click to expand the Folder Structure
π¦ FinShark
β£ π Api # .NET 8 Web API Backend
β β£ π Controllers # API Endpoints (Routing & HTTP handling)
β β£ π Data # EF Core DbContext
β β£ π DTOs # Data Transfer Objects
β β£ π Extensions # Extensions for getting ClaimPrincipal
β β£ π Helpers # Helper classes for Query objects
β β£ π Interfaces # Contracts for Services and Repositories
β β£ π Mappers # Manual Mapper
β β£ π Models # Domain Entities
β β£ π Repositories # Direct Database Access Logic
β β π Services # Core Business Logic
β
β π frontend # React Vite Frontend
β£ π src
β β£ π api # Axios/Fetch calls to backend and external APIs
β β£ π components # Reusable UI components
β β£ π Context # Custom hooks for Registration and Login functions
β β£ π Helpers # Number formatter and error handling
β β£ π models # TypeScript interfaces/types
β β£ π pages # Main routing views
β β£ π Routes # Routers and Protected Routes
β β π Services # Business logic and fetching data from API
Prerequisites :
.NET 8 SDK
Node.js
SQL Server (Local or hosted)
Financial Modeling Prep API Key
- Navigate to the backend directory:
cd Api
- Update the appsettings.json file with your SQL Server connection string and API keys:
{
"ConnectionStrings": {
"DefaultConnection": "Server=YOUR_SERVER;Database=FinanceAppDb;Trusted_Connection=True;TrustServerCertificate=True"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"JWT": {
"Issuer": "https://localhost:5001",
"Audience": "https://localhost:5001",
"SecretKey": "YOUR_SUPER_SECRET_KEY_HERE"
},
"FMPKey": "YOUR_FMP_API_KEY_HERE"
}
- Apply Entity Framework migrations to build the database:
dotnet ef database update- Run the API:
dotnet run- Open a new terminal and navigate to the frontend directory:
cd frontend- Install the necessary dependencies:
npm install- Start the Vite development server:
npm run devThe application uses Entity Framework Core 8 to manage the database schema. Below are the core entities and how they relate to one another:
Core Entities AppUser: Inherits from ASP.NET Core IdentityUser to handle robust authentication, authorization, and user data.
Stock: Represents a financial asset tracking properties like Symbol, CompanyName, Purchase price, MarketCap, and Industry.
Comment: User-generated commentary attached to specific stocks, tracking Title, Content, and CreatedAt timestamps.
Portfolio: A join entity that explicitly manages the many-to-many relationship between Users and the Stocks they are tracking.
Relationships :
User
User β‘οΈ Comment (One-to-Many): An AppUser can author multiple Comments.
Stock β‘οΈ Comment (One-to-Many): A Stock can have multiple Comments associated with it.
erDiagram
AppUser ||--o{ Portfolio : tracks
AppUser ||--o{ Comment : writes
Stock ||--o{ Portfolio : included_in
Stock ||--o{ Comment : has
AppUser {
string Id PK
string UserName
string Email
}
Stock {
int Id PK
string Symbol
string CompanyName
decimal Purchase
decimal LastDiv
string Industry
decimal MarketCap
}
Portfolio {
string AppUserId FK
int StockId FK
}
Comment {
int Id PK
string Title
string Content
DateTime CreatedAt
int StockId FK
string AppUserId FK
}
This application exposes a RESTful API built with ASP.NET Core. Below are the primary endpoints available:
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
POST |
/api/account/register |
Registers a new user and returns a JWT | No |
POST |
/api/account/login |
Authenticates a user and returns a JWT | No |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/portfolio |
Gets the current user's tracked stocks | Yes |
POST |
/api/portfolio?symbol={symbol} |
Adds a stock to the user's portfolio | Yes |
DELETE |
/api/portfolio?symbol={symbol} |
Removes a stock from the portfolio | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/comment?symbol={symbol} |
Retrieves all comments for a specific stock | No |
POST |
/api/comment/{symbol} |
Creates a new comment for a stock | Yes |
PUT |
/api/comment/{id} |
Updates an existing comment | Yes |
DELETE |
/api/comment/{id} |
Deletes a comment | Yes |
| Method | Endpoint | Description | Auth Required |
|---|---|---|---|
GET |
/api/stocks |
Retrieves paginated list of stocks from DB | Yes |
GET |
/api/stocks/{symbol} |
Retrieves details for a specific stock | Yes |
POST |
/api/stocks |
Creates a new stock | Yes |