Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dcsunset/lfreader
A self-hosted Local-first Feed Reader written in Python and Preact/React.
https://github.com/dcsunset/lfreader
feed local-first preact python react rss self-hosted
Last synced: 2 months ago
JSON representation
A self-hosted Local-first Feed Reader written in Python and Preact/React.
- Host: GitHub
- URL: https://github.com/dcsunset/lfreader
- Owner: DCsunset
- License: agpl-3.0
- Created: 2022-05-01T15:26:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-08T01:45:32.000Z (4 months ago)
- Last Synced: 2024-09-08T06:53:31.102Z (4 months ago)
- Topics: feed, local-first, preact, python, react, rss, self-hosted
- Language: TypeScript
- Homepage:
- Size: 1.11 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# LFReader
[![Docker Image Version](https://img.shields.io/docker/v/dcsunset/lfreader?label=docker)](https://hub.docker.com/r/dcsunset/lfreader)
[![GitHub License](https://img.shields.io/github/license/DCsunset/LFReader)](https://github.com/DCsunset/LFReader)LFReader is a self-hosted **L**ocal-first **F**eed **Reader** written in Python and Preact/React.
## Features
- Support for various feed formats: RSS, Atom, CDF, and JSON feeds
- Local-first: Feeds and entries are stored in a sqlite3 database so that you can read local feeds even without Internet access. Futhermore, it supports archiving resources like images in the entries.
- Dark mode support: Users can choose between light and dark modes
- Flexible archiving options: User can use regex to filter the html tags and values when archiving
- Responsive UI: it supports both large-screen and small-screen devices## Screenshots
![light](docs/screenshots/light.png)
![dark](docs/screenshots/dark.png)
## Installation
### Using docker/podman
```sh
# create data dir
mkdir -p data
docker run -d -p 8080:80 --name lfreader -v $PWD/data:/app/data dcsunset/lfreader
```Then access `http://localhost:8080` in browser.
The database and archived files will be stored in the volume `/app/data` in container (or where you mount it in the host).
The log of backend server is stored at `/app/logs/backend.log` inside the container.
You can quickly check the log by `docker exec lfreader tail /app/logs/backend.log`.The default config file can be found in `docker/config.json` in this repo.
You can use your own config simply by mounting it to `/app/config.json`:
```sh
# suppose your config is at ./config.json
docker run -d -p 8080:80 --name lfreader -v $PWD/config.json:/app/config.json -v $PWD/data:/app/data dcsunset/lfreader
```### Using pip
To install backend server only, you can use pip to install the backend dir in this repo:
```sh
pip install -e "git+https://github.com/DCsunset/LFReader.git#egg=lfreader_server&subdirectory=backend"
```### Using Nix
This package is available in [NUR](https://nur.nix-community.org/repos/dcsunset/).
The output of the derivation includes both backend executable (`bin/lfreader-server`)
and frontend static files (in `share/lfreader`).Besides, a NixOS module for backend server is provided in the [Nix flake](https://github.com/DCsunset/nur-packages) output.
Simply import the flake and import the module `modules.lfreader` and add the following NixOS configuration:
```nix
{
imports = [ nur-dcsunset.modules.lfreader ];
services.lfreader = {
enable = true;
host = "::";
port = 3000;
openFirewall = true;
settings = {
db_file = "/data/db.sqlite";
archiver = {
base_dir = "/data/archives";
};
log_level = "info";
};
};
}
```### From source code
First, clone this repo.
Then, build the frontend (bundled files are in directory `frontend/dist`):
```sh
cd frontend
npm i
npm run build
cd ..
```Next, install dependencies and run backend:
```sh
# use Nix
nix run .#backend-prod# or manually
cd backend
pip install -r requirements.txt
uvicorn lfreader_server.app:app --host 0.0.0.0 --port 3000
```Finally, use your favorite web server to serve the frontend files (`frontend/dist`)
and set up the reverse proxy to pass routes prefixed by `/api` to backend.
If archiving is enabled (default), make sure the archives directory is served at `/archives`.## Configuration
### Frontend
Available config options can be found in the sidebar UI.
One important option is to enable/disable archiving.
For feeds that contain many images or videos, it might be slow and expensive to archive them.
You can disable archiving globally in such case.### Backend
The following environment variables are supported when running the backend:
| Variable | Description |
|-----------------|------------------|
| LFREADER_CONFIG | Config file path |The config file is in JSON format.
Please see refer to `Config` class in file `backend/config.py` for available options and default values.## Development
### Frontend
Change directory to `frontend`.
Create a symlink `public/archives`to the backend archive directory to serve resources.
Finally, run `npm run dev`.### Backend
With Nix, run dev server directly: `nix run .#backend-dev`
Or install all the dependencies (you could also use `venv` here):
```sh
pip install -r fastapi uvicorn
uvicorn lfreader_server.app:app --reload --port 3000
```To test if the backend pyproject can build successfully:
```sh
cd backend
## optionally set up vevn
# python -m venv venv
# . ./venv/bin/activate## pip install
pip install .
```## Migration
### v2.0.0
Move original environment variables to config file.
### v1.2.0
Steps to migrate database from below v1.2.0 to v1.2.0:
1. Make a backup of the old db first.
2. Create a new database by running LFReader server v1.2.0.
3. Add all previous feeds through API or Web UI
4. Run `python scripts/migrate_v1.2.0.py ` to migrate all previous entries## License
AGPL-3.0