{"id":20337549,"url":"https://github.com/sheel-ui/stocks-api","last_synced_at":"2025-08-01T19:38:06.935Z","repository":{"id":259298019,"uuid":"876312778","full_name":"Sheel-ui/stocks-api","owner":"Sheel-ui","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-23T18:49:38.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T13:47:28.185Z","etag":null,"topics":["asp-net-core","authentication","claims","csharp","entity-framework-core","jwt","mssql-server"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sheel-ui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-21T18:55:02.000Z","updated_at":"2024-10-23T18:53:22.000Z","dependencies_parsed_at":"2024-10-24T06:50:22.258Z","dependency_job_id":"b376b4ff-f8b9-40c2-baa9-bcfd49546aa7","html_url":"https://github.com/Sheel-ui/stocks-api","commit_stats":null,"previous_names":["sheel-ui/stocks-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Sheel-ui/stocks-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheel-ui%2Fstocks-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheel-ui%2Fstocks-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheel-ui%2Fstocks-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheel-ui%2Fstocks-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sheel-ui","download_url":"https://codeload.github.com/Sheel-ui/stocks-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sheel-ui%2Fstocks-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268288713,"owners_count":24226609,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","authentication","claims","csharp","entity-framework-core","jwt","mssql-server"],"created_at":"2024-11-14T21:09:26.931Z","updated_at":"2025-08-01T19:38:06.223Z","avatar_url":"https://github.com/Sheel-ui.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Stocks API in C#\n\nI started this project to get into ASP.NET Core. This is a simple RESTful API built with C#, using ASP.NET Core, Entity Framework Core, and MSSQL Server for managing stock information. It supports CRUD operations for users, portfolios, comments, and stocks. The API is secured using JWT-based authentication. Future plans are to create a User Interface for the application.\n\n## Table of Contents\n\n-   [Features](#features)\n-   [Technologies](#technologies)\n-   [Getting Started](#getting-started)\n-   [API Endpoints](#api-endpoints)\n-   [Database Setup](#database-setup)\n-   [Running the Application](#running-the-application)\n-   [Authentication](#authentication)\n-   [Contributing](#contributing)\n-   [License](#license)\n\n## Features\n\n-   User registration and authentication (JWT).\n-   CRUD operations for:\n    -   Stocks\n    -   Comments\n    -   Portfolios\n-   MSSQL Server integration with Entity Framework Core.\n-   RESTful principles with JSON responses.\n\n## Technologies\n\n-   **Backend Framework**: ASP.NET Core\n-   **Database**: MSSQL Server\n-   **ORM**: Entity Framework Core\n-   **Authentication**: JWT (JSON Web Token)\n-   **Language**: C#\n\n## Getting Started\n\n### Prerequisites\n\nEnsure you have the following installed on your machine:\n\n-   [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)\n-   [SQL Server](https://www.microsoft.com/en-us/sql-server/sql-server-downloads)\n-   [Postman](https://www.postman.com/downloads/) or any API testing tool\n\n### Clone the Repository\n\n```bash\ngit clone https://github.com/yourusername/stocks-api.git\ncd stocks-api\n```\n\n### Setting Up the Database\n\nUpdate the connection string in the `appsettings.json` file to match your MSSQL Server setup:\n\n```json\n\"ConnectionStrings\": {\n  \"DefaultConnection\": \"Server=YOUR_SERVER;Database=StocksDb;User Id=YOUR_USER;Password=YOUR_PASSWORD;\"\n}\n```\n\n### Database Migrations\n\nRun the following commands to apply migrations and create the database:\n\n```bash\ndotnet ef migrations add InitialCreate\ndotnet ef database update\n```\n\nThis will set up the required tables in your MSSQL database.\n\n### API Endpoints\n\nRun the following commands to apply migrations and create the database:\n\n```bash\ndotnet ef migrations add InitialCreate\ndotnet ef database update\n```\n\nThis will set up the required tables in your MSSQL database.\n\n### API Endpoints\n\n#### Authentication\n\n-   **POST** `/api/account/login`:  \n    Authenticate a user and return a JWT token.\n\n-   **POST** `/api/account/register`:  \n    Register a new user.\n\n#### Stocks\n\n-   **GET** `/api/stock`:  \n    Retrieve a list of all stocks with optional filters.\n\n-   **GET** `/api/stock/{id}`:  \n    Retrieve details of a specific stock by its ID.\n\n-   **POST** `/api/stock`:  \n    Create a new stock entry.\n\n-   **PUT** `/api/stock/{id}`:  \n    Update an existing stock's information.\n\n-   **DELETE** `/api/stock/{id}`:  \n    Delete a stock by its ID.\n\n#### Portfolios\n\n-   **GET** `/api/portfolio`:  \n    Retrieve portfolio information.\n\n-   **POST** `/api/portfolio`:  \n    Add a new stock to the portfolio.\n\n-   **DELETE** `/api/portfolio`:  \n    Remove a stock from the portfolio.\n\n#### Comments\n\n-   **GET** `/api/comment`:  \n    Retrieve all comments.\n\n-   **POST** `/api/comment/{stockId}`:  \n    Add a comment to a stock.\n\n### Database Setup\n\n#### Entity Models\n\n-   **Stock**: Represents stock data (symbol, company name, industry, etc.).\n-   **Portfolio**: Represents a user's collection of stocks.\n-   **Comment**: User comments on stocks.\n\nEntity relationships are set up through navigation properties in the models, and Entity Framework handles the ORM tasks.\n\n### Running the Application\n\nBuild the project:\n\n```bash\ndotnet build\ndotnet run\n```\n\n### Authentication\n\nThe API uses JWT for secure authentication. Once a user registers or logs in, a JWT token is returned. Include this token in the Authorization header of requests to protected endpoints:\n\n```http\nAuthorization: Bearer \u003ctoken\u003e\n```\n\n### Contributing\n\nShoutout to the amazing series by [@teddysmithdev](https://twitter.com/teddysmithdev) on ASP.NET made this project possible.Feel free to submit a pull request or open an issue if you find any bugs or want to add new features.\n\n### License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheel-ui%2Fstocks-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheel-ui%2Fstocks-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheel-ui%2Fstocks-api/lists"}