# Supabase Notes
## Reading List
- Commands (Log in, Select from, filter): https://supabase.io/docs/reference/javascript/supabase-client
- **BEST Link:** Example for Log-In Component: https://supabase.io/docs/guides/with-nextjs
- Example for authentication with cookie: https://github.com/vercel/next.js/tree/canary/examples/with-supabase-auth-realtime-db
- Auth examples: https://supabase.com/docs/guides/examples
- Example Supabase & next API routes & SSR cookie: https://github.com/supabase/supabase/tree/master/examples/nextjs-with-supabase-auth
## CLI
### Need
- Git
- Docker (make sure the daemon is up and running)
- Supabase CLI (instructions [here](https://github.com/supabase/cli))
:arrow_right: Can't have Docker with Vercel
## Features
- Database
- Authentication
- File storage (we could use it for Profile Avatars?)
- Functions?

## APIs
### PostgREST
- API for quick database access (Create, Read, Update, Delete, joins)
- Frequent commands on: <https://supabase.io/docs/reference/javascript/select>
### Realtime API
- listens to database changes
- Supabase dashboard → Database → Replication → Source → toggle which tables
## Authentication
- Cookie: `supabase.auth.api.setAuthCookie(req, res)`
- LogIn: `await supabase.auth.signIn({ email })`
- getUser: `await supabase.auth.api.getUser(token)`
- `supabase.auth.user()`
## Image widget
```jsx=
import { Auth, Card, Typography, Space, Button, Icon } from '@supabase/ui'
await supabase.storage
.from('avatars')
.upload(filePath, file)
<img src="https://app.supabase.io/img/supabase-dark.svg">
```
# YouTube API notes
## (I needed a quick place to copy+paste some notes)
"YouTube Data API v3 has not been used in project 668162299199 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/youtube.googleapis.com/overview?project=668162299199 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
{items: [{id: {kind:'', videoId:''}, snippet:{}}]}
kind: 'youtube#searchListResponse', etag: 'au4TLTEJTMheeuw7MzUk1IEq0Fc', nextPageToken: 'CBkQAA', regionCode: 'GB', pageInfo: {…}, …}
etag: "au4TLTEJTMheeuw7MzUk1IEq0Fc"
items: Array(25)
0:
etag: "wbfSFxFDeW6cBR9QeSvPWCazx2k"
id: {kind: 'youtube#video', videoId: 'qz0aGYrrlhU'}
kind: "youtube#searchResult"
snippet:
channelId: "UCWv7vMbMWH4-V0ZXdmDpPBA"
channelTitle: "Programming with Mosh"
description: "HTML Tutorial for Beginners - Learn HTML for a career in web development. This HTML tutorial teaches you everything you need to get started. Get the ..."
liveBroadcastContent: "none"
publishTime: "2021-01-11T14:30:10Z"
publishedAt: "2021-01-11T14:30:10Z"
thumbnails: {default: {…}, medium: {…}, high: {…}}
title: "HTML Tutorial for Beginners: HTML Crash Course [2021]"