Share music with your mates
This repository contains the database configuration and a PWA test client for MelodyMates deployed at MelodyMates.app.
MelodyMates is a social network for close friends who want to share new songs they've discovered. Users can post the song they're currently listening to or search for specific titles. They can react to their friend's posts and reply by text or songs. MelodyMates is made for young music lovers.
- Install dependencies using
npm i
- Run and open the dev server using
npm run dev --open
This client is continuously deployed on Netlify on pushes to main.
If you still want to create a production version of the client, use npm run build
and preview using npm run preview
The database is currently not managed as IaC, meaning it has to be set up manually.
The .fauna directory includes a GraphQL schema including relationship indexes, as well as generated indexes, role definitions and user-defined functions.
For learning purposes, I decided to build most of the backend functionality using Fauna's user-defined functions and using narrow attribute-based access control.
The only function not contained within Fauna or the client is the authentication service on Google Cloud Functions. It validates a user's spotify key and generates a JWT for authorization on Fauna.
- A Client completes an OAuth2 handshake with a Music API to get an access key and refresh token.
- The client then sends the access key to the authentication service to get a MelodyMates JWT.
- The authentication service validates the authenticity and validity of the access key and generates the token using our private key.
- The client then uses this token in its request to the Fauna API.
- Fauna retrieves our public key from Netlify and validates the JWT. If correct, it uses the token's sub attribute to control which resources can be accessed.