Skip to content

Noah12398/OpenDesk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

OpenDesk πŸŽ“

Public Learning Resources Map for Every Student

OpenDesk is a community-driven platform that helps students discover free and low-cost learning resources like libraries, study centers, public Wi-Fi zones, and educational NGOs in their area.

License Node React


🌟 Features

For Students

  • πŸ—ΊοΈ Interactive Map - Discover learning resources on an interactive map
  • πŸ” Smart Search - Filter by category, location, and search terms
  • πŸ“ Location-Based - Find resources near you using pincode
  • πŸ“± Mobile-Friendly - Fully responsive design for all devices
  • βœ… Verified Resources - All resources are reviewed before publishing

For Contributors

  • βž• Add Resources - Submit new learning resources to help the community
  • πŸ‘€ User Tracking - Submissions are linked to your account
  • πŸ“Š Track Submissions - See the status of your submitted resources

For Admins

  • πŸ” Secure Dashboard - Protected admin panel with authentication
  • βœ… Review Submissions - Approve or reject community submissions
  • πŸ“ˆ Statistics - View pending, approved, and rejected counts
  • πŸ‘₯ User Management - Track who submitted each resource

πŸš€ Tech Stack

Frontend

  • React 18.2.0 - UI framework
  • React Router - Client-side routing
  • Leaflet - Interactive maps
  • Lucide React - Beautiful icons
  • Vite - Fast build tool

Backend

  • Node.js - Runtime environment
  • Express - Web framework
  • Supabase - PostgreSQL database & authentication
  • JWT - Token-based authentication

πŸ“¦ Installation

Prerequisites

  • Node.js >= 18.0.0
  • npm or yarn
  • Supabase account

1. Clone the Repository

git clone https://github.com/Noah12398/OpenDesk.git
cd OpenDesk

2. Backend Setup

cd backend
npm install

# Create .env file
cp .env.example .env

# Update .env with your Supabase credentials
# SUPABASE_URL=your_supabase_url
# SUPABASE_SERVICE_KEY=your_service_role_key
# PORT=5001

3. Database Setup

  1. Go to your Supabase project dashboard
  2. Navigate to SQL Editor
  3. Copy the contents of backend/schema.sql
  4. Paste and execute in SQL Editor

4. Frontend Setup

cd ../frontend
npm install

# Create .env.local file
cp .env.example .env.local

# Update with your Supabase credentials
# VITE_SUPABASE_URL=your_supabase_url
# VITE_SUPABASE_ANON_KEY=your_anon_key

5. Start Development Servers

# Terminal 1 - Backend
cd backend
npm run dev

# Terminal 2 - Frontend
cd frontend
npm run dev

The app will be available at:


πŸ” Authentication Setup

Already existing admin: email-darwinmaxwell05@gmail.com password-Qwerty123?

Create Your First Admin User

  1. Sign up through the app at http://localhost:5173/signup
  2. Get your User ID from Supabase Dashboard β†’ Authentication β†’ Users
  3. Grant admin privileges by running this SQL query:
insert into admin_users (id, email, role)
values ('YOUR_USER_ID', 'your-email@example.com', 'admin');

See AUTH_SETUP.md for detailed instructions.


πŸ“– Usage

For Students

  1. Browse Resources

    • Visit the map page to see all approved resources
    • Use filters to find specific types of resources
    • Click markers for details
  2. Submit Resources

    • Create an account and log in
    • Go to "Add Resource"
    • Fill out the form with resource details
    • Your submission will be reviewed by admins

For Admins

  1. Login at http://localhost:5173/login
  2. Access Admin Dashboard at http://localhost:5173/admin
  3. Review Submissions
    • View all pending submissions
    • Click βœ“ to approve or βœ— to reject
  4. Approved resources automatically appear on the public map

πŸ—‚οΈ Project Structure

OpenDesk/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── supabase.js          # Supabase client configuration
β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   └── auth.js              # JWT authentication middleware
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ auth.js              # Authentication endpoints
β”‚   β”‚   └── resources.js         # Resource CRUD endpoints
β”‚   β”œβ”€β”€ schema.sql               # Database schema
β”‚   β”œβ”€β”€ server.js                # Express server
β”‚   └── package.json
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ common/          # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/          # Layout components (Header, Footer)
β”‚   β”‚   β”‚   └── ProtectedRoute.jsx
β”‚   β”‚   β”œβ”€β”€ context/
β”‚   β”‚   β”‚   └── AuthContext.jsx  # Authentication state management
β”‚   β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”‚   β”œβ”€β”€ api.js           # API client
β”‚   β”‚   β”‚   └── supabase.js      # Supabase client
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MapDiscovery.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AddResource.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminDashboard.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”‚   └── Signup.jsx
β”‚   β”‚   └── App.jsx
β”‚   └── package.json
β”‚
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
β”œβ”€β”€ AUTH_SETUP.md
β”œβ”€β”€ DEBUG_GUIDE.md
└── TESTING_GUIDE.md

πŸ”Œ API Endpoints

Public Endpoints

Method Endpoint Description
GET /api/resources Get all approved resources
GET /api/resources/:id Get single resource by ID
GET /health Health check

Authentication Endpoints

Method Endpoint Description
POST /api/auth/signup Register new user
POST /api/auth/login Login user
POST /api/auth/logout Logout user
GET /api/auth/me Get current user info

Protected Endpoints (Require Authentication)

Method Endpoint Description Required Role
POST /api/resources Submit new resource Authenticated
GET /api/resources/pending Get pending resources Admin
PATCH /api/resources/:id/approve Approve resource Admin
PATCH /api/resources/:id/reject Reject resource Admin

πŸ§ͺ Testing

See TESTING_GUIDE.md for comprehensive testing instructions.

Quick Test

# Test backend health
curl http://localhost:5001/health

# Test API returns resources
curl http://localhost:5001/api/resources

πŸ› Troubleshooting

See DEBUG_GUIDE.md for common issues and solutions.

Common Issues

Resources not showing on map?

  • Check browser console for errors (F12)
  • Verify backend is running on port 5001
  • Check proxy configuration in vite.config.js

"Invalid token" error?

  • Logout and login again
  • Clear localStorage in browser console

Admin access denied?

  • Verify you're in the admin_users table
  • Check Supabase dashboard β†’ Authentication

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Built with ❀️ for students who need access to learning resources
  • Inspired by the need to bridge the digital divide in education
  • Special thanks to the open-source community

πŸ“ž Support

For issues or questions:

  1. Check the DEBUG_GUIDE.md
  2. Review TESTING_GUIDE.md
  3. Open an issue on GitHub

🎯 Roadmap

  • Email verification for new users
  • Password reset functionality
  • OAuth providers (Google, GitHub)
  • Mobile app (React Native)
  • Resource ratings and reviews
  • Advanced search with filters
  • Export resources as CSV
  • Multilingual support

Made with ❀️ for students everywhere

About

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors