Meet your food buddy 😋
Sapi is an app for finding food buddies. Think of it as a cross between Tinder and Yelp, you'll have both great conversations and tasty food on Sapi!
- Meet new people nearby, check out their favourite foods, and send a spoon 🥄 (you can think of it as a like 😉) then start up a new conversation
- Find restaurants to meet up with your food buddies and have a great conversation
- Carry on your conversations on the app then check out your incoming spoons and send back some re-spoons
- Add details about yourself to your profile including a bio, favourite foods, and eating styles
This section gives an overview of the codebase structure.
server
folder
docker-compose.yaml
orchestration of GraphQL-Engine and Caddy containersCaddyfile
Caddy config file to make the GraphQL endpoint available over HTTPS.env.template
,.env.graphql-engine.template
,.env.caddy.template
environment variable template files for Docker containersmigrate/
folder containing PostgreSQL migrations and GraphQL-Engine metadataauth0/
folder containing Auth0 Rules for connecting Auth0 to Hasura GraphQL-Engine
client
folder
src/
folder containing Next.js codebasecodegen.yaml
,schemagen.yaml
,allowlistgen.yaml
config files for GraphQL Code Generatorapollo.config.js
config file for the Apollo GraphQL extension for vscode to provide intellisense for GraphQL queriesnext.config.js
Next.js config filepackage.json
project dependencies, scripts, babel config, et cetera
This section details the decisions behind the tech stack.
- Hasura GraphQL-Engine was chosen due to the robust set of features, extensive configuration, and instant zero-config GraphQL API provided ontop of a PostgreSQL database
- Caddy minimal-config reverse proxy server with Automatic HTTPS
- Auth0 secure authentication service that comes with integration with Hasura and Next.js
-
Next.js was chosen as the frontend React-based framework due to the included flexible routing system and static-site generation. The following packages are used client-side:
@auth0/nextjs-auth0
interoperability between Auth0 and Next.jsframer-motion
animation library with intuitive API and physics-based animationslinaria
CSS-in-JS library with a familiar Styled Components / Emotion API plus static CSS extractionrecoil
highly flexible React state management systemurql
lightweight React hooks based GraphQL client
-
Development Tools
- GraphQL Code Generator utility for generating typed GraphQL queries / mutations / subscriptions
This section will guide you through setting up a development environment.
- Yelp API Key Instructions
- Google Maps API Key Instructions
- Auth0 Application Setup Instructions
- Auth0 + Hasura GraphQL-Engine Integration Instructions
- Environment Variables entered into
.env-cmdrc.json
using.env-cmdrc.template.json
as a starting point (remember to remove.template
from the filename) containing the following key value pairs 👇
{
"dev": {
"AUTH0_DOMAIN": "[Auth0 Domain]",
"AUTH0_CLIENT_ID": "[Auth0 Client ID]",
"AUTH0_CLIENT_SECRET": "[Auth0 Client Secret]",
"AUTH0_SCOPE": "[Auth0 Scope]",
"AUTH0_REDIRECT": "[Post-login URL redirect]",
"AUTH0_LOGOUT_REDIRECT": "Post-logout URL redirect",
"AUTH0_SESSION_COOKIE_SECRET": "[Secret used to encrypt the session cookie]",
"NEXT_PUBLIC_GOOGLE_MAPS_APIKEY": "[Google Maps API Key]",
"NEXT_PUBLIC_GRAPHQL_ENDPOINT": "[GraphQL server endpoint]"
},
"graphql": {
"NEXT_PUBLIC_GRAPHQL_ENDPOINT": "[GraphQL server endpoint]",
"GRAPHQL_ENDPOINT_HEADER_NAME": "X-Hasura-Admin-Secret",
"GRAPHQL_ENDPOINT_HEADER_VALUE": "[Hasura Admin Secret]"
}
}
This project uses pnpm
although you may use your preferred package manager (npm
/ yarn
)
Follow these steps to setup a development environment:
- Register a domain name which will point to your GraphQL server
- Deploy a PostgreSQL instance on AWS RDS Instructions
- Deploy a Linux instance on AWS EC2 Instructions
- Ensure that your RDS and EC2 instances are on the same VPC to allow communication between them
- SSH into your EC2 instance Instructions
- Clone this repo
- In the
server
folder remove the.template
suffix from the.env.template
,.env.graphql-engine.template
, and.env.caddy.template
files and add your environment variables - Run
sudo docker-compose up
to start the GraphQL-Engine and Caddy containers - In the
migrate
folder remove the.template
suffix from the.env.template
file and add your environment variables - Install the Hasura CLI
npm add -g hasura-cli
then runhasura migrate apply
andhasura metadata apply
npm run gen:s
generate a local copy of the GraphQL schemanpm run gen
generate the GraphQL Operation files intoclient/src/operations
npm run dev
start a local Next.js development server
- Q: Why is it called Sapi?
- A: The name, Sapi, is derived from the Latin word, sapidus, meaning tasty.