CampuStore

The University Hub - the student market place

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.

πŸš€ Features

Core Marketplace

Interactive Features (New!)

πŸ“‹ Prerequisites

πŸ› οΈ Installation

1. Clone the Repository

git clone https://github.com/Ablorh4010/TheUniversityHub.git
cd TheUniversityHub

2. Install Dependencies

npm install

3. Environment Setup

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

4. Database Setup

Run database migrations to create all required tables:

npm run db:push

This will create the following tables:

5. Seed Categories (Optional)

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');

πŸš€ Development

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

πŸ—οΈ Building for Production

1. Type Check

npm run check

2. Build the Application

npm run build

This will:

3. Start Production Server

npm start

The application will be available on port 5000.

πŸ” Admin Access

Creating an Admin Account

Admin registration is restricted to secure invitation links only. To create an admin account:

  1. Use the secure admin registration link:
    https://your-domain.com/admin-register?token=CSE_ADMIN_2025_SECURE_a9f4b7c2d8e1
    
  2. Fill in the admin registration form with:
    • Email
    • Username
    • First Name
    • Last Name
    • Password
  3. Once registered, admins can:
    • Review and approve/reject product listings
    • Import products via CSV
    • Manage all stores and products
    • Access admin dashboard

Admin Login

After registration, admins can login at /auth using their email and password.

πŸ“± Mobile Deployment

The app is configured with Capacitor for native iOS and Android deployment.

Build for Mobile

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

πŸ”§ Configuration

Stripe Setup

  1. Create a Stripe account at https://stripe.com
  2. Get your API keys from https://dashboard.stripe.com/test/apikeys
  3. Add the keys to your .env file
  4. For production, use live keys instead of test keys

Email Setup (Resend)

  1. Create a Resend account at https://resend.com
  2. Get your API key
  3. Add it to your .env file as RESEND_API_KEY

Database Configuration

The app uses PostgreSQL with Drizzle ORM. Supported databases:

Update DATABASE_URL in .env with your database connection string.

πŸ“š API Documentation

Authentication Endpoints

Product Endpoints

Store Endpoints

Cart Endpoints

Event Calendar Endpoints (New!)

Club/Organization Endpoints (New!)

Auction/Bidding Endpoints (New!)

Study Group Endpoints (New!)

Social Endpoints (New!)

Gamification Endpoints (New!)

Push Notification Endpoints (New!)

πŸ”’ Security

🌐 Google Cloud Hosting

For deploying to Google Cloud:

App Engine

  1. Create app.yaml configuration
  2. Set environment variables in Cloud Console
  3. Run gcloud app deploy

Cloud Run

  1. Build Docker container
  2. Push to Container Registry
  3. Deploy to Cloud Run with environment variables

Required Environment Variables

All variables from .env.example must be configured in your hosting environment.

πŸ§ͺ Testing

# Run TypeScript type checking
npm run check

# Run linters (if configured)
npm run lint

πŸ“¦ Deployment

Deployment Platforms

The app can be deployed to:

Environment Variables

Make sure to set all required environment variables in your deployment platform:

Build Commands

πŸ› Troubleshooting

Database Connection Issues

Stripe Payment Issues

Email Sending Issues

πŸ“„ License

MIT

πŸ‘₯ Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Submit a pull request

πŸ“ž Support

For issues or questions:

πŸ™ Acknowledgments