Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apneduniya/varta
An innovative News Feed Analyzer Agent which provides comprehensive summaries of the latest news from many News Outlets based on User Interests, leveraging open-source LLMs, ScrapeGraph AI, Spheron and tools like LangChain οΈβπ₯
https://github.com/apneduniya/varta
bun docker expo fastapi jwt-authentication langchain llama3 mongodb ollama python scrapegraphai smtp spheron typescript
Last synced: 29 days ago
JSON representation
An innovative News Feed Analyzer Agent which provides comprehensive summaries of the latest news from many News Outlets based on User Interests, leveraging open-source LLMs, ScrapeGraph AI, Spheron and tools like LangChain οΈβπ₯
- Host: GitHub
- URL: https://github.com/apneduniya/varta
- Owner: apneduniya
- License: mit
- Created: 2024-10-21T23:56:29.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2024-11-06T19:11:20.000Z (2 months ago)
- Last Synced: 2024-12-03T16:55:55.433Z (about 1 month ago)
- Topics: bun, docker, expo, fastapi, jwt-authentication, langchain, llama3, mongodb, ollama, python, scrapegraphai, smtp, spheron, typescript
- Language: TypeScript
- Homepage:
- Size: 690 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Varta ποΈ
An innovative News Feed Analyzer Agent which provides comprehensive summaries of the latest news from many News Outlets based on User Interests, leveraging open-source LLMs, ScrapeGraph AI, Spheron and tools like LangChain οΈβπ₯
## π Table of Contents
- [Demo](#-demo)
- [Features](#-features)
- [Prerequisites](#-prerequisites)
- [Steps to Run](#-steps-to-run)
- [Deploy on Spheron](#-deploy-on-spheron)
- [Project structure](#%EF%B8%8F-project-structure)
- [Contributing](#-contributing)
- [Acknowledgments](#-acknowledgments)
- [License](#-license)## π₯ DEMO
The **Server and Ollama Llama3** was deployed on **Spheron** when this demo video was shot.[![demo video](https://img.youtube.com/vi/OL2nFczDWso/0.jpg)](https://www.youtube.com/watch?v=OL2nFczDWso)
## π Features
An News Feed Analyzer Agent that can:- ποΈ Aggregate news from 14+ sources.
- π Analyze content from 60+ interests choosed by user.
- π Concise and comprehensive summaries of the latest news.
- π§ Email subscriptions with customizable frequency.
- π Bookmark news for later read.## π«³ Prerequisites
You should have- [Node v20.16.0 or higher](https://nodejs.org/en)
- [Python 3.11 or higher](https://www.python.org/downloads/)
- [MongoDB Atlas Connection URL](https://www.mongodb.com/docs/guides/atlas/connection-string/)
- [Google App Password for SMTP](https://www.gmass.co/blog/gmail-smtp/)
- [Ollama Llama3](https://ollama.com/library/llama3)## π£ Steps to Run
**Navigate to the Project Directory:**
Change to the directory where the project files are located. For example:
```shell
cd path/to/project/directory
```### 1. Expo App
1. Install dependencies
```bash
bun install # or npm install
```2. Configure environment variables
1. Copy `.env.example` to `.env`.
2. Fill in the `.env` file with the necessary environment variables.2. Start the app
```bash
bunx expo start # or npx expo start
```In the output, you'll find options to open the app in a
- [Development build](https://docs.expo.dev/develop/development-builds/introduction/)
- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with ExpoThis project uses [file-based routing](https://docs.expo.dev/router/introduction).
### 2. Server
1. Change the directory
```bash
cd server
```2. Create a virtual environment.
```bash
python3 virtualenv venv
```3. Activate the virtual environment.
```bash
source ./venv/bin/activate
```4. Install dependencies from `requirements.txt`
```bash
pip install -r requirements.txt
```5. Configure environment variables
1. Copy `.env.example` to `.env`.
2. Fill in the `.env` file with the necessary environment variables.6. Start the server
```bash
fastapi dev main.py --reload --port 8000 # or for production, fastapi run main.py --port 8000
```> [!NOTE]
> Ollama should be running locally before you start the server!## π Deploy on Spheron
Here I will help you to deploy **Server and Ollama** on Spheron using **Spheron Protocol CLI** πͺ[![demo video](https://img.youtube.com/vi/j0LiRiz2iXg/0.jpg)](https://youtu.be/j0LiRiz2iXg)
### Prerequisites
You should have this before you start deploying on Spheron:- [curl](https://curl.se/)
### 1. Install Spheron Protocol CLI (Linux, MacOS)
```bash
curl -sL1 https://sphnctl.sh | bash
```
After installation, verify the installation by using a simple command to check the Spheron version:
```bash
sphnctl version # or `sphnctl -h` for help
```### 2. Creating a Wallet
```bash
sphnctl wallet create --name
```
Replace `` with your desired wallet name. Here is an example of how the result will look:
```bash
Created account xxx:
path: /home/thatsmeadarsh/.spheron/.json
address: 0x3683Ae6bd8f23DEb35f79A750EA0a7e6fc858047
secret: xxxxxxxxxx
mnemonic: xxxxxx xxxxx xxxx xxxxx xxxxx xxxx xxxxx xxxxx
```
Make sure to _securely save the mnemonic phrase and key secret provided_.### 3. Get Test Tokens from the Faucet
You will need some token to deploy on Spheron. Visit the [Spheron Faucet](https://faucet.spheron.network/) to obtain test tokens for deployment. After receiving the tokens, you can check your wallet balance with:
```bash
sphnctl wallet balance --token USDT
```
Here is an example of how the result will look:
```bash
Current ETH balance: 0.09993387282
Total USDT balance: 35
Deposited USDT balance
unlocked: 14.030481
locked: 4e-06
```
Note: You might have `unlocked or locked USDT balance` as 0 but here I don't because I have previously deployed on Spheron. Don't worry, in next step I have covered that π.### 4. Deposit Tokens to Your Escrow Balance
Deposit USDT to your escrow wallet for deployment:
```bash
sphnctl payment deposit --amount 20 --token USDT
```
Now check your balance, if it's unlocked and sufficient (just like mine above):
```bash
sphnctl wallet balance --token USDT
```### 5. Create your Deployment
I have already created a docker image for you so you can directly head towards to deployment without worrying π.
In the project directory, navigate to `server/`:
```bash
cd server
```
Open `deploy.yml` in a code editor and fill the environmental variables:
```bash
- MONGO_CONNECTION_URL=
- DATABASE_NAME=
- JWT_SECRET_KEY=
- JWT_REFRESH_SECRET_KEY=
- ACCESS_TOKEN_EXPIRE_MINUTES=
- REFRESH_TOKEN_EXPIRE_MINUTES=
- ALGORITHM=
- SMTP_SERVER=
- SMTP_PORT=
- SMTP_USERNAME=
- SMTP_PASSWORD=
```
And deploy the `deploy.yml` configuration file on Spheron:
```bash
sphnctl deployment create deploy.yml
```
Here is an example of how the result will look:
```bash
Validating SDL configuration.
SDL validated.
Sending configuration for provider matching.
Create deployment tx: [Tx Hash]
Waiting for providers to bid on the deployment order...
Bid found.
Order matched successfully.
Deployment created using wallet 0x3683Ae6bd8f23DEb35f79A750EA0a7e6fc858047
lid: 389
provider: 0x6634d41cccBD1E1576Ed4c6226832521A66bF874
agreed price: 0.74
Sending the manifest for deploymentβ¦
Deployment manifest sent, waiting for acknowledgment.
Deployment is finished.
```
Note: The `lid` we get from the deployment is called **Lease ID**. This is the identifier you need to use to access your deployment's logs and status.Now, Congratulations!! You have deployed the **Server and Ollama** on Spheron successfully π₯³π₯³.
### 6. Access Your Deployment
To get details about your deployment, including the URL, ports, and status, run:
```bash
sphnctl deployment get --lid
```
Replace the `` with your actual Lease ID, you obtained after deployment.## ποΈ Project structure
### 1. Expo App
```bash
βββ app/ # Main application
β βββ email-subscription/ # Email subscription screen
β βββ interest/ # News Interest screen
β βββ news-outlet/ # News Outlet screen
β βββ login/ # Login screen
β βββ register/ # Register screen
β βββ news/ # News screen (dynamic)
β βββ (tabs)/ # Screens those are on Navigation Tab
β βββ index.tsx # Home screen
β βββ bookmark/ # Bookmark screen
β βββ settings/ # Settings screen
βββ assets/ # Assets like fonts and images
β βββ fonts/ # Font files
β βββ images/ # Image and Icon files
βββ components/ # Reusable components
β βββ auth/ # Authentication components
β βββ button/ # Button components
β βββ common/ # Common components
β βββ form/ # Form-related components
β βββ sections/ # Section components
βββ constants/ # Constant values
βββ hooks/ # Custom hooks
βββ server/ # SERVER (BACKEND)
βββ service/ # Services for API calls
β βββ auth/ # Authentication services
β βββ email-subscription/ # Email subscription services
β βββ news/ # News services
βββ utils/ # Utility functions
βββ .env.example # Example environment variables
βββ .gitignore # Git ignore rules
```### 2. Server
```bash
βββ app/ # Main application folder
β βββ auth/ # Authentication module
β βββ news/ # News module
β βββ subscription/ # Subscription module
β βββ users/ # User management module
βββ data/ # Data and templates folder
βββ database/ # Database management module
βββ helpers/ # Helper functions
βββ models/ # Models for data validation, serialization, and type enforcement
βββ service/ # Service-related code
β βββ news/ # News service
β βββ subscription/ # Subscription service
βββ utils/ # Utility functions
βββ main.py # Main application file
βββ deploy.yml # Spheron Deployment configuration
βββ Dockerfile # Docker configuration
βββ .dockerignore # Docker ignore rules
βββ .env.example # Example environment variables
βββ .gitignore # Git ignore rules
βββ requirements.txt # Python dependencies
```## π€ Contributing
1. Fork the repository.
2. Create a new branch: `git checkout -b feature-name`.
3. Make your changes.
4. Push your branch: `git push origin feature-name`.
5. Create a pull request.## β Acknowledgments
This project couldn't be there if they didn't be there!
- [Spheron](https://spheron.network/)
- [Ollama Llama3](https://ollama.com/library/llama3)
- [ScrapeGraphAI](https://github.com/ScrapeGraphAI/Scrapegraph-ai)
- [Langchain](https://www.langchain.com/)Even I had many issues while making this project and this was my first time to make a complete react native project with backend but spheron team helped me to over come the issues, gave me suggestions and I am really thankful to it β€οΈβπ©Ή!
## π§Ύ License
This project is licensed under the [MIT License](LICENSE).