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 οΈβπ₯
- Demo
- Features
- Prerequisites
- Steps to Run
- Deploy on Spheron
- Project structure
- Contributing
- Acknowledgments
- License
The Server and Ollama Llama3 was deployed on Spheron when this demo video was shot.
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.
You should have
- Node v20.16.0 or higher
- Python 3.11 or higher
- MongoDB Atlas Connection URL
- Google App Password for SMTP
- Ollama Llama3
Navigate to the Project Directory: Change to the directory where the project files are located. For example:
cd path/to/project/directory
-
Install dependencies
bun install # or npm install
-
Configure environment variables
- Copy
.env.example
to.env
. - Fill in the
.env
file with the necessary environment variables.
- Copy
-
Start the app
bunx expo start # or npx expo start
In the output, you'll find options to open the app in a
- Development build
- Android emulator
- iOS simulator
- Expo Go, a limited sandbox for trying out app development with Expo
This project uses file-based routing.
-
Change the directory
cd server
-
Create a virtual environment.
python3 virtualenv venv
-
Activate the virtual environment.
source ./venv/bin/activate
-
Install dependencies from
requirements.txt
pip install -r requirements.txt
-
Configure environment variables
- Copy
.env.example
to.env
. - Fill in the
.env
file with the necessary environment variables.
- Copy
-
Start the server
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!
Here I will help you to deploy Server and Ollama on Spheron using Spheron Protocol CLI πͺ
You should have this before you start deploying on Spheron:
curl -sL1 https://sphnctl.sh | bash
After installation, verify the installation by using a simple command to check the Spheron version:
sphnctl version # or `sphnctl -h` for help
sphnctl wallet create --name <your-wallet-name>
Replace <your-wallet-name>
with your desired wallet name. Here is an example of how the result will look:
Created account xxx:
path: /home/thatsmeadarsh/.spheron/<your-wallet-name>.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.
You will need some token to deploy on Spheron. Visit the Spheron Faucet to obtain test tokens for deployment. After receiving the tokens, you can check your wallet balance with:
sphnctl wallet balance --token USDT
Here is an example of how the result will look:
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 π.
Deposit USDT to your escrow wallet for deployment:
sphnctl payment deposit --amount 20 --token USDT
Now check your balance, if it's unlocked and sufficient (just like mine above):
sphnctl wallet balance --token USDT
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/
:
cd server
Open deploy.yml
in a code editor and fill the environmental variables:
- 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:
sphnctl deployment create deploy.yml
Here is an example of how the result will look:
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 π₯³π₯³.
To get details about your deployment, including the URL, ports, and status, run:
sphnctl deployment get --lid <lease-id>
Replace the <lease-id>
with your actual Lease ID, you obtained after deployment.
βββ 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
βββ 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
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
. - Make your changes.
- Push your branch:
git push origin feature-name
. - Create a pull request.
This project couldn't be there if they didn't be there!
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 β€οΈβπ©Ή!
This project is licensed under the MIT License.