friendship ended with social-app. php is my new best friend
1# smallbird social 2 3i'm sure you have a question and that the question is this: 4 5## why would you do this. 6 7to test my abilities. 8 9also, for some reason social-app's dependency install situation is fucked for me and rather than try and fight node's gdawful ecosystem i decided to just see how much i could accomplish in php with as few dependencies as possible and as little javascript as possible because i'm so fucking tired of dependency chaining where i'm instaling 80384498549320934 packages and don't know what 90% are. 10 11i also just think it's funny to write things in php in this day and age. 12 13similarly to [red dwarf](https://reddwarf.whey.party/), my approach is to try and use data from outside the core bsky servers as much as possible (so, getting DID info directly from their DNS/.well-known, pulling info from plc.directory and constellation, etc) to reduce reliance on a singular entity. you can set a default fallback public API to try and resolve information; by default it's set to the bsky api. if another public API comes into being i might switch it to that. 14 15## is it going to have [x] feature 16 17maybe! i'm not sure if i can or will go for 100% feature parity but i'm going to try my darndest 18 19the idea is 20 21* no javascript components just straight vanilla javascript (except the compilation tools) 22* only the javascript required to load new posts and set settings 23* use as much native html functionality as possible (popovers, details/summary) 24* work around the central bsky servers whenever possible 25* keep it runnable on a potato 26* maintain admin flexibility with respect to data sources and themeing 27 28## tdl 29 30* [X] Move profile rendering to bskyRenderer lib file (and also fix the rendering) 31* [X] Unmove profile rendering and then move it to template files 32* [X] Implement feeds page (still dependent on bsky) 33* [X] Implement search (still dependent on bsky) 34* [ ] Make settings page??? 35* [ ] Create account page 36* [X] Hashtag feed page (still dependent on bsky) 37* [ ] Move interaction stuff to the renderer 38* [X] Apply facets to text 39* [X] Templating engine?? 40* [ ] Make login page actually work 41* [X] Figure out how to do threading (never mind threading sucks) 42* [ ] User authentication (:C) 43* [ ] Fetch next set of items when user hits bottom of container 44* [ ] ?? how to get following count ?? 45* [ ] Make the interaction buttons work 46* [ ] Posting box 47* [X] Figure out how to run Constellation server despite build time for rocksdb being FOREVER 48* [ ] More color themes? (i have priorities) 49* [X] Figure out why pages cut off loading halfway (why) 50* [ ] Find out how to implement a better concurrency version of sqlite 51* [ ] Add more exception handlers so it 500 errors less 52 53## thanks to 54 55* [pdsls.dev](https://pdsls.dev) for helping me figure out what API endpoints to call from the network tab 56* [constellation](https://constellation.microcosm.blue) and [slingshot](https://slingshot.microcosm.blue) for a lot of data fetching to reduce load on PDS + dependence on bsky.app 57* [plc.directory](https://plc.directory) and [plc.parakeet.at](https://plc.parakeet.at) for plc lookups 58* [red dwarf](https://reddwarf.whey.party) for being inspirational (and *also* helping me figure out what API endpoints to call) 59* [bailey townsend]() because i stared at your rust oauth code for several hours trying to divine how to make PHP work. thank you 60 61## dependencies 62 63* guzzle (for http requests) 64* monolog (for logging; mostly just a dev thing) 65* flight (for routing) 66* latte (for templating) 67* opengraph (for what you'd expect) 68* php-oauth (also for what you'd expect) 69 70## suppose i am someone who wanted to install this 71 72ok wowee!! just so you know this isn't fully cooked yet so there's a lot of features missing. there's a lot of stuff that goes into one of these things as it turns out. but if you really want to: 73 74- edit the values in config.php. if you don't have a pds you're willing to let people sign up with or don't have a favorite (or don't know what that is) just leave it set as-is. you'll need to graph the atURIs of feeds to use for your frontpage/favorite feeds area; you can look those up using [pdsls.dev](https://pdsls.dev). 75- copy .env.example to .env and add your secret values to it. 76- copy the files in the data folder and remove the .example suffix. these are for globally banning/suspending people at the client level (e.g. if you just don't want anyone to be able to see j*sse s*ngal on your client). 77- get [composer](https://getcomposer.org) if you don't have it and then do `composer install` in the folder 78- install a javascript runtime if you don't have one (e.g. [node.js](https://nodejs.org), [bun](https://bun.sh), [deno](https://deno.com)) and a package manager if you're using regular node.js (e.g. [npm](https://npmjs.com), [pnpm](https://pnpm.io/), [yarn](https://yarnpkg.com/)) and then do `[runtime/pkg manager] vite build` to build the files. (you can also run `[runtime/pkg manager] vite dev` if you want to run a local server to check it out.) 79- make a `jwks.json` file (can generate one [here](https://jwkset.com/generate); use ECDSA, ES256, and Signature as your options. delete the "d" key from the file before using) and put it in your root folder. 80 81if you want the pretty urls you will want to run this on a server with rewrites, configure them, and set that to "on" in your config. it's not required! i feel like the ugly urls are part of the charm honestly 82 83## i think this is neat and i want to give you money 84 85my ko-fi is [here](https://ko-fi.com/veryroundbird) and if you have, like, real jobs definitely [hit me up](mailto:carly@veryroundbird.house)