Coder Social home page Coder Social logo

bobisapotato / fritter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beakerbrowser/fritter

0.0 0.0 0.0 6.38 MB

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

Home Page: dat://fritter.hashbase.io

License: MIT License

JavaScript 74.84% HTML 4.67% Less 20.49%

fritter's Introduction

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?

fritter's People

Contributors

taravancil avatar pfrazee avatar safrmo avatar hypercubed avatar kevinmarks avatar brechtcs avatar dkunin avatar webdesserts avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.