Code Monkey home page Code Monkey logo

bytecrowds's Introduction


Bytecrowds - an easy to use code sharing platform with minimalist design | Product Hunt

Description

What's Bytecrowds?

Bytecrowds is a simple and reliable serverless code sharing platform, which goal is to allow programmers to share code with peers in seconds.

How does it differ from other code sharing platforms?

The infrastructure we use relies on serverless functions to maximize the reliability of the app, making requests on edge and auto-scaling

Why serverless?

Serverless allows us to focus on code rather than infrastructure operations, which can cause a lot of problems when you need maximum stability and scaling.

Sponsors

Many thanks to the Upstash team for allowing this project to run on their serverless Redis infrastructure.

Upstash

Upstash: Serverless Database for Redis

  • Serverless Redis with global replication and durable storage
  • Price scales to zero with per request pricing
  • Built-in REST API designed for serverless and edge functions

Start for free in 30 seconds!

Flow

flow

Data

The data collected from the platform is stored using Redis data types:

  • a bytecrowd is stored as a Redis hash having the following properties:
{
  text: string,
  language: string,
  authorizedEmails: string array
}
  • the analytics data is stored as follows:

    • a day's data is stored as a Redis hash having the following properties:

      {
        hits: int,
        addresses: string array,
        uniqueVisitors: int,
        countries: string array,
        continents: string array,
        pages: string array
      }
    • the general stats are stored as sorted sets as follows:

      {
        continents: {
            continent: string,
            score: int
        } array,
        countries: {
          country: string,
          score: int
        } array
        pages: {
          page: string,
          score: int
        } array
      }

Analytics

Bytecrowds uses a custom analytics engine that sends the current page (with the rest of the data being processed server-side) to a worker the first time a page renders. We then create and update daily and general stats representing the app usage.

Security

  • We're using auth.js for authentication. Once set, the list of authorized emails for a protected bytecrowd can only be modified from the database directly.

  • The analytics engine needs to temporarily store the SHA-256 hashes of the visitors' IP addresses to determine the number of unique visitors the site has. Those hashes are regularly deleted.

How to run?

  • Git clone the frontend and analytics repositories
  • Create the .env files and set the variables accordingly
  • (optional) Install wrangler and deploy a local version of the analytics worker

Tech stack

Frontend

Serverless Backend

  • we are using a custom Ably provider for syncing the clients ( thanks to the Ably team for helping with this one )
  • Vercel functions for interacting with the database
  • Cloudflare workers for the analytics engine
  • Upstash as the serverless Redis provider

Other tools

  • LogRocket for monitoring and error tracking

How it works?

We use the y.js-codemirror bindings on react-codemirror and connect the editor to the global SyncedStore object, together with the Ably provider. The infrastructure can auto-scale to any number of users.

Important!

This is a unified repository and is updated regularly if needed. To see the timelined version check the main and analytics repositories.

Distinctions

bytecrowds's People

Contributors

tudorzgimbau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

step135

bytecrowds's Issues

Fixing the "About Us" and "Contact" buttons

Context

While checking the About Us page, I stumbled upon a bug in the "About Us" and "Contact" buttons on the homepage added in frontend/pages/index.js (6af26cd) .

The Problem

The problem is the buttons behaviour: Only the text (title) of the buttons has a functionality while all of the area besides it does not posses any of it. To put it simply: only the text within the button is clickable.

A Possible Solution

This happens becuase of the way the button is instantiated. It is more of a button with an a href on top than a regular button.

Screen Shot 2022-09-10 at 22 28 57

The solution would be to rebuild the Contact and About Us buttons in the same manner the "new bytecrowd" button was created. (6af26cd , frontend/pages/index.js)

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.