this repo has no description
0
fork

Configure Feed

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

docs: add a readme

Clément a8da8722 389e5a6b

+147
+147
README.md
··· 1 + # sfsu 317 final project 2 + 3 + Decentralized collaborative code challenges platform built on ATProto. Create 4 + challenges and face your friends on various metrics (code length, runtime and 5 + more!). 6 + 7 + The goal is just to have a neat place to challenge you are your friends on dumb 8 + on some golf code or stupid optimization problems. You could do a challenge 9 + where you have to have as little as possible python code, or the fastest C as 10 + an optimization problem, or even the shortest assembly generated code (with gcc, 11 + no LLVM compilers). 12 + 13 + 14 + ## data ownership 15 + 16 + All your data is yours. You'll connect to the application using your 17 + [internet handle](https://internethandle.org/) (aka. atproto identity, also 18 + known as bluesky account). 19 + 20 + All the data you'll produce will be stored on your 21 + [PDS](https://atproto.com/guides/data-repos) (Personal Data Server). When you 22 + create a challenge, create tests cases, solutions, etc. everything is stored 23 + on your PDS by default (you can store it privately on the platform, but this 24 + is opt-in by design). The problems you'll write solutions for will be stored 25 + on your PDS by default as well. 26 + 27 + The goal is to allow users to own their data, be able to change platforms as 28 + they see fit, even after the project dies. As long as their account exists 29 + on *THEIR* PDS, they can access their data and continue using it. For the 30 + moment, we wont permit the creation of new accounts on this app, users will have 31 + to create it on any other platform on the atmosphere (as it requires more 32 + unesserary deployment complexity). I want to have the platform as open as 33 + possible. The user with just have to log in with their handle/did, complete 34 + the OAuth flow with their PDS, and then they can start using the platform 35 + without having to create an account on this platform. 36 + 37 + 38 + ## data / lexicon 39 + 40 + This is a draft, but we could imagine the collections: 41 + ```mermaid 42 + %%{init: {'theme': 'default', 'themeVariables': {'fontFamily': 'monospace'}}}%% 43 + 44 + erDiagram 45 + 46 + User["com.example.user (user's PDS)"] { 47 + string did "DID" 48 + string handle "e.g. alice.bsky.social" 49 + blob avatar "profile picture" 50 + } 51 + 52 + Problem["com.example.problem (creator's PDS)"] { 53 + string rkey "TID" 54 + string title "" 55 + string description "markdown body" 56 + string difficulty "easy | medium | hard" 57 + string_array tags "e.g. dp, graphs" 58 + string_array supportedLangs "python, js, rust, etc." 59 + blob starterCode "optional" 60 + datetime createdAt "" 61 + } 62 + 63 + TestCase["com.example.testcase (creator's PDS)"] { 64 + string rkey "TID" 65 + at_uri problem "-> problem" 66 + string input "" 67 + string expected "" 68 + bool hidden "hidden from solvers" 69 + } 70 + 71 + Solution["com.example.solution (solver's PDS)"] { 72 + string rkey "TID" 73 + at_uri problem "-> problem (cross-PDS)" 74 + string lang "language used" 75 + blob code "solution source" 76 + datetime submittedAt "" 77 + } 78 + 79 + ExecutionResult["execution_results (centralized DB)"] { 80 + uuid id "" 81 + string solutionUri "at:// of solution" 82 + int runtimeMs "" 83 + int memoryKb "" 84 + int passedTests "" 85 + int totalTests "" 86 + jsonb perTestResults "per-test breakdown" 87 + timestamp executedAt "" 88 + } 89 + 90 + User ||--o{ Problem : "creates" 91 + User ||--o{ Solution : "submits" 92 + Problem ||--o{ TestCase : "has" 93 + Problem ||--o{ Solution : "solved by" 94 + Solution ||--o{ ExecutionResult : "produces" 95 + ``` 96 + 97 + 98 + ## stack + deployment strategy 99 + 100 + The app was planned to be a Golang + SvelteKit app deployed on Cloudflare 101 + workers, but because of too many issues with the Go app compiled to WASM 102 + on the workers runtime, I decided to switch to a full-stack app using 103 + [Tanstack Start](https://tanstack.com/start/latest) + [Solid](https://www.solidjs.com/). 104 + 105 + The app is going to be deployed automatically on Cloudflare workers by a 106 + Continuous Integration & Deployment [pipeline](./.github/workflows/frontend.yml) 107 + using GitHub Actions, with decentralized data ownership using [ATProto](https://atproto.com/) 108 + and a [Cloudflare D1](https://developers.cloudflare.com/d1/) database for 109 + storing data alongside that won't be stored on the atmosphere. The deployment 110 + and database both will be deployed on serverless technologies because of its 111 + deployment as code strategy and near-zero cost for early projects such as this 112 + one. 113 + 114 + For the text editor, I'll probably go with a [Monaco Editor](https://microsoft.github.io/monaco-editor/). 115 + running on the client-side (maybe integrating local WASM lsps later), and will 116 + use an external service dedicated to executing the code in a containerized, 117 + reproducible environment. Some examples may include [sprites.dev](https://sprites.dev/) 118 + and [judge0](https://judge0.com) or even a custom solution with Docker. 119 + 120 + 121 + ## development environment 122 + 123 + I setuped a reproducible development environment using a [Nix](https://nixos.org/) 124 + flake. The whole project uses the [pnpm](https://pnpm.io/) package manager, 125 + and uses [Typescript](https://www.typescriptlang.org/) everywhere. It uses 126 + [Tanstack Start](https://tanstack.com/start/latest/), [Solid](https://www.solidjs.com/), 127 + [Tailwind](https://tailwindcss.com/). I will use [Prisma](https://www.prisma.io/) 128 + as a database ORM, alongside [Tanstack Query](https://tanstack.com/query/latest/), 129 + and the [@atcute](https://github.com/mary-ext/atcute) atproto tools ecosystem 130 + (OAuth, Lexicons, etc.). 131 + 132 + 133 + ## acknowledgements 134 + 135 + Code competitive platforms: 136 + - [codewars](https://www.codewars.com/) 137 + - [leetcode](https://leetcode.com/) (more data-structure focused) 138 + - [codingame](https://www.codingame.com/) (more game-focused) 139 + 140 + ATProto apps using decentralized ATProto data ownership: 141 + - [bluesky](https://bsky.app/) 142 + - [tangled](https://tangled.org/) 143 + - [margin](https://margin.at/) 144 + 145 + To be fair, this project is both because I wanted a platform like that where I 146 + could easily create dump contests with my friends, but I also really wanted to 147 + hack on the atmosphere :)