DEV Community

Cover image for Appwrite x DEV Hackathon Help Thread
dev.to staff for The DEV Team

Posted on

Appwrite x DEV Hackathon Help Thread

**If you're participating in the Appwrite x DEV hackathon and you need some help with your submission, you've come to the right place!

If you have any questions about how this contest works (ex: due dates, how to post your submission, picking a category, etc.) the DEV team will be happy to assist you.

If you are running into issues or get stuck when it comes to Appwrite's self-hosted backend-as-a-service platform, please leave those questions here as well.

Comment below if you need asynchronous assistance with the Appwrite x DEV Hackathon ❤️

P.S. If you'd like to share an update on the progress you're making on your project or if you'd like to connect with other participants, please do so in the community discussion thread!

Top comments (149)

Collapse
 
georgeisiguzo profile image
Georgie

"Projects under this category should make use of user-generated content on the internet in some way"

Please can someone elaborate on this a little.

Collapse
 
moose_said profile image
Mostafa Said

Hello @georgeisiguzo! in simple English , user-generated content is where a user can generate content on the internet. For example when the user is able to publish an article, upload a picture, submit a tweet, write a review ...etc

Collapse
 
terieyenike profile image
teri

I built an income tracker where the user is able to write on the input field, submit their data, edit and update the document, as well as delete the document. Does this qualify it under the category for user-generated content?

Thread Thread
 
moose_said profile image
Mostafa Said

I think so, I'm not sure. According to my understanding, a user-generated content is where a user is able to generate content for others to see not himself. But this is how I understand the concept I'm not sure if that's the right definition. Anyway, Best of luck and well done on your project, It's actually a great idea!

Thread Thread
 
terieyenike profile image
teri

Thank you, Mostafa

Collapse
 
georgeisiguzo profile image
Georgie

Thanks @moose_said

So this means on the app I create, the users should be able to create (or generate) content right?

Thanks again

Thread Thread
 
moose_said profile image
Mostafa Said

I believe so yes. You're most welcome :)

Collapse
 
ridays2001 profile image
Riday

Hello,
I have the same doubt. Can someone please explain what that means? Or give some examples?

Thanks!

Collapse
 
mshajid profile image
mshajid

Yes, I need to get an understanding of that, or maybe, if it's necessary keep spaces for user inputs.,

Collapse
 
jacksonkasi profile image
Jackson Kasi

Can I host appwrite in Azure?

Collapse
 
torstendittmann profile image
Torsten Dittmann

Yes! You can use Azure Virtual Machines :)

Collapse
 
tessamero profile image
Tessa Mero

in case anyone runs into this thread, here's an update for azure and appwrite techcommunity.microsoft.com/t5/app...

Collapse
 
jacksonkasi profile image
Jackson Kasi

You're welcome! But this reply is after such a long day. 😄☕️

Collapse
 
adityaoberai profile image
Aditya Oberai

Hey Jackson
A Standard_B2s VM on Azure is more than enough to get you running Appwrite for yourself. I've tried this one in the past and it works well 😁

Collapse
 
jacksonkasi profile image
Jackson Kasi

really thanks :)

Collapse
 
elsa profile image
Elsa

please tell me, how can do it?

Thread Thread
 
adityaoberai profile image
Aditya Oberai

Can you please let me know till what step you're comfortable? Are you able to create a VM or not?

Thread Thread
 
elsa profile image
Elsa

I can create vm. but how to install appwite in ubuntu vm?

Thread Thread
 
elsa profile image
Elsa

I can create VM on azure (windows vm or ubuntu vm). but how to install for production level or scalable or maintainable.

Thread Thread
 
adityaoberai profile image
Aditya Oberai

Once you create an Ubuntu VM, go ahead and install the Docker CLI.

Once that is done, you can install Appwrite on your system by running the following command in your terminal:

docker run -it --rm \
    --volume /var/run/docker.sock:/var/run/docker.sock \
    --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \
    --entrypoint="install" \
    appwrite/appwrite:0.13.4
Enter fullscreen mode Exit fullscreen mode
Thread Thread
 
