An open API service indexing awesome lists of open source software.

https://github.com/thesinghaman/studora

A cross-platform college community app for students to buy, sell, and negotiate items within campus using real-time messaging.
https://github.com/thesinghaman/studora

appwrite dart flutter lucide-react nextjs react typescript

Last synced: 2 months ago
JSON representation

A cross-platform college community app for students to buy, sell, and negotiate items within campus using real-time messaging.

Awesome Lists containing this project

README

          

# πŸŽ“ Studora

> A modern, cross-platform college marketplace application empowering students to buy, sell, rent, and report lost & found items within their campus community.

[![Flutter](https://img.shields.io/badge/Flutter-3.8.1-02569B?logo=flutter)](https://flutter.dev)
[![Appwrite](https://img.shields.io/badge/Appwrite-Backend-F02E65?logo=appwrite)](https://appwrite.io)
[![Firebase](https://img.shields.io/badge/Firebase-FCM-FFCA28?logo=firebase)](https://firebase.google.com)
[![License](https://img.shields.io/badge/License-Custom-blue.svg)](LICENSE)

---

## πŸ“‹ Table of Contents

- [Overview](#-overview)
- [Features](#-features)
- [Tech Stack](#-tech-stack)
- [Architecture](#-architecture)
- [Prerequisites](#-prerequisites)
- [Installation](#-installation)
- [Configuration](#-configuration)
- [Appwrite Setup](#1-appwrite-setup)
- [Firebase Setup](#2-firebase-setup)
- [Appwrite Functions](#3-appwrite-functions-deployment)
- [Project Structure](#-project-structure)
- [Running the App](#-running-the-app)
- [Contributing](#-contributing)
- [License](#-license)

---

## 🌟 Overview

**Studora** is a comprehensive campus marketplace solution designed specifically for college communities. Students can seamlessly buy and sell items, rent equipment, list lost & found items, and communicate through real-time messagingβ€”all within a secure, college-verified environment.

### 🎯 Key Highlights

- **Real-Time Messaging**: Built-in chat system for negotiation and communication
- **Multi-Category Support**: Marketplace, Rentals, Lost & Found
- **Image Management**: Upload, crop, and manage item photos
- **Push Notifications**: Firebase Cloud Messaging integration
- **Offline Support**: Local caching with GetStorage and Hive
- **Cross-Platform**: iOS and Android Support

---

## ✨ Features

### πŸ›οΈ Marketplace

- Browse and search items by category
- Post items for sale with multiple images
- Price negotiation through integrated chat
- Wishlist functionality
- Filter by condition, price range, and category

### 🏠 Rentals

- List items for rent with daily/monthly rates
- Set rental periods and availability
- Manage rental requests

### πŸ” Lost & Found

- Report lost items with descriptions and photos
- Browse found items by category
- Contact finders directly through messaging

### πŸ’¬ Real-Time Messaging

- One-on-one chat with automatic conversation creation
- Image sharing in messages
- Read receipts and typing indicators
- Message notifications

### πŸ‘€ User Profile

- Manage personal listings
- Update profile information and avatar
- Block users and report content

---

## πŸ› οΈ Tech Stack

### Frontend (Flutter App)

- **Framework**: Flutter 3.8.1+
- **State Management**: GetX
- **Local Storage**: Hive, GetStorage
- **Networking**: Appwrite SDK
- **UI Components**: Custom Material Design
- **Image Handling**: image_picker, image_cropper, cached_network_image

### Backend (Appwrite)

- **Authentication**: Email/Password
- **Database**: NoSQL Collections
- **Storage**: Cloud Storage for images
- **Realtime**: WebSocket subscriptions
- **Functions**: Dart serverless functions (Single Monolithic Function)

### Push Notifications

- **Service**: Firebase Cloud Messaging (FCM)
- **Local Notifications**: flutter_local_notifications

---

## πŸ—οΈ Architecture

```
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Flutter Mobile App β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ UI Layer β”‚ β”‚ Controllersβ”‚ β”‚ Services/Repos β”‚ β”‚
β”‚ β”‚ (Views) │◄── (GetX) │◄── (Business Logic) β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚ β–² β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Appwrite Backend β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Database β”‚ β”‚ Storage β”‚ β”‚
β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚ β”‚ Auth β”‚ β”‚ Cloud Functionsβ”‚ β”‚
β”‚ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€ β”‚
β”‚ β”‚ Realtime β”‚ β”‚ Permissions β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β–²
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Firebase β”‚
β”‚ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚ β”‚ Cloud Messaging (Push) β”‚ β”‚
β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

---

## πŸ“¦ Prerequisites

Before you begin, ensure you have the following installed:

- **Flutter SDK**: `>= 3.8.1` ([Install Flutter](https://flutter.dev/docs/get-started/install))
- **Dart SDK**: `>= 3.8.1`
- **Android Studio** or **VS Code** with Flutter extensions
- **Xcode** (for iOS development on macOS)
- **Node.js**: `>= 18.x` (for local Appwrite Functions development)
- **GitHub Account**: For hosting Appwrite Functions repositories
- **Firebase CLI** (optional): For Firebase configuration

---

## πŸš€ Installation

### 1. Clone the Repository

```bash
git clone https://github.com/thesinghaman/studora.git
cd studora
```

### 2. Install Flutter Dependencies

```bash
cd studora-app
flutter pub get
```

### 3. Install Appwrite Functions Dependencies

```bash
cd ../appwrite-functions

# Install dependencies for all functions
for dir in */; do
cd "$dir"
npm install
cd ..
done
```

---

## βš™οΈ Configuration

### 1. Appwrite Setup

#### Step 1: Create Appwrite Project

1. Go to [Appwrite Console](https://cloud.appwrite.io)
2. Create a new project
3. Note down your **Project ID** and **Endpoint URL**

#### Step 2: Create Database & Collections

Create a database with the following collections:

| Collection Name | Purpose |
| ---------------- | --------------------------------- |
| `users` | User profiles and metadata |
| `items` | Marketplace & rental listings |
| `lostFoundItems` | Lost & found reports |
| `categories` | Item categories |
| `conversations` | Chat conversations |
| `messages` | Chat messages |
| `countries` | Supported countries |
| `colleges` | College list with domains |
| `reports` | User reports & content moderation |
| `supportTickets` | User support requests |
| `legalDocuments` | Terms, Privacy Policy |

#### Step 3: Configure Collections Schema

**Users Collection** (`users`):

```javascript
{
userId: string (required),
userName: string (required),
email: string (required),
collegeId: string (required),
rollNumber: string,
hostel: string,
dateJoined: datetime,
fcmToken: string,
userAvatarUrl: string,
userAvatarFileId: string,
wishlist: string[] (array),
blockedUsers: string[] (array),
reportedContent: string[] (array),
isOnline: boolean,
lastSeen: datetime,
showReadReceipts: boolean
}
```

**Items Collection** (`items`):

```javascript
{
itemId: string (required),
title: string (required),
description: string,
price: number,
rentalPrice: number,
categoryId: string,
categoryType: string, // 'sale' or 'rental'
condition: string,
imageUrls: string[] (array),
imageFileIds: string[] (array),
sellerId: string,
sellerName: string,
sellerAvatarUrl: string,
collegeId: string,
status: string, // 'available', 'sold', 'rented'
createdAt: datetime,
updatedAt: datetime,
viewCount: number
}
```

**Conversations Collection** (`conversations`):

```javascript
{
conversationId: string (required),
participants: string[] (array), // user IDs
participantNames: object,
participantAvatars: object,
lastMessage: string,
lastMessageType: string,
lastMessageTime: datetime,
unreadCounts: object,
relatedItem: object,
createdAt: datetime,
updatedAt: datetime
}
```

**Messages Collection** (`messages`):

```javascript
{
messageId: string (required),
conversationId: string,
senderId: string,
text: string,
messageType: string, // 'text', 'image', 'system'
imageUrls: string[] (array),
imageFileIds: string[] (array),
readBy: string[] (array),
createdAt: datetime
}
```

> **Note**: Create indexes on frequently queried fields for better performance.

#### Step 4: Create Storage Bucket

1. Navigate to **Storage** in Appwrite Console
2. Create a bucket named `items-images`
3. Configure permissions:
- Read: `any()`
- Create: `users()`
- Update: `users()`
- Delete: `users()`

#### Step 5: Configure Environment Variables

Create a `.env` file in the `studora-app/` directory and add your Appwrite configuration:

```dotenv
# Appwrite Configuration
PROJECT_ENDPOINT=https://cloud.appwrite.io/v1
PROJECT_ID=YOUR_PROJECT_ID
APPWRITE_DATABASE_ID=YOUR_DATABASE_ID

# Collection IDs
LEGAL_DOCUMENTS_COLLECTION_ID=YOUR_COLLECTION_ID
COUNTRIES_COLLECTION_ID=YOUR_COLLECTION_ID
COLLEGES_COLLECTION_ID=YOUR_COLLECTION_ID
USERS_COLLECTION_ID=YOUR_COLLECTION_ID
ITEMS_COLLECTION_ID=YOUR_COLLECTION_ID
LOST_FOUND_ITEMS_COLLECTION_ID=YOUR_COLLECTION_ID
CATEGORIES_COLLECTION_ID=YOUR_COLLECTION_ID
CONVERSATIONS_COLLECTION_ID=YOUR_COLLECTION_ID
MESSAGES_COLLECTION_ID=YOUR_COLLECTION_ID
REPORTS_COLLECTION_ID=YOUR_COLLECTION_ID
SUPPORT_TICKETS_COLLECTION_ID=YOUR_COLLECTION_ID

# Storage Bucket ID
ITEMS_IMAGES_BUCKET_ID=YOUR_BUCKET_ID

# Function ID (will be filled after deploying functions)
STUDORA_BACKEND_FUNCTION_ID=
```

---

### 2. Firebase Setup

#### Step 1: Create Firebase Project

1. Go to [Firebase Console](https://console.firebase.google.com)
2. Create a new project
3. Add Android and iOS apps

#### Step 2: Configure Android

1. Download `google-services.json`
2. Place it in `studora-app/android/app/`
3. Ensure `build.gradle` includes Firebase plugin

#### Step 3: Configure iOS

1. Download `GoogleService-Info.plist`
2. Place it in `studora-app/ios/Runner/`
3. Update Xcode project settings

#### Step 4: Generate Firebase Options

```bash
cd studora-app

# Install FlutterFire CLI
dart pub global activate flutterfire_cli

# Configure Firebase
flutterfire configure
```

This will create `lib/firebase_options.dart` with your Firebase configuration.

#### Step 5: Enable Cloud Messaging & Download Service Account

1. In Firebase Console, navigate to **Cloud Messaging**
2. Enable Firebase Cloud Messaging API
3. Go to **Project Settings** β†’ **Service Accounts**
4. Click **Generate New Private Key**
5. Download the JSON file (e.g., `serviceAccountKey.json`)
6. **Save this file securely** - you'll need to upload it to Appwrite for push notifications

---

### 3. Appwrite Functions Deployment

The backend logic is consolidated into a single Dart function (`studora-backend`) for easier maintenance and deployment.

#### Step 1: Push Backend to GitHub

Ensure your `studora-backend` directory is committed and pushed to your GitHub repository.

```bash
git add studora-backend/
git commit -m "Add Dart Backend"
git push origin main
```

#### Step 2: Connect Function in Appwrite Console

1. Go to **Appwrite Console** β†’ **Functions** β†’ **Create Function**
2. Click **Connect Git Repository**
3. Authorize GitHub if not already connected
4. Select your repository (e.g., `studora`)
5. **Production Branch**: `main`
6. **Root Directory**: `studora-backend`
7. **Runtime**: Select `Dart 3.0` (or latest available)
8. **Entrypoint**: `lib/main.dart`
9. **Build Settings**:
- Build Command: `dart pub get`
10. Click **Connect**

Appwrite will automatically deploy the function from GitHub. Any future commits to the connected branch will trigger automatic redeployment.

#### Step 3: Configure Environment Variables

In the Appwrite Console for your function, go to **Settings** β†’ **Environment Variables** and add:

- `APPWRITE_DATABASE_ID`: Your Database ID
- `APPWRITE_USERS_COLLECTION_ID`: Users Collection ID
- `APPWRITE_ITEMS_COLLECTION_ID`: Items Collection ID
- `APPWRITE_CHATS_COLLECTION_ID`: Chats Collection ID
- `APPWRITE_MESSAGES_COLLECTION_ID`: Messages Collection ID
- ... (Add other collection IDs as needed)

#### Step 4: Configure Push Notifications

To enable Firebase Cloud Messaging in Appwrite:

1. Go to **Appwrite Console** β†’ **Messaging** β†’ **Providers**
2. Click **Add Provider** β†’ **FCM**
3. **Upload Service Account JSON**:
- Click **Upload** and select your Firebase `serviceAccountKey.json` file
- This file is required for Appwrite to send push notifications
4. Click **Create**

#### Step 5: Update Function ID in App

After deployment, copy the function ID from Appwrite Console and update your `.env` file in `studora-app/`:

```dotenv
STUDORA_BACKEND_FUNCTION_ID=YOUR_FUNCTION_ID
```

---

## πŸ“ Project Structure

```
studora/
β”œβ”€β”€ studora-app/ # Flutter mobile application
β”‚ β”œβ”€β”€ lib/
β”‚ β”‚ β”œβ”€β”€ main.dart # App entry point
β”‚ β”‚ β”œβ”€β”€ firebase_options.dart # Firebase configuration
β”‚ β”‚ └── app/
β”‚ β”‚ β”œβ”€β”€ bindings/ # GetX dependency injection
β”‚ β”‚ β”œβ”€β”€ config/ # App configuration
β”‚ β”‚ β”‚ β”œβ”€β”€ navigation/ # Routes and pages
β”‚ β”‚ β”‚ └── theme/ # App theming
β”‚ β”‚ β”œβ”€β”€ data/
β”‚ β”‚ β”‚ β”œβ”€β”€ models/ # Data models
β”‚ β”‚ β”‚ β”œβ”€β”€ providers/ # API providers
β”‚ β”‚ β”‚ └── repositories/ # Business logic layer
β”‚ β”‚ β”œβ”€β”€ modules/ # Feature modules
β”‚ β”‚ β”‚ β”œβ”€β”€ auth/ # Authentication
β”‚ β”‚ β”‚ β”œβ”€β”€ home/ # Home dashboard
β”‚ β”‚ β”‚ β”œβ”€β”€ marketplace/ # Item listings
β”‚ β”‚ β”‚ β”œβ”€β”€ messages/ # Chat functionality
β”‚ β”‚ β”‚ β”œβ”€β”€ profile/ # User profile
β”‚ β”‚ β”‚ └── ...
β”‚ β”‚ β”œβ”€β”€ services/ # Core services
β”‚ β”‚ β”‚ β”œβ”€β”€ appwrite_service.dart
β”‚ β”‚ β”‚ β”œβ”€β”€ notification_service.dart
β”‚ β”‚ β”‚ β”œβ”€β”€ logger_service.dart
β”‚ β”‚ β”‚ └── storage_service.dart
β”‚ β”‚ └── shared_components/ # Reusable widgets & utils
β”‚ β”œβ”€β”€ android/ # Android native code
β”‚ β”œβ”€β”€ ios/ # iOS native code
β”‚ └── pubspec.yaml # Flutter dependencies
β”‚
β”œβ”€β”€ studora-backend/ # Dart serverless backend
β”‚ β”œβ”€β”€ lib/
β”‚ β”‚ β”œβ”€β”€ actions/ # Individual business logic actions
β”‚ β”‚ β”‚ β”œβ”€β”€ create_message.dart
β”‚ β”‚ β”‚ β”œβ”€β”€ get_public_listings.dart
β”‚ β”‚ β”‚ └── ...
β”‚ β”‚ β”œβ”€β”€ utils/ # Backend utilities
β”‚ β”‚ └── main.dart # Main entry point (Router)
β”‚ └── pubspec.yaml # Backend dependencies
β”‚
└── README.md # This file
```

---

## πŸƒ Running the App

### Development Mode

```bash
cd studora-app

# Run on Android emulator/device
flutter run

# Run on iOS simulator/device (macOS only)
flutter run

# Run on Chrome (Web)
flutter run -d chrome
```

### Production Build

#### Android APK

```bash
flutter build apk --release
```

Output: `build/app/outputs/flutter-apk/app-release.apk`

#### iOS IPA

```bash
flutter build ios --release
```

Then use Xcode to archive and export IPA.

### Debug Tips

- Use `flutter doctor` to check for any setup issues
- Enable verbose logging: `flutter run -v`
- Check Appwrite logs in Console for backend issues
- View Firebase logs in Firebase Console for FCM issues

---

## 🀝 Contributing

We welcome contributions! Please follow these steps:

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

---

## πŸ“„ License

This project is licensed under a **Custom Non-Commercial License**.

**You are allowed to:**

- βœ… View, study, and learn from the source code
- βœ… Use the software for personal and educational purposes
- βœ… Fork the repository for learning and experimentation

**You are NOT allowed to:**

- ❌ Sell, sublicense, or commercialize the software
- ❌ Redistribute the software or substantial portions of it
- ❌ Use it in any commercial product or service

See the [LICENSE](LICENSE) file for complete terms and conditions.

For commercial licensing inquiries, please contact the author.

---

## πŸ™ Acknowledgments

- **Flutter Team** - For the amazing framework
- **Appwrite Team** - For the powerful backend solution
- **Firebase Team** - For reliable push notifications
- **GetX Community** - For state management insights

---

## πŸ“§ Contact & Support

- **Author**: Aman Singh
- **GitHub**: [@thesinghaman](https://github.com/thesinghaman)
- **Repository**: [studora](https://github.com/thesinghaman/studora)

For issues and feature requests, please use the [GitHub Issues](https://github.com/thesinghaman/studora/issues) page.

---

**Made with ❀️ for college communities**

⭐ Star this repo if you find it helpful!