A boilerplate project for using fresh with
- Authentication powered by supabase
- Compatible with deno deploy
Start the project:
deno task start
This will watch the project directory and restart as necessary.
Supabase provide a client supabase-js to facilitate the supabase integration. However this client is not compatible with deno deploy. see comment. This is limiting the
If you don't want to use deno deploy then this implementation might not be the best one.
deno deploy runs on the edge, far away from the database. So instead of verifying the user by making a call to the database, the request is authenticated by verifying the jwt on the server. This works great for basic usage. However if some parameter needs to be retrieve from the user profile, then the optimisation is lost.
TODO:. Not tested yet.
- handle errors
- bit of styling
- how to create something like a cart?
- deploy to a deno deploy project
- Add all the environment variable listed in .ev.example to the deploy project
In Authentication > settings
- Set the Site URL as the new deploy address eg: https://xxxxx.deno.dev
- Add a "Redirect URLs": http://localhost:8000/api/auth/oauth_callback
-
JWT anatomy https://fusionauth.io/learn/expert-advice/tokens/anatomy-of-jwt
-
Implement JWT https://thomasstep.com/blog/a-guide-to-using-jwt-in-javascript#creating-public-and-private-keys
refresh tokens: https://auth0.com/learn/refresh-tokens/