Back

Should all actions be as cloud function ?

  • 0
  • Flutter
  • Tools
  • General
  • Databases
  • Self Hosted
Suiii
18 Mar, 2024, 03:10

I will have web app by using nextjs. also, creating mobile app by using flutter. i know nextjs provides server action which has similers to the cloud function.

TL;DR
Developers are discussing whether it's best to use cloud functions for all actions to streamline maintenance and handle multiple use cases efficiently, similar to API routes. It's suggested to use a combination of Appwrite functions and Next backend for a serverless approach. The advantage of functions lies in a serverless approach. For their NextJS and Flutter client app, the choice between cloud functions and NextJS actions depends on the project's needs.
Suiii
18 Mar, 2024, 03:10

so my question is should I create cloud function for all actions

Suiii
18 Mar, 2024, 03:10

then calling them from nextjs and flutter

Binyamin
18 Mar, 2024, 03:10

Okay? If so you can use them instead of the function it should work just fine

Binyamin
18 Mar, 2024, 03:11

You don't need to Appwrite functions when you have the next backend

Binyamin
18 Mar, 2024, 03:11

The advantage to use the function is when you're approaching more in a serverless approach.

Binyamin
18 Mar, 2024, 03:11

The best would be to mix them both.

Suiii
18 Mar, 2024, 03:11

can you elaborate it.

Binyamin
18 Mar, 2024, 03:11

I'll try

Suiii
18 Mar, 2024, 03:12

i just think. if I can just create one projects, then deploy all functions to appwrite cloud function

Suiii
18 Mar, 2024, 03:12

then i only concern connecting to appwrite instead of depending on next server

Binyamin
18 Mar, 2024, 03:12

If you're using next, then, it mean you've your application logic enclosed inside the next backend. Then it doesn't make sense to have them both, a deployed next backend and appwrite functions.

Binyamin
18 Mar, 2024, 03:13

Yes, this a good approach

Binyamin
18 Mar, 2024, 03:13

And this is actually how Appwrite is meant to be used.

Suiii
18 Mar, 2024, 03:16

correct me if i am wrong. one cloud function is just like one project . is there way i create one project having multiple function liek this,

Binyamin
18 Mar, 2024, 03:19

One function is one deployment But you can handle multiple use-case inside one function

Binyamin
18 Mar, 2024, 03:20

For example

Binyamin
18 Mar, 2024, 03:21
Binyamin
18 Mar, 2024, 03:21

This function use an internal Hono router for handling multiple use-case inside one function.

Suiii
18 Mar, 2024, 03:22

this is nice. yes. something like this. just one deployment for multiple use case or similer to api routes

Binyamin
18 Mar, 2024, 03:23

Exactly

Binyamin
18 Mar, 2024, 03:23

That way your function can be a backend for your entire project.

Binyamin
18 Mar, 2024, 03:24

Last thing You can make your function handle many use-cases in other ways, also by parsing an action variable for example

Suiii
18 Mar, 2024, 03:26

yes. thats nice. I plan that for one function deployment. then handle all usecase. then flutter and nextjs connecting directly to that function

Suiii
18 Mar, 2024, 03:26

it will be easy to maintain

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more