this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

TypeScript 92.0%
CSS 4.3%
Nix 2.1%
JavaScript 1.6%
76 1 0

Clone this repository

https://tangled.org/drawbu.dev/compiles.at https://tangled.org/did:plc:pj5vgcebbi6shqj6zapminia/compiles.at
git@tangled.org:drawbu.dev/compiles.at git@tangled.org:did:plc:pj5vgcebbi6shqj6zapminia/compiles.at

For self-hosted knots, clone URLs may differ based on your setup.

Download tar.gz
README.md

sfsu 317 final project#

Decentralized collaborative code challenges platform built on ATProto. Create challenges and face your friends on various metrics (code length, runtime and more!).

The goal is just to have a neat place to challenge for you and your friends to compete on dumb golf code challenges or stupid optimization problems. You could do a challenge where you have to solve it with the shortest possible python code, or the fastest C as an optimization problem, or even the shortest assembly generated code (with gcc, no LLVM compilers).

The app is deployed at compiles.at.

data ownership#

All your data is yours. You'll connect to the application using your internet handle (aka. atproto identity, also known as bluesky account).

All the data you'll produce will be stored on your PDS (Personal Data Server). When you create a challenge, create tests cases, solutions, etc. everything is stored on your PDS by default (you can store it privately on the platform, but this is opt-in by design). The problems you'll write solutions for will be stored on your PDS by default as well.

The goal is to allow users to own their data, be able to change platforms as they see fit, even after the project dies. As long as their account exists on THEIR PDS, they can access their data and continue using it. For the moment, we wont permit the creation of new accounts on this app, users will have to create it on any other platform on the atmosphere (as it requires more unesserary deployment complexity). I want to have the platform as open as possible. The user with just have to log in with their handle/did, complete the OAuth flow with their PDS, and then they can start using the platform without having to create an account on this platform.

To learn more, I invite you to check out atproto documentation, or explore the atproto collections linked to my account drawbu.dev.

data / lexicon#

This is a draft, but we could imagine the collections:

%%{init: {'theme': 'default', 'themeVariables': {'fontFamily': 'monospace'}}}%%

erDiagram

    User["com.example.user (user's PDS)"] {
        string did "DID"
        string handle "e.g. alice.bsky.social"
        blob avatar "profile picture"
    }

    Problem["com.example.problem (creator's PDS)"] {
        string rkey "TID"
        string title ""
        string description "markdown body"
        string difficulty "easy | medium | hard"
        string_array tags "e.g. dp, graphs"
        string_array supportedLangs "python, js, rust, etc."
        blob starterCode "optional"
        datetime createdAt ""
    }

    TestCase["com.example.testcase (creator's PDS)"] {
        string rkey "TID"
        at_uri problem "-> problem"
        string input ""
        string expected ""
        bool hidden "hidden from solvers"
    }

    Solution["com.example.solution (solver's PDS)"] {
        string rkey "TID"
        at_uri problem "-> problem (cross-PDS)"
        string lang "language used"
        blob code "solution source"
        datetime submittedAt ""
    }

    ExecutionResult["execution_results (centralized DB)"] {
        uuid id ""
        string solutionUri "at:// of solution"
        int runtimeMs ""
        int memoryKb ""
        int passedTests ""
        int totalTests ""
        jsonb perTestResults "per-test breakdown"
        timestamp executedAt ""
    }

    User           ||--o{ Problem          : "creates"
    User           ||--o{ Solution         : "submits"
    Problem        ||--o{ TestCase         : "has"
    Problem        ||--o{ Solution         : "solved by"
    Solution       ||--o{ ExecutionResult  : "produces"

stack + deployment strategy#

The app was planned to be a Golang + SvelteKit app deployed on Cloudflare workers, but because of too many issues with the Go app compiled to WASM on the workers runtime, I decided to switch to a full-stack app using Tanstack Start + Solid.

The app is going to be deployed automatically on Cloudflare workers by a Continuous Integration & Deployment pipeline using GitHub Actions, with decentralized data ownership using ATProto and a Cloudflare D1 database for storing data alongside that won't be stored on the atmosphere. The deployment and database both will be deployed on serverless technologies because of its deployment as code strategy and near-zero cost for early projects such as this one.

I setuped a reproducible development environment using a Nix flake. The whole project uses the pnpm package manager, and uses Typescript everywhere. It uses Tanstack Start, Solid, Tailwind. I will use Prisma as a database ORM, alongside Tanstack Query, and the @atcute atproto tools ecosystem (OAuth, Lexicons, etc.).

For the text editor, I'll probably go with a Monaco Editor. running on the client-side (maybe integrating local WASM lsps later), and will use an external service dedicated to executing the code in a containerized, reproducible environment. Some examples may include sprites.dev and judge0 or even a custom solution with Docker.

acknowledgements#

Code competitive platforms:

ATProto apps using decentralized ATProto data ownership:

Inspiration:

To be fair, I chose this project both because I wanted a platform like that where I could easily create dump contests with my friends, but I also really wanted to hack on the atmosphere :)