Nuxt Supabase is a getting started template for Nuxt + Supabase projects, having pre configued Auth, RLS, policies, Nuxt UI, Tailwind setup
demo.mp4
Open the folder where you want to setup the project
git clone https://github.com/vue-simform/nuxt-supabase-rls .
npm install
- Login To Supabase
- Create a new project.
Note: Remember / copy your database password to somewhere safe.
- Go to Supabase Dashboard & select your project while you have just created
- Go to setting, then under database,
API
tab. - Now open your project, create a
.env
file in the projects root.
SUPABASE_URL="https://abc.supabase.co"
SUPABASE_KEY="YOUR_KEY"
SUPABASE_SERVICE_KEY="YOUR_SERVICE_KEY"
HOST="http://localhost:3000"
- Follow the above
.env
format and copy & past your credentials in that file.
- To have the same replica of DB structure as mine. Go to Supabase SQL Editor
- Copy paste this into your Supabase SQL editor.
- Next step is to select all (cmd + A / control + A) & then Run Selected.
npx supabase login
- A like will appear when you enter above command. Click on that link.
- Generate a token, & copy it. Remember to save that token somewhere
- Paste that token in terminal.
As we are using typescript Generating Types is also a important step to get all the type hinting in our project
- Go to project Settings, & then General where you will find, project referance ID
- Run the following command in the projects root
npx supabase gen types typescript --project-id YOUR_PROJECT_REFERANCE_ID > database-generated.types.ts
Note: Substitute your project referance id instead of YOUR_PROJECT_REFERANCE_ID
Follow the steps mentioned here
npm run dev
Start the development server on http://localhost:3000
:
Check out the deployment documentation for more information.
- For user login you first have to
register
. Go to http://localhost:3000/register & register the users. - After registration, a login link will be sent to the users email account.
- Clicking on that link will simply login user, also your email will be verified (By Default done by Supabase).
- Now you can access the
organisations
tab which was unaccessabe earlier. - You will see that you are not added to any organisation.
- You can do it manually, through Supabase Dashboard
- Use of modern tools like Nuxt 3, Typescript & Tailwind
- Ready made & fully scalable Auth systeam
- Nuxt UI library integrations for seemless user experience
- Supabase tables, RLS, policies, triggers setup pre configued and fully scalable.
- vee-validate with composition api pre setup in auth pages.
- Route guard
- Responsive UI
/ - Home Page
/login - Login Page
/register - Registration Page
/profile - Profile Page
Auth Guard Enabled
/organisations - List of users organisations (organisations user is part of)
Auth Guard Enabled
/organisations/[id] - Organisations specific page
Auth Guard Enabled
Note here, if user try to access specific organisation by url,
then user should be the part of that organiastion, otherwise
it will show that user is not part of organisation as RLS is enabled
/organisations/[id]/projects - List of all Organisations project
Auth Guard Enabled
/organisations/[id]/projects/[projectId] - Organisation Project specific page
Auth Guard Enabled
Here also same check as Organisation is applied