This is a Next.js project bootstrapped with create-next-app
.
This project uses the following free services:
You will need to register an account in both of these services and create an .env.local
file with the credentials for them.
You can see an example of the file in the .env.example
file. You can copy this file to a .env.local
and write your credentials there.
# Supabase Admin Key, to be used only by API endpoints
SUPABASE_ADMIN_KEY=
# Supabase URL and public Key, to be used by the client
NEXT_PUBLIC_SUPABASE_URL=
NEXT_PUBLIC_SUPABASE_KEY=
# ImageKit URL, to be used by the client
NEXT_PUBLIC_IMAGEKIT_URL=
# ImageKit Private Key, To be used only by API endpoints
IMAGEKIT_PRIVATE_KEY=
-
To configure the database for the first time, run the
backup.sql
file in the SQL console of your Supabase instance. -
Then, run the
10_admin_roles.sql
file in thedb
folder to create theadmin
andsuperadmin
roles as that is not created in thebackup.sql
file generated bypg_dump
. -
Then, continue to the Getting Started section to run the development server and later see the Creating the superadmin user section to create your first
superadmin
user.
First, run the development server:
npm run dev
# or
yarn dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying pages/index.js
. The page auto-updates as you edit the file.
API routes can be accessed on http://localhost:3000/api/hello. This endpoint can be edited in pages/api/hello.js
.
The pages/api
directory is mapped to /api/*
. Files in this directory are treated as API routes instead of React pages.
You can create a normal user using the app's interface but you will need to run a SQL query to assign the superadmin role to this user. Sign up and create your new user using the login page of the app and the go to your Supabase Instance to run the following SQL
UPDATE auth.users SET role = 'superadmin' where email = '[email protected]'
where [email protected]
is the email you used to sign up in the login page.
Once this role is assigned, the superadmin
user will have access to edit the roles of every other user in the app via the settings page in the app.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.