• This repository has been archived on 27/Dec/2022
  • Stars
    star
    364
  • Rank 117,101 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 7 years ago
  • Updated almost 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A peer-to-peer social feed app. (proof of concept)

Fritter

An example application that demonstrates how to build peer-to-peer Web applications with Beaker Browser, Dat, and WebDB.

Fritter demo

Features

Fritter is a simple social feed application; it implements:

  • Writing posts
  • Replying to posts
  • Favoriting posts and replies
  • Following users
  • Editing your profile

Fritter uses libfritter to manage its data definitions and methods. Check it out to see a well-documented example of using WebDB.

What is a peer-to-peer Web app?

The peer-to-peer (p2p) Web is a loose term for describing the community of websites and applications that are built on top of p2p protocols like dat://.

A p2p Web app is like any other website or app: it's a collection of HTML, CSS, JavaScript, and other files. What makes it different? It uses a p2p protocol (in this case dat://) instead of HTTP. Most p2p websites and apps are not supported in mainstream browsers like Firefox or Chrome, but you can use Beaker to access websites that use the dat:// protocol.

How Fritter works

User profiles

User profiles on the p2p Web are a bit different than user profiles on the traditional Web. Instead of being stored in a server-side database, they're simply websites! This means you can look at all the files that comprise a profile. Check out Dog Legs McBoots's profile to see for yourself:

dat://232ac2ce8ad4ed80bd1b6de4cbea7d7b0cad1441fa62312c57a6088394717e41

profile.json contains some basic information about the profile:

{
  "name": "Dog legs McBoot",
  "bio": "A good boy",
  "avatar": "avatar.png",
  "follows": []
}

Posts are stored as individual files in the /posts directory. Each file is addressed by its base36-encoded timestamp. Votes/likes/favorites are recorded in the /votes directory using the same technique.

/posts
|-- 0jbdviucy.json
|-- 0jbdvkv1r.json
|-- 0jbdvsjo9.json

A post includes the content of the post, a timestamp, and if applicable, information about the post it's in reply to:

{
  "text": "hi",
  "threadRoot": "dat://232ac2ce8ad4ed80bd1b6de4cbea7d7b0cad1441fa62312c57a6088394717e41/posts/0jbdvsjo9.json",
  "threadParent": "dat://232ac2ce8ad4ed80bd1b6de4cbea7d7b0cad1441fa62312c57a6088394717e41/posts/0jbdvsjo9.json",
  "createdAt":1513703188329
}

Storing user profiles

Fritter uses Beaker's DatArchive APIs to access the Dat network. This makes it possible to store profiles locally on the user's computer, and to transfer profile information directly between user devices.

Fritter keeps track of the URL for the user's profile with Local Storage under the key userUrl. In a more robust implementation of an app like Fritter, users could switch between their profiles by being prompted to select a profile using Beaker's DatArchive.selectArchive() method, and then updating the value of localStorage.userUrl.

Getting started

Try Fritter

Visit Fritter in Beaker to create your own profile:

dat://9900f9aad4d6e79e0beb1c46333852b99829e4dfcdfa9b690eeeab3c367c1b9a

Keep in mind that Fritter is an example application and is missing some features like notifications and search that would make it a viable social media application.

Customizing Fritter

On the p2p Web, user profiles are simply websites that are formatted so they can be used by many different applications. This makes it possible to customize websites and apps without needing to create a new profile!

For example, to use a custom theme on Fritter, you could fork Fritter using Beaker, then update Fritter's CSS as much or as little as you'd like. Alternatively, you can clone this repository, implement your changes, then deploy your custom version of Fritter onto the Dat network using Beaker or the Dat CLI.

Questions or concerns?

More Repositories

1

beaker

An experimental peer-to-peer Web browser
JavaScript
6,750
star
2

homebase

Self-deployable tool for hosting hyper:// websites
JavaScript
406
star
3

webdb

The Web is your database.
JavaScript
399
star
4

dathttpd

Replaced by Homebase! See https://github.com/beakerbrowser/homebase.
JavaScript
280
star
5

hashbase

A Dat-hosting service for multiple users
JavaScript
239
star
6

explore

A curated list of peer-to-peer websites and apps
HTML
181
star
7

unwalled.garden

Schemas for a p2p social-media network built on the Dat Web.
HTML
131
star
8

dat-photos-app

A peer-to-peer photos app
JavaScript
86
star
9

libfritter

Methods for Fritter, a Dat-based Twitter clone
JavaScript
47
star
10

beaker-core

Beaker browser's core software [outdated]
JavaScript
45
star
11

pauls-dat-api

Library of functions that make working with dat / hyperdrive easier.
JavaScript
44
star
12

beaker.social

A social networking app built on Beaker's unwalled.garden open standards.
JavaScript
40
star
13

bkr

Beaker headless runtime for the hyper:// space network.
JavaScript
39
star
14

beakerbrowser.com

Source code for https://beakerbrowser.com
HTML
39
star
15

dat-node

A toolkit for writing Dat-based services in nodejs
JavaScript
37
star
16

dat-rssreader-app

Read RSS feeds for blogs hosted over dat://
JavaScript
25
star
17

