To report bugs, please open an issue.
To share ideas with the community, ask questions, and new features, please start a discussion.
This is a Next.js project bootstrapped with create-next-app
.
It uses Supabase as the backend service, which is built on top of Postgres.
You need Node.js v20.3.1+ to run OpenTask locally.
These instructions should be followed only once:
- Clone this repo.
- Install dependencies:
npm install
. - Install Docker Desktop.
- Make a copy of
.env.example
file and name it.env
. You won't need to change this file as it already contains the localhost database URL. You can change it if you want to set up authentication with OAuth. - Make a copy of
.env.local.example
file and name it.env.local
. You'll make a change to this file after you start Supabase (see next).
These instructions should be followed every time you want to run the app locally:
- Open Docker Desktop.
- Start Supabase:
npx supabase start -x realtime,storage-api,imgproxy
. That will exclude unused Supabase services to save on RAM. If you forget to open Docker Desktop you'll get an error message starting withCannot connect to the Docker daemon
. - You'll get some URLs and
anon key
. Copy the value ofanon key
and past it in your.env.local
file as the value of theNEXT_PUBLIC_SUPABASE_ANON_KEY
variable. You only have to do this once. - Run Prisma migrations:
npx prisma migrate dev
. - Run Next.js local development server:
npm run dev
. - Open http://localhost:3000 with your browser to use the app.
It's easier to sign in with an email on localhost, as there's no need to set up OAuth apps.
Email sign in is enabled on localhost only, there's no such option on production.
You can use a fake email like [email protected]
. See how next.
- Visit the Sign In page, enter an email and hit continue. You should be redirected to
http://localhost:3000/auth/sign-in/check-email-link
. - Open http://localhost:54324/monitor in a new browser tab. That's Inbucket, an email testing app running locally alongside Supabase.
- You should see an email with the subject
Confirm Your Email
. Open it, then click on the linkConfirm your email address
. - You should be redirected to a URL that starts with
http://localhost/auth/v1/verify
. It used to work correctly, but after some tests it stopped adding the necessary port number to the URL. So go ahead and manually add:54321
to the URL so that it starts withhttp://localhost:54321/auth/v1/verify
instead (keep the rest of URL as is). We should fix this issue, but for now this extra step will make it. - Hit enter and you should be logged in and redirected to
http://localhost:3000/app/today
. - You can now test the app locally. Enjoy!
That email confirmation link expires pretty quickly, so if you take a while to click it you might be redirected back to the Sign In page with the following URL:
http://localhost:3000/auth/sign-in#error=invalid_request&error_code=400&error_description=No+associated+flow+state+found.+400%253A+Flow+state+is+expired
.
If that happens, just try again. If you can't sign in, please open a issue.
We should also improve the UX by adding a message telling the user that an error happened and they should try again.
- Stop Supabase:
npx supabase stop
. If you want to clear all database data, run this instead:npx supabase stop --no-backup
. - Close Docker Desktop.
- Stop the Next.js development server.
If you find any problems with the instructions above, please open an issue.