Skip to content

Conversation

@IMB11
Copy link
Member

@IMB11 IMB11 commented Nov 1, 2025

  • Base structure of the package
  • Move projects v2/v3 stuff from utils to package as an example
  • Create DI provider for the nuxt client singleton
  • Modify projects pages (app + web) to use new package.

@IMB11 IMB11 requested a review from Prospector November 1, 2025 14:49
@IMB11 IMB11 added website Relates to Modrinth.com web frontend app Relates to Modrinth App frontend Involves work from the frontend team dev-ex Improvements to developer experience labels Nov 1, 2025
@IMB11 IMB11 marked this pull request as draft November 1, 2025 19:03
@IMB11 IMB11 marked this pull request as ready for review November 7, 2025 08:32
@IMB11
Copy link
Member Author

IMB11 commented Nov 7, 2025

We will figure out publishing at a later date.

Copy link
Member

@Prospector Prospector left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall, quite cool but quite concerned that the tauri implementation is not doing what we want

* Nuxt-specific configuration
*/
export interface NuxtClientConfig extends ClientConfig {
// TODO: do we want to provide this for tauri+base as well? its not used on app
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a config, sure I don't see why not, since it is something the API supports. if we ever build another server-side JS-based application, it could be used. but yeah, can't use a ratelimit key for the app since it'd be client-side

@@ -0,0 +1,115 @@
export type Environment = 'required' | 'optional' | 'unsupported' | 'unknown'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if a better way to organize these types would be hierarchical? I noticed it's weird how we have like ProjectV2, etc. for some things but other things are versionless.

Perhaps the export here should be like a V2Types block, with types within it? So to get a V2 project type you'd use LabrinthV2.Project ? This way I think you could also have some common types that are shared in another file and exported in both LabrinthV2 and LabrinthV3 if they are the same in both

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided to use the structure: Labrinth.V2.Project

protected async executeRequest<T>(url: string, options: RequestOptions): Promise<T> {
try {
// @ts-expect-error - $fetch is provided by Nuxt runtime
const response = await $fetch<T>(url, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe $fetch should be passed in to the client construction so we don't need to suppress this error?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will install nuxt types instead, or do what we do for the tauri platform, dynamic import.

}

// @ts-expect-error - import.meta is provided by Nuxt
if (import.meta.server && this.config.rateLimitKey) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, couldn't we pass whether it's client or server at construction/in config?

}

/**
* Tauri platform client using Tauri v2 HTTP plugin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im confused how this works. is this not just bypassing the whole tauri backend that does the caching and processing on the backend?

the way I envisioned this would work is we'd implement like a partial API client using the invoke functions when they exist, and if not then we fallback to making a simple web request (using user's auth and stuff). but web requests should be a fallback if it's not provided by the app backend.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mentioned on slack;

  • can enable caching via plugin config
  • we can still have invoke stuff for the routes that need it (i'll design a way for this to happen when we need to do it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Relates to Modrinth App dev-ex Improvements to developer experience frontend Involves work from the frontend team website Relates to Modrinth.com web frontend

Development

Successfully merging this pull request may close these issues.

3 participants