A React-Native sample application that uses FaunaDB serverless architecture.
FaunaDB is a very powerful database-as-a-service that offers functionalities that allows you to create an app without needing to have a backend, you won't need to build an AWS infrastructure or something similar, you just need FaunaDB.
This are some reasons you might want to have a lambda function (or cloudflare worder or whatever you want) on the side.
- EMAILS, when needing to do things like veriying user's email address or sending a forgot password code.
- Notifications, when you want to send some kind of notification (or a combination of such) like Push notification and WebSocket.
- Copy
.env.example
to.env
. - Create a database.
- Generate another key with role
GuestRules
-- toguestToken
in the.env
file. - Upload the
fauna/schema.graphql
on the dashboard -- this will create the collections and the graphql queries. - Run commands on
.fql
files infauna/resources
by copy-pasting them on the dashboard -- there is a tool for managing migrations but it doesn't work nicely with graphql fauna-labs/fauna-schema-migrate#49 - Manually create a new user, see command below -- Because I did not implement a register, you can use the Guest role to be able to do that similar to login.
- Run
yarn && cd ios && pod install && cd .. && yarn start
- Run the app in your emulator or device.
Create first user
Create(
Collection("User"),
{
data: {
email: "test@email.com",
name: "Test 1"
},
credentials: {
password: "password"
}
}
);