1# Fanfics on AtProto 2 3Links: 4- [Background](#background) 5- [Infrastructure](#infrastructure) 6 - [Notes](#notes) 7 - [Structure](#structure) 8- [Contributing](#contributing) 9- [Support](#support) 10 11> [!WARNING] 12> This is alpha software, there's no guarantee that this will work on your system. But if you'd like to try hacking at this, take a look at the [Contributing](#contributing) section once instructions are written up. 13 14## Background 15 16This was an idea that sparked off a great discussion around decentralizing archives for fanfics and fan works. What if we could have archives that: 17 181. ... are censorship resistant, 192. ... are easy (and CHEAP) to host, 203. ... are easy to configure and extend, 214. ... have moderation tools built-in, 225. ... give users on both sides (authors AND readers) more ownership over their data, 236. ... AND have a cool sixth thing here! 24 25I'm setting out to explore these questions by building a prototype of a fanfic archive on Astro and AtProto. 26 27## Infrastructure 28 29### Notes 30 31AtProto, to my understanding, is made of multiple layers. There's: 32 331. The client (the actual site that displays data) 342. The PDS (the server that stores user's data) 353. The AppView (the thing that grabs only relevant data and serves as an API) 364. The Lexicon (the blueprint for data to be used in AppViews and clients) 37 38... And probably more, and there's a lot of discussion around how user data ownership / censorship / etc gets handled on those layers. 39 40In our case, we'll only worry about making the client and then get drafts of the lexicons from the community later. 41 42Currently, I'm using these technologies: 43 44- Astro 45- Drizzle ORM (via Astro DB) 46 - Turso (LibSQL under the hood) 47- Unstorage (via [@fujocoded/authproto](https://github.com/FujoWebDev/fujocoded-plugins/tree/main/astro-authproto)) 48 49Mainly because: 1, Astro is a really well-documented web framework that's pretty approachable as someone who used to handwrite HTML pages; 2, SQLite / LibSQL are (to my knowledge) fairly cheap databases to run; and 3, Unstorage is pretty dead simple for setting up auth sessions from scratch. 50 51### Structure 52 53#### Database: `db` 54 55This holds all the relevant database code. This also contains the structure and types for database tables. 56 57#### Actions: `src/actions` 58 59These hold actions that run every time a user wants to publish a new work or signs up for the archive. Basically the backend functionality for this project. 60 61#### Assets: `src/assets` 62 63This has images / libre font / `.css` files to be used stylistically throughout the site. 64 65#### Components: `src/components` 66 67These hold components that are reused throughout `src/pages`. Like PHP includes but in HTML and JavaScript (well, technically it's JSX). 68 69#### Pages: `src/pages` 70 71These are the actual routes that are available to end-users. Under the pages are nested pages grouped under folders, namely: 72 73##### Users: `src/pages/users` 74 75These are pages where users can view all user profiles, find a specific user profile, or update their account settings. 76 77##### Works: `src/pages/works` 78 79These only hold pages that are relevant to adding, editing, deleting, or viewing works. 80 81## Contributing 82 83The instructions may change in the future in case the development workflow changes. Please feel free to [report an issue](/issues) if you come across any during development or building. 84 85### Prerequisites 86 87- Git 88- Node.js 89 - `v18.20.8` or `v20.3.0`, `v22.0.0` or higher. (`v19` and `v21` are not supported.) 90- `npm` or similar package manager 91 92> [!IMPORTANT] 93> Running this with `deno` does not work. You'll get an "Unsupported key curve for this operation" error when running the project and testing OAuth. See [this issue](https://github.com/panva/jose/discussions/740). 94 95### Instructions 96 971. Clone the repo to your system using the following command: 98```bash 99git clone https://github.com/haetae-bit/fanfic-atproto 100``` 1012. Use whatever runtime you use to install packages: 102```bash 103npm install 104``` 1053. To run the development server, use this command: 106```bash 107npm run dev 108``` 109 110## Support 111 112If you want to support me making making this, please feel free to donate a coffee. 113 114<a href="https://buymeacoffee.com/haetae" target="_blank" referrerpolicy="no-referrer"> 115 <img src="https://cdn.buymeacoffee.com/buttons/default-blue.png" alt="buy me a coffee" /> 116</a>