Skip to content
Rain edited this page Oct 21, 2023 · 25 revisions

BattleBit Remastered Modular API Website v2

These are notes about all the things we have to think about when doing v2.
From this list will spawn tasks and issues.
This is not a list of all the things the website will have, it's just considerations.

Framework

The framework must change for v2 since v1 is a hodgepodge of different technologies wildly thrown together.
Instead a central framework that does not fracture the website is required.

Next.js

Next.js (hopefully with the T3 Stack)

  • (+) combines backend and frontend
  • (+) has fullstack typesafety (via tRPC, therefore types are always synchronized)
  • (+) has lots of options for page optimization (SSG/SSR/ISG)
  • (+) has prebuilt Discord auth (via NextAuth or Lucia)
  • (+) has prebuilt Dockerfile
  • (-) a little more complex

Remix

Remix

  • (+) Server-side rendering (SSR) for improved performance and SEO.
  • (+) Tight integration with React for building dynamic web apps.
  • (+) Powerful routing system for declarative route definition.
  • (+) Data loading on both the server and client.
  • (+) Support for layout components for consistent page structure.
  • (+) Automatic code splitting for faster initial page load.
  • (+) Client-side navigation for smooth transitions between pages.
  • (+) Data fetching hooks like useEffect and useEffectAsync.
  • (+) Development server and tools for an enhanced developer experience.
  • (+) Support for static site generation (SSG) for even faster performance.
  • (-) Smaller community and ecosystem compared to some other frameworks (subjective).
  • (-) Learning curve for developers new to server-side rendering (SSR) concepts.

Hosting

  • Container on own server
    • super simple
    • combined frontend and backend
  • CF Pages
    • basically free
  • Vercel
    • basically free
  • AWS S3
  • Container on own server
    • super simple
    • combined frontend and backend
  • k8s on own server (maybe via k3s)
  • Container on cloud (maybe via AWS Fargate)
  • k8s on cloud (maybe via GCP or AWS)
  • CF Workers
    • need application-level adjustments
    • basically free
  • AWS Lambda (via SST)
    • need application-level adjustments
    • basically free
  • Vercel runtimes
    • probably free

Features

More: https://github.com/orgs/BattleBit-Community-Servers/projects/3/views/1?query=is%3Aopen+sort%3Aupdated-desc

General

  • pnpm (npm is slow…)
  • Swap to Lucia instead of NextAuth
  • Module packs
    • Ability to link multiple modules together
    • Combined download as ZIP file
  • Better session store
  • Module tags
  • Better verification process
    • Uploading new versions when the old versions haven't been approved yet
      • Allow overwriting of versions? Conflicting with approval when uploading while approval is ongoing
      • Delete unapproved versions? May cause data loss from changelog.
    • Denying modules should require a reason, which is DMed to the author
    • Approving new versions should include changelog in discord message
    • In-website code preview/diff between last and new version
    • Binary (non nuget) dependencies still cause verification to fail, requiring manual compilation by the reviewer. DLL must be uploaded upon module approval so that other modules that depend on it do not fail verification because of missing DLLs
  • Admin tools
    • Deleting a user and all their associated data
    • Banning a user -> separate ban table only containing discord id, to comply with GDPR right to erasure
    • Deleting a specific version of a module
  • Module documentation as sections for splitting up autogenerated content (eg. methods/props/fields, configs, commands)
    • Fold/unfold sections
    • Automatic ToC
    • All autogenerated content should still be editable
    • Some way to re-autogenerate stuff for new versions but also to retain it
  • Proper link preview like this:
    image

Frontend

  • Download count
    • only for the creator and moderators
  • Current installation count from ModuleUsageStats no
  • Ability to star modules (like on GitHub)
    • Ping users for updates of their starred modules
  • "My modules" page
    • Also accessible by other users to see all modules of a specific author (eg. more modules by this author)
  • Fix link redirects to exclude the current domain
  • Modules list page
    • Put the page number in the URL
    • Improve search
    • Show total amount of modules
    • Better filters
    • Show modules in list instead of grid
      • maybe make this toggleable?
  • Show transitive dependencies
    • If A depends on B, and B depends on C, then A transitively depends on C
    • Walk whole dependency tree, list each dependency only once, merge optional and required of the same dependency into a single required
  • Download module with dependencies as ZIP file
    • Maybe Microsoft style with a list of checkboxes of dependencies
  • "Shopping Cart" sort of thing for downloading modules
    • Deduplicates modules
    • Any download must work with wget and have a click to copy link somewhere
  • Moderator comments/warnings for modules (eg. "Violates ToS" or "Users with permissions can run abritrary code")
  • Ability to show/view module code on website (maybe with diff too, like for verification)

Backend

Runner/Verification

  • Handle versions
    • When verifying, only use approved versions of dependencies
  • Nuget dependencies
    • Binary dependencies from nuget packages that automatically get installed for verification
    • Doesn't replace binary dependencies since there are still cases where custom DLLs are allowed
    • Runner should automatically install nugets for modules
  • Re-verification
    • Module updates should cause all modules that depend on the updated module to be re-verified against the latest version
    • Failures in specific modules should inform the uploader of the new version so they know about new incompatibilities of other modules
    • Failures in specific modules should inform the author of the depending module so they know about new incompatibilities of the new dependant module version
  • Installing modules from the runner
    • install MOTD downloads and installs MOTD and its required dependencies and lists optional dependencies
  • Autogenerate basic docs
    • Public fields, properties, methods, with their signatures
    • Configuration files, their scope and default values
    • Commands? -> not a fan of involving specific modules
    • Permissions? -> not a fan of involving specific modules, probably also not possible because they can be highly dynamic
  • Autogenerate basic warnings
    • IO access (eg. file access) -> adds tag/warning about the module accessing system resources
    • HTTP/Socket access -> adds tag/warning about the module accessing network resources