Day 1 has concluded with the announcement of improved SSR (Server-Side Rendering) support within Appwrite. Traditionally, Appwrite has been optimized for use in CSR (Client-Side Rendering) applications and webpages. With the next release, you’ll be able to authenticate directly from the backend and pass a cookie back to the user.
Below is examples of the current CSR implementation and the new addition to optimize for SSR.
Current CSR Implementation
account.createEmailPasswordSession('[email]', '[password]');
const user = await account.get();
SSR Alternative
// Request data
const { email, password } = await request.json();
const session = await account.createEmailPasswordSession(email, password);
// Set cookie for response
cookies().set('my-session-cookie', session.secret);
// Redirect user
return Response.redirect('/api/user');
Historically, it was sort-of possible to implement SSR with some questionable workarounds. I feel like this improvement was low-hanging fruit for the Appwrite team to implement, making the lives of SSR developers much easier.
I’m already preparing to use this in future content. I’m a big fan of NestJS, and I’ll be using this alongside messaging in a v1.5 Appwrite & NestJS article I’m currently preparing.
Get Started
As with messaging, the SSR changes aren’t quite available yet. However, if you’re eager, you can checkout Dennis Ivy’s product Tour (see below) to get yourself better prepared for the release. It’s been mentioned that v1.5 will be released sometime in march on cloud and self-hosted platforms.
Discord Event highlights
Appwrite’s Discord events have been jam-packed with information, ideas and opportunities to win swag (One more spin! @adityaoberai1 !). I’ve got notes on yesterdays Discord stage. Later on in the week I will be releasing an article on the highlights from each event. Don’t miss out on the upcoming events!
Conclusion
It’s only day two (well, one if you count like a developer), and Appwrite has already knocked it out of the park. I’ve been doing some snooping around Appwrite’s underlying libraries to see what else might be coming in v1.5 (Easier payments, chats…?). Yet to see my prediction of 2FA come to light, but perhaps that’s still on the cards (Come on @eldadfux, do the thing!).
I would’ve liked to have seen more examples where SSR optimization in the admin API has been made. It’s early days yet, so documentation changes could still be made.
The hype and support surrounding Init and Appwrite have been awesome. Keep it up! I’d love to hear if you’re going to convert to SSR or stick with CSR projects. Let me know over on Twitter/X or in the comments below.
As always, stay tuned, as I will be releasing articles all week covering Appwrite’s announcements.