A Progressive Web App (PWA) designed as a mobile-installable marketplace connecting university students for buying and selling items. Built with React, TypeScript, Express, and PostgreSQL.
git clone https://github.com/Ablorh4010/TheUniversityHub.git
cd TheUniversityHub
npm install
Create a .env file in the root directory (see .env.example):
# Database Configuration
DATABASE_URL=postgresql://username:password@host:port/database_name
# Stripe Configuration (get from https://dashboard.stripe.com/test/apikeys)
STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key_here
STRIPE_PUBLISHABLE_KEY=pk_test_your_stripe_publishable_key_here
VITE_STRIPE_PUBLIC_KEY=pk_test_your_stripe_publishable_key_here
# Push Notifications (generate with: npx web-push generate-vapid-keys)
VAPID_PUBLIC_KEY=your_vapid_public_key_here
VAPID_PRIVATE_KEY=your_vapid_private_key_here
VAPID_EMAIL=support@theuniversityhub.com
# WhatsApp OTP (optional)
META_WHATSAPP_PHONE_NUMBER_ID=your_phone_number_id_here
META_WHATSAPP_ACCESS_TOKEN=your_access_token_here
# Session Secret
SESSION_SECRET=your_random_session_secret_here
# Resend API Key for Email
RESEND_API_KEY=re_your_resend_api_key_here
Run database migrations to create all required tables:
npm run db:push
This will create the following tables:
INSERT INTO categories (name, icon, color) VALUES
('Electronics', 'Laptop', '#3B82F6'),
('Books', 'Book', '#10B981'),
('Clothing', 'Shirt', '#F59E0B'),
('Furniture', 'Sofa', '#8B5CF6'),
('Sports', 'Dumbbell', '#EF4444'),
('Other', 'Package', '#6B7280');
Start the development server:
npm run dev
This will start both the Vite dev server and the Express backend on port 5000.
Access the application at: http://localhost:5000
npm run check
npm run build
This will:
dist directorynpm start
The application will be available on port 5000.
Admin registration is restricted to secure invitation links only. To create an admin account:
https://your-domain.com/admin-register?token=CSE_ADMIN_2025_SECURE_a9f4b7c2d8e1
After registration, admins can login at /auth using their email and password.
The app is configured with Capacitor for native iOS and Android deployment.
See MOBILE_DEPLOYMENT.md for detailed mobile deployment instructions.
# Sync web app to mobile platforms
npx cap sync
# Open in Android Studio
npx cap open android
# Open in Xcode
npx cap open ios
.env file.env file as RESEND_API_KEYThe app uses PostgreSQL with Drizzle ORM. Supported databases:
Update DATABASE_URL in .env with your database connection string.
POST /api/auth/send-otp - Send OTP to emailPOST /api/auth/register - Register new userPOST /api/auth/login - Login with email/OTP or email/passwordPOST /api/auth/admin/register - Register admin (requires token)POST /api/auth/send-whatsapp-otp - Send WhatsApp OTP (sellers)POST /api/auth/seller/register - Register sellerGET /api/products - Get all productsGET /api/products/:id - Get product by IDPOST /api/products - Create new productPUT /api/products/:id - Update productDELETE /api/products/:id - Delete productGET /api/stores - Get all storesGET /api/stores/:id - Get store by IDPOST /api/stores - Create new storePUT /api/stores/:id - Update storeGET /api/cart/:userId - Get userβs cartPOST /api/cart - Add item to cartPUT /api/cart/:id - Update cart item quantityDELETE /api/cart/:id - Remove item from cartGET /api/events - Get all events (with filters)GET /api/events/:id - Get event details with RSVP countsPOST /api/events - Create new eventPOST /api/events/:id/rsvp - RSVP to eventGET /api/clubs - Get all clubsGET /api/clubs/:id - Get club with upcoming eventsPOST /api/clubs - Create new clubPOST /api/clubs/:id/join - Join a clubGET /api/auctions - Get active auctionsGET /api/auctions/:id - Get auction with bid historyPOST /api/auctions - Create new auctionPOST /api/auctions/:id/bid - Place a bidGET /api/study-groups - Get study groups (by course/university)POST /api/study-groups - Create study groupPOST /api/study-groups/:id/join - Request to joinPOST /api/users/:id/follow - Follow a userDELETE /api/users/:id/follow - Unfollow a userGET /api/users/:id/followers - Get userβs followersGET /api/users/:id/following - Get userβs followingGET /api/sellers/:id/reviews - Get seller reviewsPOST /api/sellers/:id/reviews - Add seller reviewGET /api/badges - Get all available badgesGET /api/users/:id/badges - Get userβs earned badgesGET /api/users/:id/points - Get userβs points and levelGET /api/users/:id/points/history - Get points transaction historyGET /api/leaderboard - Get top users leaderboardGET /api/push/vapid-key - Get VAPID public keyPOST /api/push/subscribe - Subscribe to push notificationsPOST /api/push/unsubscribe - Unsubscribe from notificationsPOST /api/push/test - Send test notificationFor deploying to Google Cloud:
app.yaml configurationgcloud app deployAll variables from .env.example must be configured in your hosting environment.
# Run TypeScript type checking
npm run check
# Run linters (if configured)
npm run lint
The app can be deployed to:
Make sure to set all required environment variables in your deployment platform:
DATABASE_URLSTRIPE_SECRET_KEYSTRIPE_PUBLISHABLE_KEYVITE_STRIPE_PUBLIC_KEYSESSION_SECRETRESEND_API_KEYnpm installnpm run buildnpm startDATABASE_URL is correctMIT
For issues or questions: