Skip to content

juandjara/guardianesdelrol

Repository files navigation

This is a Next.js project bootstrapped with create-next-app.

Setting Up Credentials

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=

Setting up the Database

  1. To configure the database for the first time, run the backup.sql file in the SQL console of your Supabase instance.

  2. Then, run the 10_admin_roles.sql file in the db folder to create the admin and superadmin roles as that is not created in the backup.sql file generated by pg_dump.

  3. 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.

Getting Started

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.

Creating the superadmin user

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 = 'your@email.com'

where your@email.com 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.

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

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.

About

Portal para organizar las partidas de rol de la asociación Guardianes de Sevilla - nuevo diseño, version 2021

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published