Welcome to the Developer Resource Hub, a comprehensive platform for discovering and sharing AI tools and resources. This guide will walk you through setting up the application, which features user authentication, role-based access control, and robust admin management capabilities.
- Secure Authentication: Email/password authentication powered by Supabase with robust security measures
- Password Recovery: Simple password reset process via email verification
- Resource Submission: Authenticated users can submit new AI tools, websites, and resources
- Advanced Browsing: View all active resources with powerful search and category filtering capabilities
- Profile Management: Easy-to-use interface for updating user profile information and preferences
- Comprehensive Dashboard: Centralized admin interface for managing all resources and their status
- Resource Management: Efficiently change link status (active/inactive/broken) or remove outdated resources
- User Administration: View user roles and manage permissions with granular control
- Real-time Synchronization: Instant updates across all connected users for seamless collaboration
Before you begin, ensure you have the following installed and configured:
- Node.js: Version 18 or higher with npm or pnpm package manager
- Supabase Account: A free or paid account at supabase.com
- Vercel Account (Optional): For deployment to production environment at vercel.com
- Git: For version control and repository management
- Basic Knowledge: Familiarity with React/Next.js and SQL concepts is helpful
First, clone the repository and install the required dependencies:
git clone https://github.com/your-username/Developer_Resource_Hub.git
cd Developer_Resource_Hub
# Using npm
npm install
# Or using pnpm (recommended)
pnpm installSupabase provides the backend services for authentication and data storage:
- Navigate to supabase.com and sign in or create a new account
- Click "New Project" and configure your project settings:
- Choose a name for your project (e.g., "Developer Resource Hub")
- Select a database region closest to your users
- Set a strong database password
- Wait for the project to initialize (typically 1-2 minutes)
- Once ready, navigate to Settings > API in your project dashboard
- Copy the following credentials:
- Project URL → Will be used as
NEXT_PUBLIC_SUPABASE_URL - anon public key → Will be used as
NEXT_PUBLIC_SUPABASE_ANON_KEY
- Project URL → Will be used as
Create a .env.local file in the root directory of your project to store your Supabase credentials:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Development Environment
NEXT_PUBLIC_DEV_SUPABASE_REDIRECT_URL=http://localhost:3000
# (Optional) Production Environment (for later deployment)
# NEXT_PUBLIC_PROD_SUPABASE_REDIRECT_URL=https://your-domain.vercel.appReplace the placeholder values with the actual credentials obtained from your Supabase project.
The application requires a specific database schema to function correctly. The schema is defined in scripts/001_create_tables.sql. You have two options to set it up:
Option A: Using Supabase Dashboard (Recommended for first-time setup)
- Navigate to your Supabase project dashboard
- Click SQL Editor in the left sidebar
- Click New Query to open a new query window
- Open the
scripts/001_create_tables.sqlfile in your code editor - Copy the entire contents of the file
- Paste it into the SQL editor in Supabase
- Click Run to execute the SQL commands
- Verify that all tables were created successfully
Option B: Using the migration script
# Run the migration script
npm run migrateThis option requires the Supabase CLI to be installed and configured with your project.
To access admin features, you need to promote a user account to admin status:
- Start your development server (see step 6)
- Navigate to
http://localhost:3000/auth/registerand create a new account - Check your email and click the verification link to activate your account
- Log in to your Supabase dashboard
- Navigate to SQL Editor in the left sidebar
- Click New Query and run the following SQL command:
UPDATE public.profiles
SET role = 'admin'
WHERE email = 'your-email@example.com';Replace your-email@example.com with the email you used to register the account.
- Log out and back in to your application to refresh your permissions
You're now ready to start the development server:
# Using npm
npm run dev
# Or using pnpm
pnpm devOnce the server is running, open http://localhost:3000 in your browser to access the application.
You can now:
- Register a new user account
- Log in with your credentials
- Submit new resources
- Access the admin dashboard (if you've set up an admin account)
The user registration process follows a secure email verification workflow:
- User navigates to the registration page and provides their email and password
- Upon submission, the system sends a confirmation email with a verification link
- User clicks the verification link to activate their account
- Once verified, the user can log in and access all platform features
Authenticated users can contribute to the resource hub through a streamlined submission process:
- User navigates to the "Submit Resource" section from their dashboard
- User completes the submission form with:
- Resource name and URL
- Detailed description
- Relevant categories for classification
- Optional icon for visual identification
- The submitted resource is created with
status: 'active'by default - The resource immediately appears on the homepage for all users to discover
Administrators have comprehensive control over platform content through a dedicated dashboard:
- Admin logs in and accesses the Admin Dashboard from the user menu
- The dashboard displays all submitted resources with their current status
- Admins can perform the following actions:
- Change resource status to "active", "inactive", or "broken"
- Remove inappropriate or outdated resources
- Review user submissions for quality assurance
- Non-admin users only see resources with "active" status, ensuring a quality experience
The application uses a PostgreSQL database with the following primary tables:
Stores user profile information and permissions:
id(UUID, Primary Key) - References auth.users tableemail(text) - User's registered email addressfull_name(text) - User's display namerole(text) - User permission level: 'user' or 'admin'created_at(timestamp) - Account creation timestampupdated_at(timestamp) - Last profile update timestamp
Stores all submitted resources with their metadata:
id(UUID, Primary Key) - Unique identifier for each resourceuser_id(UUID, Foreign Key) - References the submitting username(text) - Resource display nameurl(text) - Direct URL to the resourcedescription(text) - Brief description of the resourcecategories(text[]) - Array of category tags for filteringicon_url(text) - External URL to resource iconicon_data_url(text) - Base64 encoded icon for fallbackstatus(text) - Resource status: 'active', 'inactive', or 'broken'created_at(timestamp) - Resource submission timestampupdated_at(timestamp) - Last modification timestamp
The application implements Supabase's Row Level Security (RLS) to ensure data privacy and integrity:
- Self-Access Policy: Users can only view and modify their own profile information
- Admin Override: Administrators have read access to all profiles for user management
- Public Access to Active Resources: All visitors can view resources with
status: 'active' - Creator Control: Users can view, edit, and delete their own submitted resources
- Administrative Oversight: Admins have full control over all resources regardless of status
These security policies ensure that user data remains private while maintaining an open platform for resource sharing.
Vercel provides an optimal hosting solution for Next.js applications with automatic deployments from Git:
-
Prepare Your Repository:
- Commit all changes to your local Git repository
- Push your code to GitHub (or GitLab/Bitbucket)
-
Connect to Vercel:
- Navigate to vercel.com and sign in
- Click "New Project" to begin the deployment process
- Import your repository using the Git provider integration
-
Configure Project Settings:
- Vercel will automatically detect the Next.js framework
- Ensure the build command is set to
npm run buildorpnpm build - Set the output directory to
.next(default for Next.js)
-
Add Environment Variables:
- Navigate to the "Environment Variables" section
- Add the following variables from your development environment:
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYNEXT_PUBLIC_PROD_SUPABASE_REDIRECT_URL(set to your deployment URL)
-
Deploy:
- Click "Deploy" to initiate the build and deployment process
- Vercel will provide you with a production URL upon completion
After successful deployment, update your Supabase authentication settings:
- Navigate to your Supabase project dashboard
- Go to Authentication > Settings
- Update the "Site URL" to your production domain
- Add your production URL to the "Redirect URLs" list
- Update the email template redirect URLs if necessary
This ensures that email verification and password reset links direct users to your production environment.
"User not authenticated" error
- Ensure you have completed the email verification process by clicking the link in your registration email
- Verify your Supabase session is still valid by checking browser local storage
- Clear browser cookies and try logging out and back in
- Check that your environment variables are correctly configured
Email verification not working
- Check your spam or junk folder for the verification email
- Verify the
NEXT_PUBLIC_DEV_SUPABASE_REDIRECT_URLenvironment variable matches your local development URL - Confirm your Supabase project's email settings are properly configured in Authentication > Settings
Resources not appearing on homepage
- Confirm the resource status is set to 'active' in the database
- Verify Row Level Security (RLS) policies are correctly implemented
- Check the browser console for any JavaScript errors
- Ensure the Supabase connection is working by testing the API endpoints
Admin dashboard not accessible
- Verify your user role is set to 'admin' in the profiles table
- Try logging out and clearing browser cache, then logging back in
- Check that the middleware is correctly protecting admin routes
- Ensure your authentication token has the necessary claims
If you encounter any issues or have questions about the Developer Resource Hub, we recommend the following resources:
-
Supabase Documentation: Comprehensive guides for authentication, database management, and real-time subscriptions
-
Next.js Documentation: Detailed information about the React framework used in this project
-
Project Wiki: Additional documentation specific to this application
-
GitHub Issues: Report bugs or request features
-
GitHub Discussions: Ask questions and share ideas with the community
This project is licensed under the MIT License, which permits reuse, modification, and distribution under specific conditions. For full details, see the LICENSE file in the repository.
- ✅ Commercial use is permitted
- ✅ Modification and distribution are allowed
- ✅ Private use is permitted
⚠️ Must include the original copyright and license notice- ❌ Liability is disclaimed
- ❌ No warranty is provided