dat-archive-map-reduce

Index files in Dat archives with map-reduce to create queryable data views.
JavaScript
23
star
18

beaker.dev

Developer portal for templates, tutorials, and news
JavaScript
19
star
19

dat-pinning-service-client

Client API for Dat pinning services
JavaScript
14
star
20

social

Peer-to-peer social media
JavaScript
13
star
21

dat-ephemeral-ext-msg

Methods for DEP-0000: Ephemeral Message (Extension Message)
JavaScript
11
star
22

beaker-profiles-api

An API for reading and writing profile archives as used by Beaker.
JavaScript
11
star
23

beaker-browser.gitbook.io

This repo mirrors the content in beaker-browser.gitbook.io
11
star
24

dat-editor-app

A simple but well-featured code editor
JavaScript
11
star
25

beaker.network

A social aggregator application
JavaScript
10
star
26

docs.beakerbrowser.com

Beaker Browser documentation site
JavaScript
9
star
27

p2p-web-workshop

A collection of resources for running a peer-to-peer Web workshop
9
star
28

hyperdrive.network

An application for viewing and modifying Hyperdrives. Requires a Hyperdrive-enabled browser.
JavaScript
9
star
29

webterm

Specs and discussions for the Webterm environment
9
star
30

userlist

A simple service for listing your profile drive under your Twitter username.
JavaScript
8
star
31

beaker-uplink

Peer-to-peer bookmark sharing.
JavaScript
8
star
32

beaker-sidebar-app

Web application that drives Beaker's sidebar view
JavaScript
8
star
33

beaker-editor-app

In-browser editor application.
JavaScript
8
star
34

dat-legacy-tools

Tools to access legacy dats stored in Beaker
JavaScript
7
star
35

pauls-dat-api2

DatArchive implementation for Dat 2.0
JavaScript
7
star
36

beaker-reader

Publish and read blogposts.
JavaScript
7
star
37

dat-wysiwywiki-app

A wiki app with a wysiwyg interface
JavaScript
7
star
38

beaker-compare-app

A builtin app for comparing, diffing, and merging two dats
JavaScript
6
star
39

pauls-hyper-mirror

A simple seeding servce
JavaScript
6
star
40

beaker-user-website-template

The template for new user websites.
JavaScript
5
star
41

beaker-library-app

The Beaker "Library" app
JavaScript
5
star
42

beaker.cloud

An open-source dat server that scales
5
star
43

record-protocols-spec

(Dead Spec) A standard for building interoperable applications on the Web.
5
star
44

pauls-embedded-analytics

A sqlite-backed embedded analytics module for nodejs.
JavaScript
5
star
45

beaker-search-app

The Beaker "Search" app
JavaScript
5
star
46

beaker-virtual-fs

An object-oriented files interface used by Beaker to render the user's filesystem
JavaScript
5
star
47

dat-serve-resolve-path

Beaker's method to find the file to serve in dat:// requests
JavaScript
4
star
48

dat-nexus-app

A social feeds and profiles application
JavaScript
4
star
49

beaker-bookmarks-app

The Beaker "Bookmarks" app
JavaScript
4
star
50

beaker-app-stdlib

Assets which are reused across Beaker apps
JavaScript
4
star
51

viewer-apps

Beaker's builtin hyperdrive-viewer applications
JavaScript
3
star
52

hypercloud-ui-hashbase

Hashbase UI module for hypercloud [DEPRECATED]
CSS
3
star
53

library-tools

Module for managing the library.json file (spec: beakerbrowser.com/library)
JavaScript
3
star
54

beaker-error-constants

Module containing the errors used by beaker and its submodules
JavaScript
3
star
55

basic-user-site-template

Template used to create new user sites
JavaScript
3
star
56

uwg-bash

Bash CLI tools for reading/writing Unwalled Garden data
3
star
57

beaker-start-app

The Beaker "Start Page" app
JavaScript
2
star
58

beaker-analytics-server

Server to collect Beaker usage pings.
JavaScript
2
star
59

dat-workshop-server

A server for the "dat workshop" application (created for the Decentralized Web Summit 2018)
HTML
2
star
60

datignore

A module for reading and using .datignore files
JavaScript
2
star
61

builtin-pages-lib

Some common library code for Beaker's builtin pages.
JavaScript
2
star
62

beaker-index

An indexer driven from the beaker userlist
JavaScript
2
star
63

beaker-profile-app

The Beaker "Profile" App
JavaScript
2
star
64

beaker-feed-app

The Beaker "Feed" App
JavaScript
2
star
65

dat-session-data-ext-msg

Methods for DEP-0006: Session Data (Extension Message)
JavaScript
2
star
66

discussions

Repo for having org-wide discussions.
2
star
67

dat-archive-file-diff

Get line-by-line diffs of text files in Dat archives
JavaScript
1
star
68

dat-nexus-api

API for interacting with Dat Nexus profiles
JavaScript
1
star
69

simple-cloud-announcer

A fork of discovery-swarm that announces a peer and waits for connections.
JavaScript
1
star
70

assets

Images, logos, etc
1
star
71

site-schema.org

A machine-readable description format used to validate and describe the file structures of websites.
1
star