v3 RFC: Remove request handling APIs #1287
Replies: 6 comments 18 replies
|
Say that one of frameworks has a breaking change that breaks existing Lucia API... How would the users know that they need to update their Lucia code (which they copy pasted)? Normally, you would notice this when updating to a new major release of Lucia in the release notes. Should they regularly try to skim through the code in the docs (which they initially copy pasted) and compare with their actual code to see if there are any differences? This feels brittle! To clarify, reducing the scope of Lucia to not cover request handling at all is one thing and that might be good (I don't think so) but that is a separate discussion. But personally, I think moving request handling APIs from semantically versioned code - to code that just lives as snippets that you should copy paste in the docs is not a good idea. I would rather migrate to new major versions of Lucia (especially if the migration is easy, compare svelte 3 to svelte 4) more often than instead staying on the same major version of Lucia but having to deal with and keep track of breaking changes manually. Also - releasing major versions often is not inherently a bad thing I think? How often have breaking changes in frameworks forced Lucia to update in the past? Is this a big problem? |
We need a CLI similar to shadcn/ui |
|
The middlewares should be split into separate packages and maintained by Lucia. Consider the following:
If the issue being addressed is that any breaking changes will require a major version update, I think that breaking everything into packages that can be updated granularly is the way to go. AuthRequest hasn't caused me any DX headaches yet, and if the DX is good, then it should probably remain. I use Lucia because it makes auth easy. |
|
I would go with whatever you think is best. I wouldn't assume to be smarter than you. I think you spent a lot more time thinking about it, so I trust your judgement. I don't mind having to copy paste a few lines of code instead of importing from lib. I see the point. I desire to have as much flexibility as possible and so far in line with you with v3 approach. |
|
Yeah I'm going with this change. If people really don't like it, we can always create |
|
@pilcrowonpaper where exactly should I add the nextjs app route example? Should I call this function on every server component / api route I use that is protected? |
Uh oh!
There was an error while loading. Please reload this page.
Supersedes #1284.
I'm considering removing middleware and
AuthRequestas a whole. The big issue is dependencies. If one of the frameworks has a breaking change that breaks existing Lucia API, we would have to introduce a new major version, even if 99% of the code stays the same. We can separate them into their own packages, but it's at most 50 lines of code. And most of them are just simple if checks. Is it really worth it to maintain 10 more packages? Wouldn't it be easier to just let people copy-paste what's in the docs?If we go with this change, you'd have to copy-paste < 50 lines of boilerplate code from the getting started guide. For example, Astro users would have to just add the middleware below. It's just some CSRF checks and validating cookies. It's really hard for me to justify building a separate package just for this.
I am very torn on this so I'd love to hear your thoughts.
Examples
SvelteKit
Nuxt
Next.js Pages router
Next.js App Router
All reactions