- Go to your Supabase Dashboard.
- Select your project / Create a new one.
- Navigate to the "Project Settings" in the sidebar of your newly created project.
- Now go to "API" under
CONFIGURATION
section. - Copy the
URL
andANON-PUBLIC
from this tab and paste in your .env.local file respectively.
- Go to Github website.
- Click on your profile icon, located on top-right of the webpage.
- Click on "Settings" and go to
Developers settings
by scrolling down the page. - Click on
OAuth Apps
and create a new application. - From here you'll get two secret credentials - "Client ID" and "Secret".
- Now navigate to Supabase, and go inside "Authentication" tab from the sidebar.
- Under "Providers", find GitHub and fill in the "Client ID" and "Secret" fields with the details from your GitHub OAuth App.
- If you haven't created a GitHub OAuth App yet, you can follow this guide.
- Save your changes.
- Now you can do the authentication using github.
- Go to your Supabase Dashboard.
- Select your project.
- Navigate to the "SQL Editor" tab in the sidebar.
- Run the following SQL query:
create table
public.recent_users (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
name text null,
avatar_url text null,
bio text null,
username text not null,
stars_recieved numeric null default '0'::numeric,
forks numeric null default '0'::numeric,
followers numeric null default '0'::numeric,
public_repos numeric null default '0'::numeric,
organizations_count numeric null default '0'::numeric,
total_prs_merged numeric null default '0'::numeric,
total_issues_created numeric null default '0'::numeric,
rating double precision null default '-0.1'::double precision,
constraint recent_users_pkey primary key (id),
constraint recent_users_username_key unique (username)
) tablespace pg_default;
create table
public.usage_tracking (
id bigint generated by default as identity,
created_at timestamp with time zone not null default now(),
github_username text null,
usage_count numeric null default '0'::numeric,
date date null
) tablespace pg_default;
CREATE OR REPLACE FUNCTION get_user_rank(user_username text)
RETURNS TABLE(user_rank int) AS $$
BEGIN
RETURN QUERY
SELECT CAST(rnk AS int)
FROM (
SELECT username, rating, RANK() OVER (ORDER BY rating DESC) as rnk
FROM recent_users
WHERE rating != -0.1
) ranked_users
WHERE username = user_username;
END;
$$ LANGUAGE plpgsql;
- This will create a table named
recent_users
andget_user_rank
function in your Supabase project. - Open that table from
Table Editor
and disable the RLS Policy.
- Head over to Upstash. Sign up or log in to your account.
- Select the
Redis
option from the dashboard. - Create a new caching database.
- Fill in the details and create the database.
- Copy the connection credentials from
Rest API
section.- Replace the connection credentials in your
.env.local
file withNEXT_PUBLIC_UPSTASH_REDIS_URL
andNEXT_PUBLIC_UPSTASH_REDIS_TOKEN
.
- Replace the connection credentials in your
- You are good to go. Caching is ready to be used.
-
Open GitHub Desktop: Launch GitHub Desktop and log in to your GitHub account if you haven't already.
-
Clone the Repository:
- If you haven't cloned the ResourceHub repository yet, you can do so by clicking on the "File" menu and selecting "Clone Repository."
- Choose the ResourceHub repository from the list of repositories on GitHub and clone it to your local machine.
-
Switch to the Correct Branch:
- Ensure you are on the branch that you want to submit a pull request for.
- If you need to switch branches, you can do so by clicking on the "Current Branch" dropdown menu and selecting the desired branch.
-
Make Changes: Make your changes to the code or files in the repository using your preferred code editor.
-
Commit Changes:
- In GitHub Desktop, you'll see a list of the files you've changed. Check the box next to each file you want to include in the commit.
- Enter a summary and description for your changes in the "Summary" and "Description" fields, respectively. Click the "Commit to " button to commit your changes to the local branch.
-
Push Changes to GitHub: After committing your changes, click the "Push origin" button in the top right corner of GitHub Desktop to push your changes to your forked repository on GitHub.
-
Create a Pull Request:
- Go to the GitHub website and navigate to your fork of the ResourceHub repository.
- You should see a button to "Compare & pull request" between your fork and the original repository. Click on it.
-
Review and Submit:
- On the pull request page, review your changes and add any additional information, such as a title and description, that you want to include with your pull request.
- Once you're satisfied, click the "Create pull request" button to submit your pull request.
-
Wait for Review: Your pull request will now be available for review by the project maintainers. They may provide feedback or ask for changes before merging your pull request into the main branch of the ResourceHub repository.
⭐️ Support the Project If you find this project helpful, please consider giving it a star on GitHub! Your support helps to grow the project and reach more contributors.