elsa profile image
Elsa

really thanks :) ♥

Collapse
 
tqbit profile image
tq-bit • Edited

Hello guys,

I'm struggling with Appwrite indexes. Here's my use case:

  • I have a database table with three columns: id, username and is_public
  • I would like to use the Web SDK to query:
    • All items from a single user (username = user.name)
    • AND only items of this user that were made public (is_public = true)

For this, I tried to create a search index. I tried a few names:

  • is_public-username <- Received error message in the browser's console: AppwriteException: Index not found: user_id,is_public - Link to image
  • is_public,username <- Does not qualify as a valid index key - Link to image
  • Any other index name I tried would not work
  • If I only try and query for a single column, everything works as I would expect it. - Link to image

Here's the part of the FE code that I use to specify the query:

const response = await appwriteClient.database.listDocuments(
        RECIPES_COLLECTION_ID,
        [Query.equal('user_id', userId), Query.equal('is_public', true)]
);
Enter fullscreen mode Exit fullscreen mode

Unfortunatly, I could not find any explanation on what I could do. So my question is:

  • What name must I give my search index to consider both query parameters using the web SDK?
  • Am I doing something wrong about the query building? I tried and follow the explanations on indexes and query building with no success
Collapse
 
gewenyu99 profile image
Vincent Ge • Edited

Hi, you were reaaallllly close to getting it right. The issue you were having with is_public,username <- Does not qualify as a valid index key - Link to image is that you had a comma in the Index Key. We don't allow commas in the name of an index because that really messes with parsing SQL :P

For example, this is from my project, patina-bot

await database.listDocuments("memedex", [sdk.Query.equal("user_id", msg.author.id), sdk.Query.equal("meme_name", memeName)]);
Enter fullscreen mode Exit fullscreen mode

Here's how I would create a two column index:

image

Collapse
 
gewenyu99 profile image
Vincent Ge

And here's what the created index looks like

image

Thread Thread
 
tqbit profile image
tq-bit

thank you so much for your reply. Works like a charm now 🥳

Collapse
 
ridays2001 profile image
Riday

Hello Appwrite team,
Are we allowed to do the hackathon in a team? I would love to work on this with my best friend.

Also, for the rewards and swag, will both the members receive the swag (stickers and tee-shirt)? Or only one?

Thanks in advance!

Collapse
 
adityaoberai profile image
Aditya Oberai

Hi Riday
Yes, all team members will be eligible for swags.

Collapse
 
ridays2001 profile image
Riday

Thank you so much for the reply!

Collapse
 
moose_said profile image
Mostafa Said

I believe you can but Dev Community will not distribute the prize. If you win, they will give the prize to the one who submitted the project.

Collapse
 
smppatel99999 profile image
Sahil Patel

Hey there, when I execute the cloud function I get this error. There is only a simple console log in index js file.

TypeError: userFunction is not a function
at /usr/local/src/server.js:38:19
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Collapse
 
gewenyu99 profile image
Vincent Ge

Do you mind providing me the code you've deployed? I can take a look :D

Collapse
 
smppatel99999 profile image
Sahil Patel

It is just a simple console,log("Hello there").

Thread Thread
 
gewenyu99 profile image
Vincent Ge

Did you call res.json() or res.send()?

Did you generate the function and deploy via the CLI or through a compressed file?

Thread Thread
 
smppatel99999 profile image
Sahil Patel

I tried another example from 30days of appwrite and also from the Appwrite docs. But no luck.

Yes I did generate it and deployed using compressed file on the Appwrite console. And executed as well from there. Yes I did do res.json() and res.send().

Thread Thread
 
gewenyu99 profile image
Vincent Ge

That's strange 🤔

If the generated example from the CLI worked fine, then it isn't anything wrong with the deployment or executor.

Are you calling the code in a file outside index.js? Where and how is userFunction defined?

If you want to get quicker responses, I recommend you join our Discord and tag me in your questions @VincentGe

Collapse
 
georgeisiguzo profile image
Georgie

Hi everyone! Please I need help.

I'm using an express API to avoid CORS issues. How can I implement session management from the server.

