├── .github
└── workflows
│ └── nuxtjs.yml
├── .gitignore
├── LICENSE
├── README.md
├── app.config.ts
├── app.vue
├── components
├── BookCard.vue
├── BookView.vue
├── BooksList.vue
├── Error.vue
└── Header.vue
├── middleware
└── remotes.ts
├── nuxt.config.ts
├── package-lock.json
├── package.json
├── pages
├── history.vue
├── index.vue
├── instances.vue
├── open
│ ├── [id].vue
│ └── dropped.vue
├── search.vue
└── settings.vue
├── tsconfig.json
└── utils
├── index.ts
└── sanitize.ts
/.github/workflows/nuxtjs.yml:
--------------------------------------------------------------------------------
1 | # Sample workflow for building and deploying a Nuxt site to GitHub Pages
2 | #
3 | # To get started with Nuxt see: https://nuxtjs.org/docs/get-started/installation
4 | #
5 | name: Deploy Nuxt site to Pages
6 |
7 | env:
8 | NUXT_APP_BASE_URL: /teatime/
9 | on:
10 | # Runs on pushes targeting the default branch
11 | push:
12 | branches: ["main"]
13 |
14 | # Allows you to run this workflow manually from the Actions tab
15 | workflow_dispatch:
16 |
17 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
18 | permissions:
19 | contents: read
20 | pages: write
21 | id-token: write
22 |
23 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
24 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
25 | concurrency:
26 | group: "pages"
27 | cancel-in-progress: false
28 |
29 | jobs:
30 | build:
31 | runs-on: ubuntu-latest
32 | steps:
33 | - uses: actions/checkout@v3
34 | - run: corepack enable
35 | - uses: actions/setup-node@v3
36 | with:
37 | node-version: "20"
38 | # Pick your own package manager and build script
39 | - run: npm install
40 | - run: npx nuxt build --preset github_pages
41 | - name: Upload artifact
42 | uses: actions/upload-pages-artifact@v3
43 | with:
44 | path: ./.output/public
45 |
46 | # Deployment job
47 | deploy:
48 | environment:
49 | name: github-pages
50 | url: ${{ steps.deployment.outputs.page_url }}
51 | runs-on: ubuntu-latest
52 | needs: build
53 | steps:
54 | - name: Deploy to GitHub Pages
55 | id: deployment
56 | uses: actions/deploy-pages@v4
57 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Nuxt dev/build outputs
2 | .output
3 | .data
4 | .nuxt
5 | .nitro
6 | .cache
7 | dist
8 |
9 | # Node dependencies
10 | node_modules
11 |
12 | # Logs
13 | logs
14 | *.log
15 |
16 | # Misc
17 | .DS_Store
18 | .fleet
19 | .idea
20 |
21 | # Local env files
22 | .env
23 | .env.*
24 | !.env.example
25 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Yo'av Moshe
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 | 📚 TeaTime
3 |
4 |
5 |
6 | TeaTime is a fully static distributed library system powered by IPFS, SQLite, and GitHub
7 |
8 |
9 |
10 | Auto-updating instances are hosted on Netlify and GitHub Pages
11 |
12 |
13 | # A Distributed Library
14 |
15 | The TeaTime web application is completely decoupled from its databases and the files it fetches. The databases used in TeaTime are [GitHub repositories tagged with the teatime-database topic](https://github.com/search?q=topic%3Ateatime-database&type=repositories), which are published on GitHub Pages. Each repository contains a [config.json](https://github.com/bjesus/teatime-database/blob/main/config.json) file that points to an SQLite database. Before a user performs a search in TeaTime, they choose which database to use and then TeaTime queries the SQLite database using [sql.js-httpvfs](https://github.com/phiresky/sql.js-httpvfs). Each row in the SQLite database is an item in the library, and a file hash column is used for getting the item from IPFS.
16 |
17 | Since the web application is a static site, and the databases are comprised of static files, both can be easily forked, replicated, and deployed. Frontend instances are [GitHub repositories tagged with the teatime-instance topic](https://github.com/search?q=topic%3Ateatime-instance&type=repositories). With the files being served off IPFS, this distributed architecture contributes to TeaTime's resilience.
18 |
19 | ## Features
20 |
21 | - Search by title, author, year or format
22 | - Maintain reading history, and return to page when re-opening file
23 | - Download files locally
24 | - Cache files in IndexedDB for fast loading
25 | - Drop files on TeaTime to render them
26 | - Dark mode and full screen mode
27 | - No cookies, no login
28 | - **...Completely distributed**
29 |
30 | ## Developing the Frontend
31 |
32 | TeaTime is Nuxt.js application. You can easily run it locally by cloning the repository and following these steps:
33 |
34 | 1. Install the dependencies: `npm install`
35 | 2. Run the server: `npm run dev`
36 | 3. Navigate to `http://localhost:3000`
37 |
38 | Check out the [Nuxt documentation](https://nuxt.com/docs/getting-started) for more information.
39 |
40 | ## Creating a Database
41 |
42 | > [!TIP]
43 | > The easiest way to create your own database is by forking the [JSON-based database repository](https://github.com/bjesus/teatime-json-database/) and adjusting the JSON files according to your needs. GitHub Actions will then generate an SQLite file and upload it to GitHub Pages.
44 |
45 | To manually generate an SQLite database that TeaTime can work with, follow the example on [the database repository](https://github.com/bjesus/teatime-database/).
46 |
47 | Each SQLite database contains a table with the below schema. Note that column names can be adjusted in the `config.json` file.
48 |
49 | ```sql
50 | CREATE TABLE "books" (
51 | "id" INTEGER,
52 | "title" TEXT,
53 | "author" TEXT,
54 | "year" INTEGER,
55 | "lang" TEXT,
56 | "size" INTEGER,
57 | "ext" TEXT,
58 | "ipfs_cid" TEXT,
59 | PRIMARY KEY("id" AUTOINCREMENT)
60 | );
61 | ```
62 |
63 | The `dbConfig` section of `config.json` is identical to the output of the [sql.js-httpvfs create_db.sh](https://github.com/phiresky/sql.js-httpvfs/blob/master/create_db.sh) script.
64 |
65 | If the SQLite file is too big, you can [split it](https://github.com/phiresky/sql.js-httpvfs?tab=readme-ov-file#usage). Note the information about optimizing your database. You will also want to [use FTS](https://github.com/bjesus/teatime-database/blob/main/create_indexes.sql). Then, publish your repository to GitHub Pages and assign the `teatime-database` topic to your repository.
66 |
67 | ## Contributing
68 |
69 | Even if you cannot code, a great way to contribute is to simply fork this repository, as well as your favorite database repositories. If you fork the repository, it could be better to do it manually (`git clone` && `git remote add your-origin ...` && `git push your-origin main`) so that the repositories won't be directly linked.
70 |
71 | It's also a good practice to star the database repositories you find useful, as this determines their order in the TeaTime user interface, making it easier for other users to find the best databases.
72 |
--------------------------------------------------------------------------------
/app.config.ts:
--------------------------------------------------------------------------------
1 | export default defineAppConfig({
2 | title: "TeaTime",
3 | icon: "🫖",
4 | });
5 |
--------------------------------------------------------------------------------
/app.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |