A modern volunteer management platform for Samarthanam Trust, built with React, TypeScript, Vite, and Supabase.
- Admin and volunteer user roles with separate dashboards
- Event management and volunteer registration
- Feedback collection and reporting
- Modern, accessible UI with dark mode support
- Responsive design for all devices
- Frontend: React, TypeScript, Vite, Tailwind CSS, shadcn/ui
- Backend: Supabase (Auth, Database, Storage)
- ORM: Drizzle ORM for typesafe database access
- API: RESTful API with React Query
- State Management: React Context API + React Query
- Deployment: Docker & GitHub Actions
- Node.js 18+ and npm/pnpm
- Supabase account (free tier works)
-
Clone the repository:
git clone https://github.com/your-username/samarthanam.git cd samarthanam
-
Install dependencies:
pnpm install
-
Copy the
.env.example
to.env
and configure your environment variables:cp .env.example .env
-
Update the
.env
file with your Supabase credentials:VITE_SUPABASE_URL=your_supabase_url VITE_SUPABASE_ANON_KEY=your_supabase_anon_key DATABASE_URL=your_postgresql_connection_string
-
Start the development server:
pnpm dev
src/admin/
- Admin dashboard components and pagessrc/components/
- Shared UI componentssrc/db/
- Database schema and configurationsrc/lib/
- Utilities and context providerssrc/pages/
- Main application pagessrc/services/
- API and authentication services
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes and commit:
git commit -m "feat: add your feature"
-
Push to the branch:
git push origin feature/your-feature-name
-
Open a pull request
This project is licensed under the MIT License.
The application uses Supabase for database storage and authentication.
Make sure to set up these environment variables in your .env
file:
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-supabase-anon-key
The database contains the following tables:
admin
- Admin user detailsvolunteer
- Volunteer user detailsevent
- Event informationtask
- Tasks associated with eventsevent_signup
- Volunteer signups for eventstask_assignment
- Task assignments for volunteersfeedback
- Feedback from eventsnewsletter
- Newsletter subscribers
The Supabase client is available in the src/lib/supabase.ts
file. Example usage:
import { supabase } from '@/lib/supabase';
// Get admin by email
const { data: admin, error } = await supabase
.from('admin')
.select('*')
.eq('email', email)
.single();
// Create new admin
const { data: newAdmin, error } = await supabase
.from('admin')
.insert({
email: '[email protected]',
first_name: 'Admin',
last_name: 'User',
password: 'securepassword'
})
.select()
.single();
To properly set up the database schema for the Samarthanam Volunteer Management System, follow these steps:
-
Connect to Supabase SQL Editor:
- Log in to your Supabase dashboard
- Navigate to the SQL Editor section
-
Run the required scripts in this order:
# First, run the base schema script to establish the tables src/db/fix-database-schema.sql # Then set up the notification system src/db/create-notification-system.sql # If you need to assign volunteers to tasks programmatically, run src/db/assign-volunteer-function.sql
-
Verify the database structure:
- Each table should have the required columns as defined in the schema
- Foreign key relationships should be properly established
- The notification system triggers and functions should be set up
-
Troubleshooting Database Issues:
If you encounter database-related errors when using the application, they typically fall into one of these categories:
- Missing Tables: Run the appropriate SQL scripts to create missing tables
- Missing Columns: Use ALTER TABLE statements to add missing columns
- Foreign Key Constraints: Ensure that references between tables are properly set up
- Notification System: Verify that the notification triggers and functions are working
The system uses the following key tables:
- volunteer: Stores volunteer information and profiles
- event: Stores event details and schedules
- event_signup: Tracks volunteer registration for events
- task: Stores task information linked to events
- task_assignment: Tracks task assignments to volunteers
- notification: Stores notifications sent to volunteers and admins
The notification system uses several functions:
auto_expire_task_assignments()
: Automatically expires task assignments past their response deadlinesend_deadline_reminders()
: Sends reminder notifications for tasks with approaching deadlinesassign_volunteer_to_task()
: Function to assign volunteers to tasks with proper notification