doing sdk.account.createsession(...) doesn't manage session across frontend pages

Thanks.

Collapse
 
gewenyu99 profile image
Vincent Ge

Hi there, if you're trying to solve CORS issues, add a relevant web platform. We block all cross domain request by default for security, but you can add as many allowed web platforms as you wish.

The Server SDK isn't really meant to be used with end user sessions, they're under an Admin scope. I would just resolve CORS issues and use a frontend SDK :D

Reference => dev.to/appwrite/30daysofappwrite-y...

Collapse
 
georgeisiguzo profile image
Georgie

Thanks. I was using Gitpod and even though I added web platforms to my project, I still get CORS issues.

I'm using digital Ocean now and its working fine

Thread Thread
 
gewenyu99 profile image
Vincent Ge

This might be something specific to the way Gitpod routes their requests... But it should work still.

Have you seen Appwrite + Gitpod in this guide? gitpod.io/guides/appwrite-and-gitpod

Thread Thread
 
asaoluelijah profile image
Asaolu Elijah 🧙‍♂️

I was having the same cors issue (with Gitpod), however, changing the host name from the default http to httpsfixed the issue for me.

Collapse
 
mrbuddesigner profile image
Mr. Bud

Hey there, everyone! Hope all of you're doing great on the hackathon.

I'm having a little problem with using Avatars API in Python, I'm using this code to get a favicon for a website but have no idea where the image is stored or ready to view.

from appwrite.client import Client
from appwrite.services.locale import Locale
from appwrite.services.avatars import Avatars
client = Client()

(client
  .set_endpoint('http://localhost:80/v1') # Your API Endpoint
  .set_project('62583fb9e3****') # Your project ID
  .set_key('hey-is-correct') # Your secret API key
)
avatars = Avatars(client)
result = avatars.get_favicon('https://reddit.com')
print(result)
Enter fullscreen mode Exit fullscreen mode

Any idea on that? Thanks!

Collapse
 
gewenyu99 profile image
Vincent Ge

The file returned to result is a binary of the image. You can write this to a string or a buffer to save the image.

Try this:

from appwrite.client import Client
from appwrite.services.avatars import Avatars

client = Client()

(client
 .set_endpoint(<your endpoint>)  # Your API Endpoint
 .set_project(<your project>)  # Your project ID
 .set_key(<your key>)

avatars = Avatars(client)

result = avatars.get_favicon('https://reddit.com')
f = open("reddit.png", "wb")
f.write(result)
f.close()

Enter fullscreen mode Exit fullscreen mode
Collapse
 
mrbuddesigner profile image
Mr. Bud

it works! Thank you.

Collapse
 
gewenyu99 profile image
Vincent Ge

To participate, your projects can be as complex or as simple as you feel comfortable with. We encourage you to build what ever you have the time/knowledge to build. If you're out for the prizes, you might want to do something more novel or cool to catch the judges eyes ;)

Collapse
 
elreyes profile image
Fabian Reyes

Is it possible to participate with the same application developed for mobile and web in different categories? i.e.:

  • BOT" application made with Web Technologies and apply in Web2 Wizards.
  • Application "BOT" made in Flutter and apply in Mobile Moguls

thanks !

Collapse
 
devencourt profile image
Brian Bethencourt

Hey Fabian! When it comes to submitting to multiple categories, we will decide a category for you when it comes time for judging. Typically based on whichever category your project fits best into.

Collapse
 
loicgeek profile image
ngou loic

Hello, I am building my project with appwrite, Can I query database in a cloud function? I keep getting "execution timeout" error.

 const { parcel_title,parcel_id,amount,username} = data;
  const notifTitle = `New offer  for "${parcel_title}"`;
  const notifBody = `${username} offered ${amount}XAF to carry "${parcel_title}"`;


  let parcelPromise = database.getDocument(parcelsCollectionId,parcel_id);


  parcelPromise.then(function (parcel) {
    let userPromise = database.getDocument(usersCollectionId,parcel.sender_id);

    ```


Enter fullscreen mode Exit fullscreen mode