Omniflix (https://omniflix.jloh02.dev/) is an app to help users search, organise and track the immense number of entertainment options available out there, ranging from movies and tv series to watch, books to read and games to play.
- Search, browse and track movies
The project requires a few accounts to be setup to work properly:
- Supabase (https://supabase.com/)
- OMDB API (https://www.omdbapi.com/apikey.aspx)
Ensure the following are installed:
- Latest LTS version of Node.js (This project was developed on Node.js 20)
- Node.js
yarn
package manager
Backend Development
- Docker Desktop (which also requires WSL if you are developing on Windows)
- Deno
git clone https://github.com/jloh02/omniflix
cd omniflix
This step is optional if developing directly on the production DB (which should NOT be the case)
- Navigate to
/backend
. - Run
yarn
to install dependencies - Run
yarn db:start
to spin up local DB (This step will take a couple of minutes for your first run)- Use
yarn db:reset
to reset the database according to seed.sql
- Use
- Run
yarn serve
. Functions will update as you save code. - To test locally, you can use
curl
or thejavascript
client library (refer below for more information)- To create a new function, run
yarn supabase functions new <function_name>
- To create a new function, run
- After developing, run
yarn db:stop
to stop local database container - Update the environment variables in
backend/.env.local
with your OMDB API keyOMDB_API_KEY=[INSERT OMDB API KEY]
OMDB_API_KEY
can be found in the email sent to you right after registering.
curl --request <GET/POST> 'http://localhost:54321/functions/v1/<function_name>' \
--header 'Authorization: Bearer <SUPABASE_ANON_KEY>' \
--header 'Content-Type: application/json' \
--data '{ "name":"Functions" }'
const supabase = createClient(
process.env.SUPABASE_URL,
process.env.SUPABASE_ANON_KEY
);
const { data, error } = await supabase.functions.invoke("function_name", {
body: { data: "some_body_data" },
});
deno test --allow-all .\supabase\functions\tests --env=.env.local
- Navigate to
/frontend
- Run
yarn
to install dependencies - Copy and rename the
.env.example
file as.env.local
and set the necessary variables (refer below for more information) - Run
yarn dev
to start the server atlocalhost:3000
. It might take a couple of minutes for the server to start the first time. - Point your browser to
http://localhost:3000
to see your local deployment.
In the .env.local
file, these environment variables need to be set up:
-
Update your Supabase details from your project settings.
NEXT_PUBLIC_SUPABASE_URL=[INSERT SUPABASE PROJECT URL] NEXT_PUBLIC_SUPABASE_ANON_KEY=[INSERT SUPABASE PROJECT API ANON KEY]
Both
NEXT_PUBLIC_SUPABASE_URL
andNEXT_PUBLIC_SUPABASE_ANON_KEY
can be found from the backend setup for local development. For production DB, it can be found in your Supabase project's API settings